From 1b377b67ef2823fb38283646d6746d4d5df38a37 Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Date: Fri, 22 Dec 2023 22:50:02 +0100 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4ed0e35 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +# This workflow will: +# - compile game on windows, linux, macos +# - run game sonar on linux + +name: Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + jdk: [17] + runs-on: ${{ matrix.os }} + env: + JDK_VERSION: ${{ matrix.jdk }} + AUDIODEV: "null" + + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + + - name: Cache + uses: actions/cache@v3.3.2 + with: + path: ~/.m2/repository + key: maven-${{ matrix.os }}-java${{ matrix.jdk }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + maven-${{ matrix.os }}-java${{ matrix.jdk }}- + maven-${{ matrix.os }}- + + - name: Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: 3.9.6 + + - name: JDK + uses: actions/setup-java@v4.0.0 + with: + java-version: | + ${{ matrix.jdk }} + distribution: 'temurin' + mvn-toolchain-id: | + JavaSE-17 + + - name: Compile windows + if: matrix.os == 'windows-latest' + uses: coactions/setup-xvfb@v1.0.1 + with: + run: mvn clean install --file tyrian-parent/pom.xml -U -Pall + + - name: Compile macos + if: matrix.os == 'macos-latest' + uses: coactions/setup-xvfb@v1.0.1 + with: + run: mvn clean install --file tyrian-parent/pom.xml -U -Pall + + - name: Sonar ubuntu + if: matrix.os == 'ubuntu-latest' + uses: coactions/setup-xvfb@v1.0.1 + with: + run: mvn clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --file tyrian-parent/pom.xml -U -Pall -Dsonar.organization=b3dgs -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.projectKey=b3dgs_tyrian-remake