From 87bfdc7ab1d07d7b7ae533aaf03d88f1b14b0c72 Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Fri, 9 Feb 2024 17:17:40 +0000 Subject: [PATCH] Support OpenGL in gradle tests (#36) * Add Java 21 to pre-installed versions list * Update gradle wrapper validation action * Wrap test running in xvfb-run to provide a virtual framebuffer * Upload test reports too * Add xrandr --- .github/workflows/build-and-test.yml | 22 ++++++++++++++++++---- .github/workflows/release-tags.yml | 5 +++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d0049fe..f42109f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -26,6 +26,10 @@ jobs: build-and-test: runs-on: ubuntu-latest steps: + - name: Install Ubuntu dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y mesa-utils xvfb x11-xserver-utils - name: Checkout mod repo uses: actions/checkout@v4 with: @@ -38,13 +42,14 @@ jobs: fetch-depth: 0 - name: Validate gradle wrapper checksum - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - - name: Set up JDK 8 and 17 + - name: Set up JDK versions uses: actions/setup-java@v4 with: java-version: | 8 + 21 17 distribution: 'zulu' cache: gradle @@ -61,13 +66,22 @@ jobs: - name: Attach compilation artifacts uses: actions/upload-artifact@v4 with: - name: build-libs + name: ${{ github.repository_id }}-build-libs path: build/libs/ retention-days: 31 - name: Run post-build checks id: build_mod - run: ./gradlew --build-cache --info --stacktrace build + run: xvfb-run --server-args="-screen 0 1366x768x24" ./gradlew --build-cache --info --stacktrace build + + - name: Attach gradle reports + if: failure() && steps.build_mod.conclusion == 'failure' + uses: actions/upload-artifact@v4 + continue-on-error: true + with: + name: ${{ github.repository_id }}-reports + path: build/reports/ + retention-days: 31 - name: Attempt to make a PR fixing spotless errors if: ${{ failure() && steps.build_mod.conclusion == 'failure' && github.event_name == 'pull_request' && !github.event.pull_request.draft }} diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index a989420..9450536 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -36,13 +36,14 @@ jobs: fetch-depth: 32 - name: Validate gradle wrapper checksum - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v2 - - name: Set up JDK 8 and 17 + - name: Set up JDK versions uses: actions/setup-java@v4 with: java-version: | 8 + 21 17 distribution: 'zulu' cache: gradle