refactor: restructure to tests and CI workflow to reduce CI time #5151
Workflow file for this run
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: Browser tests | |
concurrency: | |
# If PR, cancel prev commits. head_ref = source branch name on pull_request, null if push | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
# We intentionally don't run push on feature branches. See PR for rational. | |
branches: [unstable, stable] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
tests-main: | |
name: Tests | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [20] | |
steps: | |
# <common-build> - Uses YAML anchors in the future | |
- uses: actions/checkout@v3 | |
- uses: browser-actions/setup-firefox@latest | |
with: | |
firefox-version: "latest" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{matrix.node}} | |
check-latest: true | |
cache: yarn | |
- name: Node.js version | |
id: node | |
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT | |
- name: Restore dependencies | |
uses: actions/cache@master | |
id: cache-deps | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: ${{ runner.os }}-${{ steps.node.outputs.v8CppApiVersion }}-${{ hashFiles('**/yarn.lock', '**/package.json') }} | |
- name: Install & build | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile && yarn build | |
- name: Build | |
run: yarn build | |
if: steps.cache-deps.outputs.cache-hit == 'true' | |
# </common-build> | |
# Misc sanity checks | |
- name: Test root binary exists | |
run: ./lodestar --version | |
- name: Reject yarn.lock changes | |
run: .github/workflows/scripts/reject_yarn_lock_changes.sh | |
# Run only on forks | |
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} | |
- name: Browser tests | |
run: | | |
export DISPLAY=':99.0' | |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | |
yarn test:browsers |