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
This commit is contained in:
Raven Szewczyk 2024-02-09 17:17:40 +00:00 committed by GitHub
parent c65ccf0550
commit 87bfdc7ab1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 6 deletions

View File

@ -26,6 +26,10 @@ jobs:
build-and-test: build-and-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - name: Checkout mod repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -38,13 +42,14 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Validate gradle wrapper checksum - 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 uses: actions/setup-java@v4
with: with:
java-version: | java-version: |
8 8
21
17 17
distribution: 'zulu' distribution: 'zulu'
cache: gradle cache: gradle
@ -61,13 +66,22 @@ jobs:
- name: Attach compilation artifacts - name: Attach compilation artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: build-libs name: ${{ github.repository_id }}-build-libs
path: build/libs/ path: build/libs/
retention-days: 31 retention-days: 31
- name: Run post-build checks - name: Run post-build checks
id: build_mod 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 - 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 }} if: ${{ failure() && steps.build_mod.conclusion == 'failure' && github.event_name == 'pull_request' && !github.event.pull_request.draft }}

View File

@ -36,13 +36,14 @@ jobs:
fetch-depth: 32 fetch-depth: 32
- name: Validate gradle wrapper checksum - 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 uses: actions/setup-java@v4
with: with:
java-version: | java-version: |
8 8
21
17 17
distribution: 'zulu' distribution: 'zulu'
cache: gradle cache: gradle