tests on demand #10
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: E2E Tests | |
on: | |
push: | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
e2e: | |
name: π E2E | |
strategy: | |
matrix: | |
project: [ 'Mobile Chrome', 'Mobile Safari' ] | |
permissions: | |
packages: read | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: π₯ Checkout | |
run: gh search repos --owner akdasa-studios --match name shlokas --visibility public | while read -r repo _; do gh repo clone "$repo" "$repo"; done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π₯ Switch to PR | |
run: (cd ./akdasa-studios/shlokas-e2e && git checkout ${{ steps.extract_branch.outputs.branch }}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ποΈ Build | |
run: (cd ./akdasa-studios/shlokas-server && ./shlokas.build.sh testing:dev) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π¬ Start Environment | |
run: (cd ./akdasa-studios/shlokas-server && ./shlokas.run.sh testing:dev) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: π§ͺ Testing | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: shlokas-tests-e2e | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
options: | | |
-e CI=1 | |
-e SHLOKAS_URL=http://shlokas | |
-e MAIL_URL=http://mail:1080 | |
-v ${{ github.workspace }}/output:/e2e/output | |
--network shlokas | |
shell: bash | |
run: | | |
npm i | |
npx playwright test --project="${{ matrix.project }}" | |
- name: π [Artifacts] Upload | |
if: ${{ failure() }} | |
uses: actions/[email protected] | |
with: | |
name: e2e-${{ matrix.project }} | |
path: output/ | |
retention-days: 5 |