Fix cleanup and bump deps #110
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 Action | |
on: | |
pull_request: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. | |
contents: write | |
# required by https://github.com/thollander/actions-comment-pull-request | |
pull-requests: write | |
# Allow only one job per PR or branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true # cancel jobs in progress | |
jobs: | |
test: | |
timeout-minutes: 180 | |
runs-on: ubuntu-latest | |
name: Build, Test, Report | |
steps: | |
# To use this repository's private action, | |
# you must check out the repository | |
- uses: actions/checkout@v3 | |
- run: npm ci --no-fund --no-audit --no-progress | |
- run: npm run checks | |
- run: npm run build | |
- name: Make sure dist was commited before push | |
run: | | |
git status -s -uno | |
[ $(git status -s -uno | wc -l | bc ) != "0" ] && exit 1 || echo OK | |
- run: npx playwright install --with-deps chromium | |
- name: Lighthouse | |
run: npm run lighthouse | |
- name: Update screenshots in PRs | |
if: github.event_name == 'pull_request' | |
run: npm run e2e -- --update-snapshots | |
- name: git commit and push | |
if: github.event_name == 'pull_request' | |
uses: mgrybyk-org/git-commit-pull-push-action@v1 | |
with: | |
branch: ${{ github.head_ref }} | |
commit_message: Update screenshots | |
add_args: 'tests/**/*.png' | |
- name: Do not update screenshots if not PR | |
if: github.event_name != 'pull_request' | |
run: npm run e2e | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages # branch name | |
path: gh-pages-dir # checkout path | |
- name: Allure Report Action | |
uses: mgrybyk-org/allure-report-branch-js-action@v1 | |
if: always() | |
continue-on-error: true | |
id: allure | |
with: | |
report_id: 'self-test' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'allure-results' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
branch_cleanup_enabled: ${{ github.ref == 'refs/heads/main' }} | |
max_reports: 9 | |
- name: generate csv report data | |
if: ${{ always() && steps.allure.outputs.report_url }} | |
run: | | |
mkdir -p test-results | |
outFile=test-results/Allure_Trend.csv | |
echo Passed,Failed,Total > $outFile | |
echo ${{ steps.allure.outputs.test_result_passed }},${{ steps.allure.outputs.test_result_failed }},${{ steps.allure.outputs.test_result_total }} >> $outFile | |
- name: Local HTML Report | |
if: always() | |
uses: ./ # Uses an action in the root directory | |
id: html-1 | |
with: | |
report_id: 'Lighthouse Report' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'lighthouse-html' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
branch_cleanup_enabled: ${{ github.ref == 'refs/heads/main' }} | |
max_reports: 9 | |
- name: Local Chart Report (single) | |
if: ${{ always() && steps.allure.outputs.report_url }} | |
uses: ./ | |
id: chart-2 | |
with: | |
report_id: 'Allure Trend Report' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'test-results/Allure_Trend.csv' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
report_type: csv | |
max_reports: 9 | |
- name: Local Chart Report (multiple) | |
if: ${{ always() && steps.allure.outputs.report_url }} | |
uses: ./ | |
id: chart-3 | |
with: | |
report_id: 'Lighthouse Trend Report' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'lighthouse-csv' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
report_type: csv | |
max_reports: 9 | |
- name: Git Commit and Push Action | |
uses: mgrybyk-org/git-commit-pull-push-action@v1 | |
if: always() | |
with: | |
repository: gh-pages-dir | |
branch: gh-pages | |
pull_args: --rebase -X ours | |
- name: Comment PR with Allure Report link | |
if: ${{ always() && github.event_name == 'pull_request' && (steps.allure.outputs.report_url || steps.html-1.outputs.report_url || steps.chart-2.outputs.report_url) }} | |
continue-on-error: true | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
[HTML Report](${{ steps.html-1.outputs.report_url }}) | [Allure Trend (single csv)](${{ steps.chart-2.outputs.report_url }}) | |
[Lighthouse Trend Report (mutliple csv)](${{ steps.chart-3.outputs.report_url }}) | |
${{ steps.allure.outputs.test_result_icon }} [Allure Report](${{ steps.allure.outputs.report_url }}) | ${{ steps.allure.outputs.test_result_passed }}/${{ steps.allure.outputs.test_result_failed }}/${{ steps.allure.outputs.test_result_total }} | [History](${{ steps.allure.outputs.report_history_url }}) | |
comment_tag: test_reports | |
mode: recreate |