102 lines
3.1 KiB
YAML
102 lines
3.1 KiB
YAML
# This workflow runs browser-based tests using Cypress
|
|
# Triggers:
|
|
# - Push/PR with web, Go backend, or browser test changes
|
|
# Note: Browser tests require both frontend and backend
|
|
|
|
name: Browser Tests
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'web/**'
|
|
- '**.go'
|
|
- 'go.mod'
|
|
- 'go.sum'
|
|
- 'test/automated/browser/**'
|
|
- '.github/workflows/browser-testing.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'web/**'
|
|
- '**.go'
|
|
- 'go.mod'
|
|
- 'go.sum'
|
|
- 'test/automated/browser/**'
|
|
- '.github/workflows/browser-testing.yml'
|
|
|
|
jobs:
|
|
cypress-run:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: skip_check
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
with:
|
|
concurrent_skipping: 'same_content_newer'
|
|
|
|
- name: Check out pull request code
|
|
uses: actions/checkout@v6
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch base branch for comparison
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }}.git || true
|
|
git fetch upstream ${{ github.event.pull_request.base.ref }}
|
|
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v6
|
|
if: github.event_name == 'push'
|
|
|
|
- name: Get changed files
|
|
id: changed-files-yaml
|
|
uses: tj-actions/changed-files@v47
|
|
with:
|
|
files_yaml: |
|
|
testable:
|
|
- 'web/**/*.{tsx,ts,jsx,js,css,scss}'
|
|
- 'test/automated/browser/**'
|
|
- '**/*.go'
|
|
- 'go.mod'
|
|
- 'go.sum'
|
|
docs:
|
|
- '**/*.md'
|
|
|
|
- uses: actions/setup-node@v6
|
|
if: steps.changed-files-yaml.outputs.testable_any_changed == 'true'
|
|
with:
|
|
node-version: '24.12.0'
|
|
|
|
- name: Cache node modules
|
|
if: steps.changed-files-yaml.outputs.testable_any_changed == 'true'
|
|
uses: actions/cache@v5
|
|
env:
|
|
cache-name: cache-node-modules-browser-tests
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('test/automated/browser/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
|
|
- uses: actions/setup-go@v6
|
|
if: steps.changed-files-yaml.outputs.testable_any_changed == 'true'
|
|
with:
|
|
go-version: '1.26.1'
|
|
cache: true
|
|
|
|
- name: Install Google Chrome
|
|
if: steps.changed-files-yaml.outputs.testable_any_changed == 'true'
|
|
run: sudo apt-get update && sudo apt-get install google-chrome-stable
|
|
|
|
- name: Run Browser tests
|
|
if: steps.changed-files-yaml.outputs.testable_any_changed == 'true'
|
|
uses: nick-fields/retry@v3
|
|
with:
|
|
timeout_minutes: 20
|
|
max_attempts: 3
|
|
command: cd test/automated/browser && ./run.sh
|