Skip to content

Removing Collection frontend components (#1245) #530

Removing Collection frontend components (#1245)

Removing Collection frontend components (#1245) #530

Workflow file for this run

# Workflow for running E2E tests for PRs and pushes to the main branch for
# napari hub frontend code.
name: E2E Tests
on:
push:
branches:
- main
paths:
- .github/workflows/e2e-tests.yml
- 'frontend/**'
pull_request:
branches:
- '**'
paths:
- .github/workflows/e2e-tests.yml
- 'frontend/**'
defaults:
run:
working-directory: frontend/
env:
FIXTURES_CACHE_KEY: e2e-fixtures-${{ github.run_id }}-${{ github.run_attempt }}
jobs:
e2e-setup:
name: E2E Setup
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.5.x
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# cache both yarn-lock and node_modules
- name: Setup Yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# --prefer-offline forces yarn to use cache if available
- name: Install dependencies with yarn
# if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('**/yarn.lock') }}
- name: Install playwright
# if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Setting up local build cache
uses: actions/cache@v3
with:
path: frontend/.next
key: local-build-${{ hashFiles('**/next.config.js') }}-${{ hashFiles('frontend/src') }}-${{ hashFiles('**/yarn.lock') }}
- name: Build frontend for local testing
# if: steps.prod-build-cache.outputs.cache-hit != 'true'
run: yarn build
- name: Setting up fixture cache
uses: actions/cache@v3
with:
path: frontend/e2e/fixtures
key: ${{ env.FIXTURES_CACHE_KEY }}
- name: Fetch fixture data
env:
ENV: local
run: node scripts/fetch-e2e-fixtures
e2e:
name: E2E tests ${{ matrix.browser }} ${{ matrix.shardCurrent }} / ${{ matrix.shardTotal }}
runs-on: ubuntu-latest
needs: e2e-setup
concurrency:
group: ${{ github.ref }}-${{ matrix.browser }}-${{ matrix.shardCurrent }}-${{ matrix.shardTotal }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
# browser: [chrome, firefox, safari]
browser: [chrome]
shardCurrent: [1, 2, 3, 4, 5]
shardTotal: [5]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.5.x
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# cache both yarn-lock and node_modules
- name: Load yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Load cached playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('**/yarn.lock') }}
- name: Load cached local build
uses: actions/cache@v3
with:
path: frontend/.next
key: local-build-${{ hashFiles('**/next.config.js') }}-${{ hashFiles('frontend/src') }}-${{ hashFiles('**/yarn.lock') }}
- name: Start server on port 8080
run: yarn start &
env:
API_URL: https://api.staging.napari-hub.org
E2E: true
- name: Load fixtures cache
uses: actions/cache@v3
with:
path: frontend/e2e/fixtures
key: ${{ env.FIXTURES_CACHE_KEY }}
- name: Run E2E Tests
env:
BROWSER: ${{ matrix.browser }}
ENV: local
run: yarn e2e:ci --shard ${{ matrix.shardCurrent }}/${{ matrix.shardTotal }}
- name: Upload artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3.1.1
with:
name: e2e-artifacts
path: frontend/e2e/report
retention-days: 1