build(deps): bump @actions/core from 1.10.1 to 1.11.1 #133
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: Stryker mutation tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
stryker-js: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: npm install | |
- name: Run StrykerJS | |
continue-on-error: true | |
id: stryker | |
run: | | |
npm run stryker > out | |
- name: Print output | |
continue-on-error: true | |
run: cat out | |
- name: Save stryker JS log | |
if: failure() | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: stryker.log | |
path: stryker.log | |
- name: Extract stryker score | |
run: | | |
grep "All files" out > line | |
awk '{print $4}' line > fullscore | |
awk '{split($0,a,"."); print a[1]}' fullscore > score | |
echo "stryker-score=$(tr -s '\n' < score)" >> "$GITHUB_ENV" | |
- name: Create the Badge for Deploy Rate | |
uses: Schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.GIST_AUTH_TOKEN }} | |
gistID: 9ce1ad7d8e9db99796e782b244eefa4a | |
filename: dora-stryker.json | |
label: Stryker score | |
message: ${{ env.stryker-score }}% | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.stryker-score }} | |
- name: Upload results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mutation-report | |
retention-days: 1 | |
path: reports/mutation/ | |
overwrite: true | |
- name: Parse the json output and generate markdown | |
continue-on-error: true | |
id: extract_from_json | |
run: | | |
python ./script/generate_md_report.py reports/mutation/mutation.json stryker-report.md https://stenjo.github.io/devops-metrics-action/reports/pr-${{ github.event.pull_request.number }}/mutation-report.html | |
shell: /usr/bin/bash -e {0} | |
- name: Add formatted table to PR comment | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-path: stryker-report.md | |
update-only: false | |
refresh-message-position: true | |
allow-repeats: false | |
message-id: 'add-pr-stryker-comment-${{ github.event.pull_request.number }}' | |
- name: Deploy HTML Report to GitHub Pages | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "github-actions@github.com" | |
# Create a new branch for GitHub Pages if it doesn't exist | |
git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages | |
git checkout gh-pages | |
# Create a directory for this PR and move the report there | |
mkdir -p reports/pr-${{env.PR_NUMBER}} | |
mv reports/mutation/mutation.html reports/pr-${{env.PR_NUMBER}}/mutation-report.html | |
# Commit and push the changes | |
git add -f reports/pr-${{env.PR_NUMBER}}/mutation-report.html | |
git commit -m "Deploy mutation report for PR #${{env.PR_NUMBER}}" | |
git push origin gh-pages | |
- name: Output the URL | |
run: | | |
echo "Report available at: https://stenjo.github.io/devops-metrics-action/reports/pr-${{ github.event.pull_request.number }}/mutation-report.html" |