element-portable/.github/workflows/end-to-end-tests-netlify.yaml
Michael Telatynski 90342f1b82
Initial work towards benchmarking bundle size over time
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-11-26 17:21:24 +00:00

103 lines
3.9 KiB
YAML

# Triggers after the playwright tests have finished,
# taking the artifact and uploading it to Netlify for easier viewing
name: Upload End to End Test report to Netlify
on:
workflow_run:
workflows: ["End to End Tests"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.run_id }}
cancel-in-progress: ${{ github.event.workflow_run.event == 'pull_request' }}
permissions: {}
jobs:
report:
if: github.event.workflow_run.conclusion != 'cancelled'
name: Report results
runs-on: ubuntu-24.04
environment: Netlify
permissions:
statuses: write
deployments: write
actions: read
contents: write
steps:
- name: Download HTML report
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: html-report
path: playwright-report
- name: 📤 Deploy to Netlify
uses: matrix-org/netlify-pr-preview@v3
with:
path: playwright-report
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
branch: ${{ github.event.workflow_run.head_branch }}
revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
site_id: ${{ vars.NETLIFY_SITE_ID }}
desc: Playwright Report
deployment_env: EndToEndTests
prefix: "e2e-"
benchmark:
if: github.event.workflow_run.conclusion != 'cancelled'
name: Benchmarks
runs-on: ubuntu-24.04
environment: Netlify
permissions:
statuses: write
deployments: write
actions: read
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version-file: package.json
- name: Install Deps
run: "yarn install --frozen-lockfile"
- name: Download webapp
uses: actions/download-artifact@v4
with:
name: webapp
path: webapp
- name: Generate benchmark result
run: ./scripts/benchmark-bundle.ts > benchmarks.json
- name: Evaluate benchmark result
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1
with:
tool: "customSmallerIsBetter"
output-file-path: "benchmarks.json"
gh-pages-branch: benchmarks
auto-push: false
- name: Push latest develop results
if: github.event.workflow_run.head_branch == 'develop' && github.event.workflow_run.head_repository.owner.login == 'element-hq'
run: git push origin benchmarks
- name: 📤 Deploy to Netlify
uses: matrix-org/netlify-pr-preview@v3
if: github.event.workflow_run.head_branch == 'develop' && github.event.workflow_run.head_repository.owner.login == 'element-hq'
with:
path: .
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
branch: ${{ github.event.workflow_run.head_branch }}
revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
site_id: ${{ vars.NETLIFY_SITE_ID }}
desc: Bundle Size Benchmark
deployment_env: BundleSize
prefix: "benchmark-"