WIP: POC: Replace CircleCI with GitHub Actions #35
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] | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
name: All Checks | |
jobs: | |
compile: | |
name: Prepare dependencies and compile | |
runs-on: ubuntu-latest | |
outputs: | |
create-sandbox-matrix: ${{ steps.create-sandbox-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Generate sandbox matrix | |
id: create-sandbox-matrix | |
working-directory: scripts | |
run: | | |
MATRIX=$(yarn ts-node generate-sandbox-matrix.ts '${{ toJSON(github.event.pull_request.labels.*.name) }}' ${{ github.event.pull_request.draft }}) | |
echo $MATRIX | |
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
- name: Restore dependencies | |
id: dependency-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn/berry/cache | |
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: Playwright v${{ steps.playwright-version.outputs.version }} Cache | |
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 | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
working-directory: code | |
run: npx playwright install | |
- 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 }} | |
sandboxes: | |
name: Sandboxes | |
runs-on: ubuntu-latest | |
needs: compile | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.compile.outputs.create-sandbox-matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare workspace | |
uses: ./.github/actions/prepare-workspace | |
with: | |
template: ${{ matrix.template }} | |
playwright: true | |
- name: Create sandbox ${{ matrix.template }} | |
id: create-sandbox | |
run: yarn task --task sandbox --template ${{ matrix.template }} --no-link --start-from never --junit | |
- name: Build sandbox ${{ matrix.template }} | |
id: build-sandbox | |
run: | | |
cd scripts && yarn ts-node event-log-collector.ts & | |
yarn task --task build --template react-vite/default-ts --no-link --start-from build --junit | |
- name: Verify build telemetry | |
id: verify-build-telemetry | |
working-directory: scripts | |
run: yarn ts-node ./event-log-checker build ${{ matrix.template }} | |
- name: Run Production Test Runner ${{ matrix.template }} | |
env: | |
STORYBOOK_SERVE_PORT: 8002 | |
run: yarn task --task test-runner --template ${{ matrix.template }} --no-link --start-from never --junit | |
- name: Run Production E2E tests ${{ matrix.template }} | |
if: (success() || failure()) && steps.build-sandbox.outcome == 'success' | |
run: yarn task --task e2e-tests --template ${{ matrix.template }} --no-link --start-from never --junit | |
- name: Run Development Test Runner ${{ matrix.template }} | |
if: (success() || failure()) && steps.create-sandbox.outcome == 'success' | |
run: yarn task --task test-runner-dev --template ${{ matrix.template }} --no-link --start-from never --junit | |
- name: Run Development E2E tests ${{ matrix.template }} | |
if: (success() || failure()) && steps.create-sandbox.outcome == 'success' | |
env: | |
STORYBOOK_SERVE_PORT: 6007 | |
run: yarn task --task e2e-tests-dev --template ${{ matrix.template }} --no-link --start-from never --junit |