[test] Add e2e testing #526
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: Continuous Integration | |
on: pull_request | |
jobs: | |
unit-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- 18 | |
- 20 | |
name: Unit tests w/ Node.js ${{matrix.node}}.x | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node ${{matrix.node}}.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node}}.x | |
- name: Cache build:all | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: packages/published/**/dist | |
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/published/**', 'yarn.lock') }} | |
- run: yarn install | |
- name: Build all plugins | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
run: yarn build:all | |
- run: yarn test | |
e2e: | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- 18 | |
timeout-minutes: 20 | |
name: End to End | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node ${{matrix.node}}.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node}}.x | |
- name: Cache build:all | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: packages/published/**/dist | |
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/published/**', 'yarn.lock') }} | |
- name: Cache playwright binaries | |
id: cache-playwright-binaries | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
~/Library/Caches/ms-playwright | |
%USERPROFILE%\AppData\Local\ms-playwright | |
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }} | |
- run: yarn install | |
- name: Install playwright | |
run: yarn workspace @dd/tests playwright install --with-deps | |
- name: Build all plugins | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
run: yarn build:all | |
- run: yarn workspace @dd/tests e2e || ls -la packages/tests/src/_playwright/projects/dist | |
- name: Save playwright cache | |
if: always() && steps.cache-playwright-binaries.outputs.cache-hit != 'true' | |
id: save-playwright-cache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
~/Library/Caches/ms-playwright | |
%USERPROFILE%\AppData\Local\ms-playwright | |
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright | |
path: | | |
packages/tests/playwright-report | |
packages/tests/test-results | |
packages/tests/src/_playwright/projects/dist | |
retention-days: 3 | |
lint: | |
strategy: | |
matrix: | |
node: | |
- 18 | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node ${{matrix.node}}.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node}}.x | |
- name: Cache build:all | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: packages/published/**/dist | |
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/published/**', 'yarn.lock') }} | |
- run: yarn install | |
- name: Build all plugins | |
if: steps.cache-build.outputs.cache-hit != 'true' | |
run: yarn build:all | |
- run: yarn typecheck:all | |
- run: yarn cli integrity | |
- run: git diff --exit-code && git diff --cached --exit-code || (echo "Please run 'yarn cli integrity' and commit the result." && exit 1) |