Split tests by year for github Actions #836
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Main AoC code | |
| uses: actions/checkout@v6 | |
| - name: Bring In Gradle Wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle jacocoTestReport | |
| run: ./gradlew --no-daemon build -x test | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: build/ | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| matrix: | |
| total_shard_count: [11] | |
| shard_number: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025'] | |
| steps: | |
| - name: Checkout Main AoC code | |
| uses: actions/checkout@v6 | |
| - name: Checkout The AoC Input Files | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.AOC_INPUT }} | |
| repository: peckb1/advent-of-code-input | |
| path: advent-of-code-input | |
| ref: main | |
| - name: Download Build | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: build-output | |
| path: . | |
| - name: Bring In Gradle Wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle jacocoTestReport for year ${{ matrix.shard_number }} | |
| run: ./gradlew --no-daemon build -Pyear=${{ matrix.shard_number }} | |
| - name: Publish Unit Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() | |
| with: | |
| files: build/test-results/**/*.xml | |
| - name: Add coverage to PR | |
| id: jacoco | |
| uses: madrapps/[email protected] | |
| with: | |
| paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 40 | |
| min-coverage-changed-files: 60 |