From 2d58b5d41185af6f3a6ab9d16c32022a1bcc0789 Mon Sep 17 00:00:00 2001 From: "Travis H." <84813179+travispeloton@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:56:05 -0700 Subject: [PATCH] USP-3757 Test and lint PR checks (#3) --- .github/workflows/test.yml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..345a8f4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +on: + pull_request: + branches: [ main ] + +jobs: + unit-test: + runs-on: [ arss-runner-dind ] + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'corretto' + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Test with Gradle + run: ./gradlew test + - name: Cleanup Gradle Cache + # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. + # Restoring these files from a GitHub Actions cache might cause problems for future builds. + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + linter: + runs-on: [ arss-runner-dind ] + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'corretto' + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Test with Gradle + run: ./gradlew ktlintCheck + - name: Cleanup Gradle Cache + # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. + # Restoring these files from a GitHub Actions cache might cause problems for future builds. + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties