CI Pipeline #11
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: ci-workflow | |
run-name: CI Pipeline | |
on: [push, workflow_dispatch] | |
jobs: | |
ci-pipeline: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: install | |
uses: ./.github/actions/install | |
- name: apply prettier | |
run: npm run prettier | |
- name: Perfom type check | |
run: npm run typecheck | |
- name: Do unit tests | |
run: npm run test | |
- name: Build the application | |
run: npm run build | |
- name: upload build artefact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'dist/' | |
cd-pipeline: | |
needs: ci-pipeline | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy-step.outputs.page_url }} | |
steps: | |
- name: deploy the artefact | |
id: deploy-step | |
uses: actions/deploy-pages@v4 | |
outputs: | |
deployment-url: ${{ steps.deploy-step.outputs.page_url }} | |
smoke-test: | |
needs: cd-pipeline | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
# <TODO: Execute the following steps with both firefox and chromium; use a matrix strategy> | |
strategy: | |
matrix: | |
browser: ['firefox', 'chromium'] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: install | |
uses: ./.github/actions/install | |
- name: Install Playwright Browsers | |
run: npx playwright install ${{matrix.browser}} #<TODO: Install one of the specific browsers> | |
- name: Run Playwright tests | |
run: npx playwright test --project ${{matrix.browser}} # <TODO: Test with one of the specific browsers> | |
env: | |
PLAYWRIGHT_BASE_URL: ${{needs.cd-pipeline.outputs.deployment-url}} # <TODO: get the GitHub Pages url from the Deployment step of the previous job> | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report-${{matrix.browser}} #<TODO: Upload the artefacts for the specific browser> | |
path: playwright-report/ | |
retention-days: 1 |