Bump actions/cache from 4.0.2 to 4.1.1 #58
Workflow file for this run
This file contains 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: test-all | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit | |
- 'gh-pages' #github pages do not trigger all tests | |
tags-ignore: | |
- 'v*' #avoid rerun existing commit on release | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
#if: ${{ false }} # disable for now | |
#avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot | |
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/'))) | |
strategy: | |
matrix: | |
scope: [Petstore, Market, GestaoHospital, Eval] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'maven' | |
- name: Launch Petstore | |
if: ${{ matrix.scope == 'Petstore' }} | |
working-directory: ./sut-petstore | |
run: | | |
mvn package -q -DskipTests=true | |
docker build -t swagger-petstore . | |
docker run -d -p 8081:8080 --name swagger-petstore swagger-petstore | |
chmod u+x ../setup/wait-container-ready.sh | |
../setup/wait-container-ready.sh swagger-petstore "public ResponseContext findPetsByCategoryAndStatus" | |
- name: Launch Market | |
if: ${{ matrix.scope == 'Market' }} | |
working-directory: ./sut-market | |
run: | | |
#don't precompile, here, dockerfile does | |
docker build -t market-rest --build-arg module=market-rest . | |
docker build -t market-web --build-arg module=market-web . | |
docker compose -f docker-compose.yaml up -d | |
chmod u+x ../setup/wait-container-ready.sh | |
../setup/wait-container-ready.sh db "ready for start up" | |
../setup/wait-container-ready.sh market-rest "Started RestApplication" | |
- name: Launch GestaoHospital | |
if: ${{ matrix.scope == 'GestaoHospital' }} | |
working-directory: ./sut-gestaoHospital | |
run: | | |
mvn package -q -DskipTests=true | |
docker compose up -d --force-recreate --build | |
chmod u+x ../setup/wait-container-ready.sh | |
../setup/wait-container-ready.sh mongodb "HospitalDB.product_collection" | |
../setup/wait-container-ready.sh gestaohospital "Started GestaohospitalarApplication" | |
- run: docker ps | |
- name: Rules cache | |
id: rules-cache | |
uses: actions/[email protected] | |
with: | |
path: .tdrules-cache | |
key: cache-${{ matrix.scope }}-v1-${{ github.run_id }} | |
restore-keys: cache-${{ matrix.scope }}-v1- | |
- name: Test All SUTs | |
if: ${{ matrix.scope != 'Eval' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn test -pl st-tdg-test -Dtest=**/*${{ matrix.scope }}* -Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
- name: Evaluate Mutation Score | |
if: ${{ matrix.scope == 'Eval' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mvn -pl st-tdg-eval test -Dmaven.test.failure.ignore=true -U --no-transfer-progress | |
mvn -pl st-tdg-eval test-compile org.pitest:pitest-maven:mutationCoverage | |
- if: ${{ always() && matrix.scope == 'Petstore' }} | |
run: docker logs swagger-petstore > st-tdg-test/target/docker-petstore-server.log | |
- if: ${{ always() && matrix.scope == 'Market' }} | |
run: | | |
docker logs market-rest > st-tdg-test/target/docker-market-server.log | |
docker logs db > st-tdg-test/target/docker-market-db.log | |
- if: ${{ always() && matrix.scope == 'GestaoHospital' }} | |
run: | | |
docker logs gestaohospital > st-tdg-test/target/docker-gestaoHospital-server.log | |
docker logs mongodb > st-tdg-test/target/docker-gestaoHospital-db.log | |
- name: Generate report checks | |
if: always() | |
uses: mikepenz/[email protected] | |
with: | |
check_name: "test-result-${{ matrix.scope }}" | |
report_paths: "**/surefire-reports/TEST-*.xml" | |
fail_on_failure: 'true' | |
- name: Publish test report files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-files-${{ matrix.scope }}" | |
path: | | |
**/target/site | |
**/target/surefire-reports | |
**/target/pit-reports | |
**/target/out | |
**/target/*.html | |
**/target/*.log | |
test-report: | |
needs: [test] | |
#if: ${{ false }} # disable for now | |
#avoid publishing to Github pages PRs and dependabot branches | |
if: ${{ always() && github.event_name != 'pull_request' && !contains('/head/refs/dependabot/', github.ref) && !contains('/head/refs/dashgit/combined/', github.ref) }} | |
runs-on: ubuntu-latest | |
# Configuration to deploy at github pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# Downloads all artifacts with test report files | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
path: . | |
- run: ls -la | |
# Generates and uploads the html reports and the individual surefire reports for further reference | |
# Includes the options to add links to Visual Assert diff files | |
- name: Aggregated junit html report | |
if: always() | |
uses: javiertuya/[email protected] | |
with: | |
surefire-files: "**/target/surefire-reports/TEST-*.xml" | |
report-dir: reports | |
report-title: "Test Report: ALL - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}" | |
diff-links-enabled: true | |
#diff-links-prefix: "target/" | |
diff-links-reports: "reports/junit-*/**/*.html" | |
#diff-links-files: "/**/target/*.html" | |
- name: Copy pit reports | |
run: cp -r test-report-files-Eval/st-tdg-eval/target/pit-reports reports/pit-reports | |
- name: Index file to html reports | |
if: always() | |
run: | | |
echo "<html><head><title>Latest Test Reports</title></head><body>" > index.html | |
echo "<h2>Latest Test Reports - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}</h2>" >> index.html | |
echo "<p><a href=\"reports/junit-noframes/junit-noframes.html\">JUnit test report - Single page</a></p>" >> index.html | |
echo "<p><a href=\"reports/junit-frames/index.html\">JUnit test report - Multiple page with frames</a></p>" >> index.html | |
echo "<p><a href=\"reports/pit-reports/index.html\">PIT test report</a></p>" >> index.html | |
echo "</body></html>" >> index.html | |
ls -la reports | |
- name: Publish test report files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-report-ALL" | |
path: | | |
index.html | |
reports | |
**/target/surefire-reports | |
**/target/out | |
**/target/*.html | |
**/target/*.log | |
# Deploy to GitHub Pages | |
# Some files (e.g. junit reports) have 600 permissions. | |
# As of [email protected], permissions must be set explicitly | |
# to 0755 (as indicated in warnings produced by v1.0.8) | |
- name: Fix permissions to actions/[email protected] | |
if: always() | |
run: sudo chmod -c -R 0755 reports | |
- name: Upload artifact | |
if: always() | |
uses: actions/[email protected] | |
with: | |
path: "." | |
- name: Deploy to GitHub Pages | |
if: always() | |
id: deployment | |
uses: actions/[email protected] |