name: CI on: push: paths-ignore: - "docs/**" branches: - main pull_request: paths-ignore: - "docs/**" branches: - main # 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" # 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 timeout-minutes: 10 steps: - uses: actions/checkout@v3 - run: corepack enable - uses: actions/setup-node@v3 with: node-version: 18 cache: "pnpm" - name: Install dependencies run: pnpm install - name: Build run: pnpm build - name: Test (types) run: pnpm test:types - name: Cache dist uses: actions/upload-artifact@v3 with: retention-days: 5 name: dist path: packages/*/dist lint: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v3 - run: corepack enable - uses: actions/setup-node@v3 with: node-version: 18 cache: "pnpm" - name: Install dependencies run: pnpm install - name: Lint run: pnpm lint test-fixtures: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] env: ['dev', 'built'] builder: ['vite', 'webpack'] node: [16] exclude: - env: 'dev' builder: 'webpack' timeout-minutes: 10 steps: - uses: actions/checkout@v3 - run: corepack enable - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: "pnpm" - name: Install dependencies run: pnpm install # Install playwright's binary under custom directory to cache - name: (non-windows) Set Playwright path and Get playwright version if: runner.os != 'Windows' 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 if: runner.os == 'Windows' 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 - name: Cache Playwright's binary uses: actions/cache@v3 with: key: ${{ runner.os }}-playwright-bin-v1-${{ env.PLAYWRIGHT_VERSION }} path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} restore-keys: | ${{ runner.os }}-playwright-bin-v1- - 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 - name: Build (stub) run: pnpm build:stub - name: Typecheck run: pnpm typecheck env: TEST_ENV: ${{ matrix.env }} TEST_BUILDER: ${{ matrix.builder }} - name: Test (unit) run: pnpm test:unit env: TEST_ENV: ${{ matrix.env }} TEST_BUILDER: ${{ matrix.builder }} - name: Test (fixtures) run: pnpm test:fixtures env: TEST_ENV: ${{ matrix.env }} TEST_BUILDER: ${{ matrix.builder }} build-release: 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') needs: - lint - build - test-fixtures runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] node: [16] timeout-minutes: 20 steps: - uses: actions/checkout@v3 - run: corepack enable - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: "pnpm" - name: Install dependencies run: pnpm install - name: Restore dist cache uses: actions/download-artifact@v3 with: name: dist path: packages - name: Release Edge run: ./scripts/release-edge.sh env: NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}