Skip to content

Scheduled Test and Publish #415

Scheduled Test and Publish

Scheduled Test and Publish #415

Workflow file for this run

name: Scheduled Test and Publish
on:
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
jobs:
prep:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get history file from gh-pages branch
continue-on-error: true
run: |
git pull
git checkout gh-pages
git pull
- name: Setup upload artifact (existing report)
uses: actions/upload-artifact@master
with:
name: allure-report
path: allure-report
retention-days: 20
- name: Setup upload artifact (new report) (What is this used for?)
uses: actions/upload-artifact@master
with:
name: new-allure-report
path: allure-report
retention-days: 20
- name: Back to main branch
run: git checkout main
run_tests:
needs: prep
name: 'Run Guardian e2e Tests'
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Install Node dependencies
run: |
npm install
npm i -D allure-playwright
npm i -D allure-commandline
- name: Install Playwright Browsers
run: |
npm install -D @playwright/test --with-deps
npx playwright install
- name: Run tests
id: run_tests
continue-on-error: true
run: npx playwright test --reporter=line,allure-playwright
- name: Report failure to Sentry
if: steps.run_tests.outcome == 'failure'
run: npm run sentry:alert
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Get existing artifact
uses: actions/download-artifact@v2
continue-on-error: true
with:
name: allure-report
path: allure-report
- name: Move history to results
continue-on-error: true
run: |
ls allure-report/history
ls allure-results
rm -rf allure-results/history
echo "============================================================================"
mv allure-report/history allure-results
ls allure-results
ls allure-report/history
- name: Generate allure report
run: npm run report:build
- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: allure-report
retention-days: 20
- name: Push report to gh branch
run: |
git switch -c gh-pages
git config --global user.email "rokafor@mozilla.com"
git config --global user.name "Github Actions"
git add allure-report -f
git commit -m "Automated Update"
git push -u origin gh-pages -f
publish:
name: Publish
needs: run_tests
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1