2021-08-09 17:30:25 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-03-16 13:58:53 +00:00
|
|
|
paths-ignore:
|
2022-10-17 10:10:05 +00:00
|
|
|
- "docs/**"
|
2021-08-09 17:30:25 +00:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
2022-03-16 13:58:53 +00:00
|
|
|
paths-ignore:
|
2022-10-17 10:10:05 +00:00
|
|
|
- "docs/**"
|
2021-08-09 17:30:25 +00:00
|
|
|
branches:
|
|
|
|
- main
|
2023-04-20 08:47:03 +00:00
|
|
|
- "!v[0-9]*"
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2023-02-13 22:09:32 +00:00
|
|
|
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml
|
|
|
|
env:
|
|
|
|
# 7 GiB by default on GitHub, setting to 6 GiB
|
|
|
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
|
|
|
NODE_OPTIONS: --max-old-space-size=6144
|
|
|
|
# install playwright binary manually (because pnpm only runs install script once)
|
|
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
|
2022-02-21 10:26:51 +00:00
|
|
|
|
|
|
|
|
2023-02-13 22:09:32 +00:00
|
|
|
# Remove default permissions of GITHUB_TOKEN for security
|
|
|
|
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
|
|
|
permissions: {}
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
|
|
cancel-in-progress: ${{ github.event_name != 'push' }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-25 08:59:59 +00:00
|
|
|
timeout-minutes: 10
|
|
|
|
|
2022-02-21 10:26:51 +00:00
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-10-17 10:10:05 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2022-02-21 10:26:51 +00:00
|
|
|
with:
|
2023-04-24 21:24:38 +00:00
|
|
|
node-version: 20
|
2022-10-17 10:10:05 +00:00
|
|
|
cache: "pnpm"
|
2022-02-21 10:26:51 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm install
|
2022-02-21 10:26:51 +00:00
|
|
|
|
2023-03-12 22:16:43 +00:00
|
|
|
- name: Build (stub)
|
2023-03-12 22:15:06 +00:00
|
|
|
run: pnpm build:stub
|
|
|
|
|
2023-03-12 22:10:30 +00:00
|
|
|
- name: Typecheck
|
|
|
|
run: pnpm typecheck
|
|
|
|
|
2022-02-21 10:26:51 +00:00
|
|
|
- name: Build
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm build
|
2022-02-21 10:26:51 +00:00
|
|
|
|
|
|
|
- name: Cache dist
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
2022-02-21 10:26:51 +00:00
|
|
|
with:
|
2023-02-20 09:54:48 +00:00
|
|
|
retention-days: 3
|
2023-02-13 22:09:32 +00:00
|
|
|
name: dist
|
2022-02-21 10:26:51 +00:00
|
|
|
path: packages/*/dist
|
|
|
|
|
2023-06-02 17:14:21 +00:00
|
|
|
codeql:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
permissions:
|
|
|
|
actions: read
|
|
|
|
contents: read
|
|
|
|
security-events: write
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
|
|
|
|
steps:
|
2023-06-02 19:35:13 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-06-02 17:14:21 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 19:35:13 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2023-06-02 17:14:21 +00:00
|
|
|
with:
|
|
|
|
node-version: 20
|
|
|
|
cache: "pnpm"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
|
|
|
|
|
|
|
- name: Initialize CodeQL
|
2023-06-02 19:35:13 +00:00
|
|
|
uses: github/codeql-action/init@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6
|
2023-06-02 17:14:21 +00:00
|
|
|
with:
|
|
|
|
languages: javascript
|
|
|
|
queries: +security-and-quality
|
|
|
|
|
|
|
|
- name: Restore dist cache
|
2023-06-02 19:35:13 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-06-02 17:14:21 +00:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: packages
|
|
|
|
|
|
|
|
- name: Perform CodeQL Analysis
|
2023-06-02 19:35:13 +00:00
|
|
|
uses: github/codeql-action/analyze@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6
|
2023-06-02 17:14:21 +00:00
|
|
|
with:
|
|
|
|
category: "/language:javascript"
|
|
|
|
|
2023-03-17 15:24:39 +00:00
|
|
|
typecheck:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
needs:
|
|
|
|
- build
|
2023-05-04 09:38:02 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
module: ['bundler', 'node']
|
2023-03-17 15:24:39 +00:00
|
|
|
|
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-03-17 15:24:39 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2023-03-17 15:24:39 +00:00
|
|
|
with:
|
2023-04-24 21:24:38 +00:00
|
|
|
node-version: 20
|
2023-03-17 15:24:39 +00:00
|
|
|
cache: "pnpm"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
|
|
|
|
|
|
|
- name: Restore dist cache
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-03-17 15:24:39 +00:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: packages
|
|
|
|
|
|
|
|
- name: Test (types)
|
|
|
|
run: pnpm test:types
|
2023-05-04 09:38:02 +00:00
|
|
|
env:
|
|
|
|
MODULE_RESOLUTION: ${{ matrix.module }}
|
2023-03-17 15:24:39 +00:00
|
|
|
|
2021-08-09 17:30:25 +00:00
|
|
|
lint:
|
2023-04-04 13:39:10 +00:00
|
|
|
# autofix workflow will be triggered instead for PRs
|
|
|
|
if: github.event_name == 'push'
|
2023-02-13 22:09:32 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-08-25 08:59:59 +00:00
|
|
|
timeout-minutes: 10
|
|
|
|
|
2021-08-09 17:30:25 +00:00
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-10-17 10:10:05 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2021-08-09 17:30:25 +00:00
|
|
|
with:
|
2023-04-24 21:24:38 +00:00
|
|
|
node-version: 20
|
2022-10-17 10:10:05 +00:00
|
|
|
cache: "pnpm"
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm install
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2023-04-06 12:55:12 +00:00
|
|
|
- name: Build (stub)
|
|
|
|
run: pnpm build:stub
|
|
|
|
|
2021-08-09 17:30:25 +00:00
|
|
|
- name: Lint
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm lint
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2022-02-18 18:14:57 +00:00
|
|
|
test-fixtures:
|
2021-08-09 17:30:25 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2023-03-17 15:24:39 +00:00
|
|
|
needs:
|
|
|
|
- build
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
strategy:
|
2023-02-13 22:09:32 +00:00
|
|
|
fail-fast: false
|
2021-08-09 17:30:25 +00:00
|
|
|
matrix:
|
2022-03-16 13:41:37 +00:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
2023-02-13 22:09:32 +00:00
|
|
|
env: ['dev', 'built']
|
|
|
|
builder: ['vite', 'webpack']
|
2023-04-11 22:57:12 +00:00
|
|
|
payload: ['json', 'js']
|
2022-03-18 13:13:19 +00:00
|
|
|
node: [16]
|
2023-02-13 22:09:32 +00:00
|
|
|
exclude:
|
|
|
|
- env: 'dev'
|
|
|
|
builder: 'webpack'
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2022-08-25 08:59:59 +00:00
|
|
|
timeout-minutes: 10
|
|
|
|
|
2021-08-09 17:30:25 +00:00
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-10-17 10:10:05 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2021-08-09 17:30:25 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
2022-10-17 10:10:05 +00:00
|
|
|
cache: "pnpm"
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm install
|
|
|
|
|
|
|
|
# Install playwright's binary under custom directory to cache
|
2023-02-13 22:09:32 +00:00
|
|
|
- name: (non-windows) Set Playwright path and Get playwright version
|
2022-10-17 10:10:05 +00:00
|
|
|
if: runner.os != 'Windows'
|
2023-02-13 22:09:32 +00:00
|
|
|
run: |
|
|
|
|
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
|
|
|
|
PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright | jq --raw-output '.[0].unsavedDependencies["playwright"].version')"
|
|
|
|
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: (windows) Set Playwright path and Get playwright version
|
2022-10-17 10:10:05 +00:00
|
|
|
if: runner.os == 'Windows'
|
2023-02-13 22:09:32 +00:00
|
|
|
run: |
|
|
|
|
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
|
|
|
|
$env:PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright | jq --raw-output '.[0].unsavedDependencies[\"playwright\"].version')"
|
|
|
|
echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV
|
2022-10-17 10:10:05 +00:00
|
|
|
|
|
|
|
- name: Cache Playwright's binary
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
|
2022-10-17 10:10:05 +00:00
|
|
|
with:
|
2023-02-13 22:09:32 +00:00
|
|
|
key: ${{ runner.os }}-playwright-bin-v1-${{ env.PLAYWRIGHT_VERSION }}
|
2022-10-17 10:10:05 +00:00
|
|
|
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
|
2023-02-13 22:09:32 +00:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-playwright-bin-v1-
|
2022-10-17 10:10:05 +00:00
|
|
|
|
|
|
|
- name: Install Playwright
|
|
|
|
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
|
|
|
|
run: pnpm playwright install chromium
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2023-03-17 15:24:39 +00:00
|
|
|
- name: Restore dist cache
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-03-17 15:24:39 +00:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: packages
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2021-08-10 00:27:23 +00:00
|
|
|
- name: Test (unit)
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm test:unit
|
2021-08-10 00:27:23 +00:00
|
|
|
|
2022-02-18 18:14:57 +00:00
|
|
|
- name: Test (fixtures)
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm test:fixtures
|
2022-04-07 19:15:30 +00:00
|
|
|
env:
|
2023-02-13 22:09:32 +00:00
|
|
|
TEST_ENV: ${{ matrix.env }}
|
|
|
|
TEST_BUILDER: ${{ matrix.builder }}
|
2023-04-11 22:57:12 +00:00
|
|
|
TEST_PAYLOAD: ${{ matrix.payload }}
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
build-release:
|
2023-04-20 19:55:06 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
2022-03-16 13:58:53 +00:00
|
|
|
if: |
|
|
|
|
github.event_name == 'push' &&
|
|
|
|
!contains(github.event.head_commit.message, '[skip-release]') &&
|
|
|
|
!contains(github.event.head_commit.message, 'chore') &&
|
|
|
|
!contains(github.event.head_commit.message, 'docs')
|
2021-08-09 17:30:25 +00:00
|
|
|
needs:
|
|
|
|
- lint
|
2022-02-21 10:26:51 +00:00
|
|
|
- build
|
2022-02-18 18:14:57 +00:00
|
|
|
- test-fixtures
|
2023-05-16 08:52:24 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 20
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2023-05-16 08:52:24 +00:00
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-05-16 08:52:24 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2023-05-16 08:52:24 +00:00
|
|
|
with:
|
|
|
|
node-version: 20
|
|
|
|
cache: "pnpm"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
|
|
|
|
|
|
|
- name: Restore dist cache
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-05-16 08:52:24 +00:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: packages
|
|
|
|
|
|
|
|
- name: Release Edge
|
|
|
|
run: ./scripts/release-edge.sh
|
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
|
|
|
NPM_CONFIG_PROVENANCE: true
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2023-05-16 08:52:24 +00:00
|
|
|
release-pr:
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
pull-requests: write
|
|
|
|
if: |
|
|
|
|
github.event_name == 'pull_request' &&
|
|
|
|
contains(github.event.pull_request.labels.*.name, '🧷 edge release')
|
|
|
|
needs:
|
|
|
|
- lint
|
|
|
|
- build
|
|
|
|
- test-fixtures
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-25 08:59:59 +00:00
|
|
|
timeout-minutes: 20
|
|
|
|
|
2021-08-09 17:30:25 +00:00
|
|
|
steps:
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-03-03 10:45:47 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-10-17 10:10:05 +00:00
|
|
|
- run: corepack enable
|
2023-06-02 17:14:21 +00:00
|
|
|
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
2021-08-09 17:30:25 +00:00
|
|
|
with:
|
2023-05-16 08:52:24 +00:00
|
|
|
node-version: 20
|
2022-10-17 10:10:05 +00:00
|
|
|
cache: "pnpm"
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-10-17 10:10:05 +00:00
|
|
|
run: pnpm install
|
2021-08-09 17:30:25 +00:00
|
|
|
|
2022-02-21 10:26:51 +00:00
|
|
|
- name: Restore dist cache
|
2023-06-02 17:14:21 +00:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2022-02-21 10:26:51 +00:00
|
|
|
with:
|
2023-02-13 22:09:32 +00:00
|
|
|
name: dist
|
|
|
|
path: packages
|
2021-08-09 17:30:25 +00:00
|
|
|
|
|
|
|
- name: Release Edge
|
2023-05-16 08:52:24 +00:00
|
|
|
run: ./scripts/release-edge.sh pr-${{ github.event.issue.number }}
|
2021-08-09 17:30:25 +00:00
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
2023-04-20 19:55:06 +00:00
|
|
|
NPM_CONFIG_PROVENANCE: true
|