Skip to content

WIP: POC: Replace CircleCI with GitHub Actions #26

WIP: POC: Replace CircleCI with GitHub Actions

WIP: POC: Replace CircleCI with GitHub Actions #26

Workflow file for this run

on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review]
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
name: All Checks
jobs:
compile:
name: Prepare dependencies and compile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Restore 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
- name: Get Playwight version
id: playwright-version
working-directory: code
run: |
echo "version=$(yarn info playwright --json | jq --raw-output ".children.Version")" >> $GITHUB_OUTPUT
- name: Restore Playwright v${{ steps.playwright-version.outputs.version }}
id: playwright-cache
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: playwright-v1-${{ runner.os }}-v${{ steps.playwright-version.outputs.version }}
- name: Install Playwright Browsers
working-directory: code
run: npx playwright ${{ steps.playwright-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: Publish to Verdaccio
working-directory: code
run: yarn local-registry --publish
- name: Save Verdacio cache
uses: actions/cache/save@v3
with:
path: .verdaccio-cache
key: verdaccio-v1-${{ runner.os }}-${{ github.run_id }}
create-sandboxes:
name: Create Sandbox
runs-on: ubuntu-latest
needs: compile
continue-on-error: true
strategy:
fail-fast: false
matrix:
template: [react-vite/default-ts]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
- 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]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
sandbox: true
- name: Build sandbox ${{ matrix.template }}
run: |
cd scripts && yarn ts-node event-log-collector.ts &
cd sandbox/react-vite-default-ts && yarn build-storybook
- 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-built-v1-${{ matrix.template }}-${{ github.run_id }}
test-runner-production:
name: Test Runner Production
runs-on: ubuntu-latest
needs: build-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: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
sandbox: true
built-sandbox: 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
strategy:
fail-fast: false
matrix:
template: [react-vite/default-ts, angular-cli/default-ts]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
sandbox: 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
strategy:
fail-fast: false
matrix:
template: [react-vite/default-ts, angular-cli/default-ts]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
sandbox: true
built-sandbox: 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
strategy:
fail-fast: false
matrix:
template: [react-vite/default-ts, angular-cli/default-ts]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare workspace
uses: ./.github/actions/prepare-workspace
with:
template: ${{ matrix.template }}
sandbox: 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