diff --git a/.github/workflows/tests-snapshots.yml b/.github/workflows/tests-snapshots.yml new file mode 100644 index 0000000..d504734 --- /dev/null +++ b/.github/workflows/tests-snapshots.yml @@ -0,0 +1,31 @@ +name: Update Snapshots + +on: + workflow_dispatch: + +jobs: + update_snapshots: + runs-on: ubuntu-latest + steps: + - name: Fail if branch is main + if: ${{ github.ref == 'refs/heads/main' }} + run: | + echo "This workflow should not be triggered with workflow_dispatch on main" + exit 1 + + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare + uses: ./.github/actions/prepare + + - name: Run tests and update Snapshots + run: npm run test:ci:snapshots + + - name: Commit Playwright updated snapshots + uses: EndBug/add-and-commit@v9 + if: ${{ github.ref != 'refs/heads/main' }} + with: + add: tests + default_author: github_actions + message: "🤖 update snapshots" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1667d96 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests + +on: + pull_request: + workflow_dispatch: + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Prepare + uses: ./.github/actions/prepare + + - name: Run tests + run: npm run test:ci + + - name: Upload Playwright report on failure + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 3 + + - name: Upload Playwright results on failure + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: test-results + path: test-results/ + retention-days: 3 + + may-merge: + needs: ["tests"] + runs-on: ubuntu-latest + steps: + - name: Cleared for merging + run: echo OK