Split tests by year for github Actions #832
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 | |
| 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: Bring in the gradle wrapper running the build | |
| uses: gradle/wrapper-validation-action@v3 | |
| - 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 |