chore(e2e): run e2e tests on PRs on ephemeral datasets #14392
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: Unit tests | |
on: | |
# Build on pushes branches that have a PR (including drafts) | |
pull_request: | |
# Build on commits pushed to branches without a PR if it's in the allowlist | |
push: | |
branches: [next] | |
jobs: | |
install: | |
timeout-minutes: 60 | |
name: Install (${{ matrix.os }} / node ${{ matrix.node }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
node: [18, 20] | |
experimental: [false] | |
# include: | |
# - os: windows-latest | |
# node: 16 | |
# experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-modules-${{ env.cache-name }}- | |
${{ runner.os }}-modules- | |
${{ runner.os }}- | |
- name: Cache build | |
id: cache-build | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-build | |
with: | |
path: './*' | |
# Unique key for a workflow run. Should be invalidated in the next run | |
key: ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Install project dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Build CLI | |
run: yarn build:cli # Needed for CLI tests | |
test: | |
timeout-minutes: 60 | |
name: Test (${{ matrix.os }} / node ${{ matrix.node }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
continue-on-error: ${{ matrix.experimental }} | |
needs: [install] | |
strategy: | |
# we want to know if a test fails on a specific node version | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
node: [18, 20] | |
experimental: [false] | |
shardIndex: [1, 2, 3, 4] | |
shardTotal: [4] | |
# include: | |
# - os: windows-latest | |
# node: 16 | |
# experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Restore node_modules cache | |
uses: actions/cache/restore@v3 | |
id: restore-node-modules | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-modules-${{ env.cache-name }}- | |
${{ runner.os }}-modules- | |
${{ runner.os }}- | |
- name: Restore build cache | |
uses: actions/cache/restore@v3 | |
id: restore-build | |
env: | |
cache-name: cache-build | |
with: | |
path: ./* | |
key: ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Install project dependencies | |
if: steps.restore-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Test | |
id: test | |
run: | | |
node -v | |
npm -v | |
yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} | |
env: | |
SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }} | |
GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }} | |
cleanup: | |
timeout-minutes: 60 | |
name: Cleanup (${{ matrix.os }} / node ${{ matrix.node }}) | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
needs: [test] | |
strategy: | |
# we want to know if a test fails on a specific node version | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
node: [18, 20] | |
experimental: [false] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
# Delete the cache so it is only used once | |
- name: Delete Cache | |
run: gh cache delete ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}-${{ github.run_attempt }} | |
env: | |
cache-name: cache-build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |