WIP: POC: Replace CircleCI with GitHub Actions #14
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
on: | |
pull_request: | |
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review] | |
name: All Checks | |
jobs: | |
compile: | |
name: Prepare dependencies and compile | |
runs-on: ubuntu-latest | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Cache dependencies | |
id: dependency-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
restore-keys: | | |
yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}- | |
yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}- | |
yarn-v1-${{ runner.os }}- | |
- name: Install Dependencies | |
run: | | |
yarn task --task install --start-from install --debug | |
git diff --exit-code | |
# TODO: See if playwright container is faster than this | |
# - name: Install Playwright Browsers | |
# working-directory: code | |
# run: npx playwright ${{ steps.dependency-cache.outputs.cache-hit && 'install-deps' || 'install --with-deps' }} | |
- name: Compile | |
run: | | |
yarn task --task compile --start-from=compile --no-link --debug | |
git diff --exit-code | |
# - name: Cache Verdacio | |
# uses: actions/cache@v3 | |
# with: | |
# path: .verdaccio-cache | |
# key: ${{ runner.os }}-verdaccio-v1 | |
- name: Publish to Verdaccio | |
working-directory: code | |
run: yarn local-registry --publish | |
create-sandboxes: | |
name: Create Sandbox | |
runs-on: ubuntu-latest | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
needs: compile | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Compile | |
run: | | |
yarn task --task compile --start-from=compile --no-link --debug | |
git diff --exit-code | |
- name: Restore Verdaccio cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: .verdaccio-cache | |
key: ${{ runner.os }}-verdaccio-v1 | |
fail-on-cache-miss: true | |
- name: Create sandbox ${{ matrix.template }} | |
run: yarn task --task sandbox --template ${{ matrix.template }} --no-link --start-from never --junit | |
- name: Save sandbox ${{ matrix.template }} | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
sandbox | |
~/.yarn/berry/cache | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
build-sandboxes: | |
name: Build Sandbox | |
runs-on: ubuntu-latest | |
needs: create-sandboxes | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Restore sandbox ${{ matrix.template }} | |
uses: actions/cache/restore@v3 | |
with: | |
path: sandbox | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Build sandbox ${{ matrix.template }} | |
working-directory: scripts | |
run: | | |
yarn ts-node ./event-log-collector.ts & | |
yarn task --task build --template ${{ matrix.template }} --no-link --start-from build --junit | |
- name: Verify telemetry | |
working-directory: scripts | |
run: yarn ts-node ./event-log-checker build ${{ matrix.template }} | |
- name: Save built sandbox ${{ matrix.template }} | |
uses: actions/cache/save@v3 | |
with: | |
path: sandbox/*/storybook-static | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
test-runner-production: | |
name: Test Runner Production | |
runs-on: ubuntu-latest | |
needs: build-sandboxes | |
continue-on-error: true | |
container: mcr.microsoft.com/playwright:v1.31.1-focal | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Restore sandbox ${{ matrix.template }} | |
uses: actions/cache/restore@v3 | |
with: | |
path: sandbox | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Run Test Runner for production built ${{ matrix.template }} | |
run: yarn task --task test-runner --template ${{ matrix.template }} --no-link --start-from never --junit | |
test-runner-development: | |
name: Test Runner Development | |
runs-on: ubuntu-latest | |
needs: create-sandboxes | |
continue-on-error: true | |
container: mcr.microsoft.com/playwright:v1.31.1-focal | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Restore sandbox ${{ matrix.template }} | |
uses: actions/cache/restore@v3 | |
with: | |
path: sandbox | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Run Test Runner for development ${{ matrix.template }} | |
run: yarn task --task test-runner-dev --template ${{ matrix.template }} --no-link --start-from never --junit | |
e2e-production: | |
name: E2E Production | |
runs-on: ubuntu-latest | |
needs: build-sandboxes | |
continue-on-error: true | |
container: mcr.microsoft.com/playwright:v1.31.1-focal | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Restore sandbox ${{ matrix.template }} | |
uses: actions/cache/restore@v3 | |
with: | |
path: sandbox | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Run E2E tests for production built ${{ matrix.template }} | |
run: yarn task --task e2e-tests --template ${{ matrix.template }} --no-link --start-from never --junit | |
e2e-development: | |
name: E2E Development | |
runs-on: ubuntu-latest | |
needs: create-sandboxes | |
continue-on-error: true | |
container: mcr.microsoft.com/playwright:v1.31.1-focal | |
strategy: | |
fail-fast: false | |
matrix: | |
template: [react-vite/default-ts, angular-cli/default-ts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Restore dependencies | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
code/node_modules | |
scripts/node_modules | |
key: yarn-v1-${{ runner.os }}-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Restore sandbox ${{ matrix.template }} | |
uses: actions/cache/restore@v3 | |
with: | |
path: sandbox | |
key: sandbox-v1-${{ matrix.template }}-${{ github.run_id }} | |
fail-on-cache-miss: true | |
- name: Run E2E tests for development ${{ matrix.template }} | |
run: yarn task --task e2e-tests-dev --template ${{ matrix.template }} --no-link --start-from never --junit |