modify ci script #13
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 pipeline | |
on: | |
# push: | |
# branches: | |
# - "*" | |
pull_request: | |
branches: [ main, master ] | |
workflow_dispatch: | |
inputs: | |
base_url: | |
description: web url input | |
required: false | |
default: 'https://magento.softwaretestingboard.com/' | |
browser: | |
description: web browser to run tests on | |
required: false | |
default: chromium | |
env: | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
greps: ['@LOGIN', '@SIGN_UP', '@SANITY', '@MEN_CATEGORY_SHOP'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
env: | |
BASE_URL: ${{ inputs.base_url }} | |
run: npx playwright test --grep ${{ matrix.greps }} --project=${{ inputs.browser }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report-${{matrix.greps}}-${{ inputs.browser }} | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Deploy Playwright report to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: playwright-report/ | |
status_checks: | |
name: E2E status checks | |
needs: test | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: determine status check conclusion | |
id: status-check-status | |
run: | | |
if [[ "${{ needs.test.result == 'failure' }}" ]]; then | |
echo "status=failure" >> $GITHUB_OUTPUT | |
else | |
echo "status=success" >> $GITHUB_OUTPUT | |
fi | |
- name: set pr status checks | |
uses: teamniteo/[email protected] | |
with: | |
pr_number: ${{ github.event.pull_request.number }} | |
state: ${{ steps.status-check-status.outputs.status }} | |
repository: Romarionijim/Playwright-TypeScript-Mini-Project | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |