Example PR #46
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-ubuntu: | |
timeout-minutes: 180 | |
runs-on: ubuntu-latest | |
name: Build, Test, Report in Ubuntu | |
steps: | |
# To use this repository's private action, | |
# you must check out the repository | |
- uses: actions/checkout@v4 | |
- 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: 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/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@v4 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages # branch name | |
path: gh-pages-dir # checkout path | |
- name: Local Allure Report Action | |
uses: ./ # Uses an action in the root directory | |
if: always() | |
continue-on-error: true | |
id: self_test # used in comment to PR | |
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: Git Commit and Push Action | |
uses: mgrybyk/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.self_test.outputs.report_url }} | |
continue-on-error: true | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
Ubuntu run: | |
${{ steps.self_test.outputs.test_result_icon }} [Allure Report](${{ steps.self_test.outputs.report_url }}) | ${{ steps.self_test.outputs.test_result_passed }}/${{ steps.self_test.outputs.test_result_failed }}/${{ steps.self_test.outputs.test_result_total }} | [History](${{ steps.self_test.outputs.report_history_url }}) | |
comment_tag: allure_self_test_ubuntu | |
mode: recreate | |
test-win: | |
timeout-minutes: 180 | |
runs-on: windows-latest | |
name: Build, Test, Report in Windows | |
steps: | |
# To use this repository's private action, | |
# you must check out the repository | |
- uses: actions/checkout@v4 | |
- run: npm ci --no-fund --no-audit --no-progress | |
- run: npm run build | |
- run: npx playwright install --with-deps chromium | |
- name: Run e2e and ignore snapshots update | |
run: npm run e2e -- --update-snapshots | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages # branch name | |
path: gh-pages-dir # checkout path | |
- name: Local Allure Report Action | |
uses: ./ # Uses an action in the root directory | |
if: always() | |
continue-on-error: true | |
id: self_test # used in comment to PR | |
with: | |
report_id: 'self-test' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'allure-results' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
max_reports: 0 | |
- name: Git Commit and Push Action | |
uses: mgrybyk/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.self_test.outputs.report_url }} | |
continue-on-error: true | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
Windows run: | |
${{ steps.self_test.outputs.test_result_icon }} [Allure Report](${{ steps.self_test.outputs.report_url }}) | ${{ steps.self_test.outputs.test_result_passed }}/${{ steps.self_test.outputs.test_result_failed }}/${{ steps.self_test.outputs.test_result_total }} | [History](${{ steps.self_test.outputs.report_history_url }}) | |
comment_tag: allure_self_test_windows | |
mode: recreate | |
test-mac: | |
timeout-minutes: 180 | |
runs-on: macos-latest | |
name: Build, Test, Report in macOS | |
needs: test-ubuntu | |
steps: | |
# To use this repository's private action, | |
# you must check out the repository | |
- uses: actions/checkout@v4 | |
- run: npm ci --no-fund --no-audit --no-progress | |
- run: npm run build | |
- run: npx playwright install --with-deps chromium | |
- name: Run e2e and ignore snapshots update | |
run: npm run e2e -- --update-snapshots | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages # branch name | |
path: gh-pages-dir # checkout path | |
- name: Local Allure Report Action | |
uses: ./ # Uses an action in the root directory | |
if: always() | |
continue-on-error: true | |
id: self_test # used in comment to PR | |
with: | |
report_id: 'self-test' | |
gh_pages: 'gh-pages-dir' | |
report_dir: 'allure-results' | |
list_dirs: ${{ github.ref == 'refs/heads/main' }} | |
max_reports: 0 | |
- name: Git Commit and Push Action | |
uses: mgrybyk/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.self_test.outputs.report_url }} | |
continue-on-error: true | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
macOS run: | |
${{ steps.self_test.outputs.test_result_icon }} [Allure Report](${{ steps.self_test.outputs.report_url }}) | ${{ steps.self_test.outputs.test_result_passed }}/${{ steps.self_test.outputs.test_result_failed }}/${{ steps.self_test.outputs.test_result_total }} | [History](${{ steps.self_test.outputs.report_history_url }}) | |
comment_tag: allure_self_test_macos | |
mode: recreate |