SetUp Environment Variable #115
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: Playwright Tests | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
schedule: | |
- cron: '0 0 * * *' # 6 AM GMT+6 (0 0 in UTC) | |
permissions: | |
contents: write # Grants write access to the repository | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
- name: Install Playwright browsers | |
run: npx playwright install | |
- name: Set up environment variables | |
run: | | |
echo "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL }}" >> .env | |
echo "PERSONAL_ACCESS_TOKEN=${{secrets.GITHUB_TOKEN}}" >> .env | |
- name: Run Playwright tests for Chromium | |
run: npx playwright test --project=chromium --workers=4 | |
continue-on-error: true # Ensures workflow continues even if tests fail | |
- name: Move HTML Report | |
run: mv playwright-report /tmp/playwright-report | |
continue-on-error: true # Ensures workflow continues even if tests fail | |
- name: Publish HTML report to GitHub Pages (https://nahidthenh.github.io/embedpress-playwright-automation/) | |
if: always() | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
publish_dir: playwright-report/ | |
keep_files: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |