diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b21b93..11f1bac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,36 +1,32 @@ name: Test on: + workflow_run: + workflows: [ "Spotless" ] + types: [ completed ] push: branches: [ "master" ] - pull_request: - branches: [ "master" ] permissions: contents: read +concurrency: + group: test-${{ github.event.workflow_run.head_branch || github.ref }} + cancel-in-progress: true + jobs: test: - name: Test (${{ matrix.module }}) + name: Test runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - module: - - patcher - - common - - bytecodec - - network - - protocols.login - - protocols.game - - server.login - - server.game - - codegen + if: ${{ github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive + # workflow_run starts from the default branch, so check out the branch Spotless just ran + # on. Its tip, not head_sha, since Spotless pushes its formatting as a new commit. + ref: ${{ github.event.workflow_run.head_branch || github.sha }} - name: Set up JDK 25 uses: actions/setup-java@v4 @@ -41,5 +37,5 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@v4 - - name: Run tests - run: ./gradlew :${{ matrix.module }}:test + - name: Run checks + run: ./gradlew check