- Notifications
You must be signed in to change notification settings - Fork26
chore: automate roadmap project setup#442
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:CI | |
| on: | |
| pull_request: | |
| branches: | |
| -develop | |
| -main | |
| -master | |
| push: | |
| branches: | |
| -develop | |
| -main | |
| -master | |
| jobs: | |
| build: | |
| runs-on:ubuntu-latest | |
| strategy: | |
| fail-fast:false | |
| matrix: | |
| include: | |
| -name:no-docker | |
| mvn-args:"-Pno-docker" | |
| -name:docker | |
| mvn-args:"" | |
| permissions: | |
| contents:read | |
| issues:write | |
| steps: | |
| -uses:actions/checkout@v5 | |
| -uses:actions/setup-java@v5 | |
| with: | |
| java-version:'21' | |
| distribution:'temurin' | |
| cache:'maven' | |
| -name:Build with Maven (${{ matrix.name }}) | |
| run:./mvnw -q ${{ matrix.mvn-args }} verify |& tee build.log | |
| -name:Show build log | |
| if:failure() | |
| run:| | |
| echo "Build error" | |
| grep '^\[ERROR\]' build.log ||true | |
| echo "Build log tail" | |
| tail -n 200 build.log | |
| -name:Upload surefire reports | |
| if:always() | |
| uses:actions/upload-artifact@v4 | |
| with: | |
| name:surefire-reports | |
| path:'**/target/surefire-reports' | |
| if-no-files-found:ignore | |
| -name:Upload JaCoCo coverage | |
| if:always() | |
| uses:actions/upload-artifact@v4 | |
| with: | |
| name:jacoco-exec | |
| path:'**/target/jacoco.exec' | |
| if-no-files-found:ignore | |
| -name:Upload coverage to Codecov | |
| uses:codecov/codecov-action@v5 | |
| with: | |
| files:'**/target/site/jacoco/jacoco.xml' | |
| token:${{ secrets.CODECOV_TOKEN }} | |
| -name:Upload test results to Codecov | |
| if:${{ !cancelled() }} | |
| uses:codecov/test-results-action@v1 | |
| with: | |
| token:${{ secrets.CODECOV_TOKEN }} | |
| -name:Create issue on failure (${{ matrix.name }}) | |
| if:failure() && github.ref == 'refs/heads/develop' | |
| uses:actions/github-script@v7 | |
| with: | |
| script:| | |
| const fs = require('fs'); | |
| const file = fs.readFileSync('build.log', 'utf8').split('\\n'); | |
| const errors = file.filter(line => line.startsWith('[ERROR]')) | |
| .slice(-20) | |
| .join('\\n'); | |
| const log = file.slice(-50).join('\\n'); | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: `CI (${{ matrix.name }}) failed for ${context.sha.slice(0,7)}`, | |
| body: `Build failed for commit ${context.sha} in workflow run ${context.runId} (matrix: ${{ matrix.name }}).\\n\\nBuild error:\\n\\n\u0060\u0060\u0060\\n${errors}\\n\u0060\u0060\u0060\\n\\nLast lines of build log:\\n\\n\u0060\u0060\u0060\\n${log}\\n\u0060\u0060\u0060`, | |
| labels: ['ci'] | |
| }); |