2021-07-22 10:51:07 -05:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
2021-09-14 23:23:39 -05:00
|
|
|
paths-ignore:
|
|
|
|
- '.vscode/**'
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
# Automatically cancel in-progress actions on the same branch
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2021-07-22 10:51:07 -05:00
|
|
|
jobs:
|
2021-11-29 16:11:15 -05:00
|
|
|
# Lint can run in parallel with Build.
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/checkout@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
|
2022-03-08 16:46:11 -05:00
|
|
|
- name: Setup PNPM
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 16:46:11 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Setup Node
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 16:46:11 -05:00
|
|
|
cache: 'pnpm'
|
2021-11-29 16:11:15 -05:00
|
|
|
|
2022-03-09 11:12:12 -05:00
|
|
|
- name: Install dependencies
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm install
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Status
|
|
|
|
run: git status
|
|
|
|
|
2021-12-01 22:58:34 -05:00
|
|
|
# Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
|
|
|
|
- name: Lint (External)
|
|
|
|
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm run lint
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2021-12-01 22:58:34 -05:00
|
|
|
# Otherwise, run lint autofixer
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Lint
|
2021-12-01 22:58:34 -05:00
|
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: wearerequired/lint-action@v1.11.1
|
2021-11-29 16:11:15 -05:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
eslint: true
|
2021-12-23 16:16:22 -05:00
|
|
|
prettier: false
|
2021-11-29 16:11:15 -05:00
|
|
|
auto_fix: true
|
2021-12-07 13:29:30 -05:00
|
|
|
git_name: github-actions[bot]
|
|
|
|
git_email: github-actions[bot]@users.noreply.github.com
|
2021-12-02 15:04:11 -05:00
|
|
|
commit_message: 'chore(lint): ${linter} fix'
|
2021-11-29 16:11:15 -05:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
neutral_check_on_warning: true
|
|
|
|
|
2022-03-01 14:59:06 -05:00
|
|
|
# Checks that the formatter runs successfully on all files
|
|
|
|
# In the future, we may have this fail PRs on unformatted code
|
|
|
|
- name: Format Check
|
|
|
|
run: yarn format --list
|
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
# Build installs all devDependencies and runs our full build pipeline.
|
|
|
|
# We upload all `dist/` artifacts to GitHub, which can be shared by all dependent jobs.
|
2021-07-22 10:51:07 -05:00
|
|
|
build:
|
2021-11-29 16:11:15 -05:00
|
|
|
name: Build Packages
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/checkout@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
|
2022-03-08 16:46:11 -05:00
|
|
|
- name: Setup PNPM
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 16:46:11 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Setup Node
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 16:46:11 -05:00
|
|
|
cache: 'pnpm'
|
2021-12-09 19:11:49 -05:00
|
|
|
|
2022-03-09 11:12:12 -05:00
|
|
|
- name: Install dependencies
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm install
|
2021-11-29 16:11:15 -05:00
|
|
|
|
|
|
|
- name: Build Packages
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm run build
|
2021-11-29 16:11:15 -05:00
|
|
|
|
|
|
|
- name: Upload Package Artifacts
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
with:
|
|
|
|
name: artifacts
|
2022-03-08 16:46:11 -05:00
|
|
|
path: |
|
2022-03-18 17:35:45 -05:00
|
|
|
packages/*/dist/**
|
|
|
|
packages/*/*/dist/**
|
2022-03-08 16:46:11 -05:00
|
|
|
packages/webapi/mod.js
|
|
|
|
packages/webapi/mod.js.map
|
2021-11-29 16:11:15 -05:00
|
|
|
if-no-files-found: error
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
# Test depends on Build's output, which allows us to skip any build process!
|
|
|
|
test:
|
|
|
|
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
|
2021-07-22 10:51:07 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-05-03 08:07:28 -05:00
|
|
|
env:
|
|
|
|
ASTRO_TELEMETRY_DISABLED: true
|
2021-07-22 10:51:07 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2021-12-16 18:53:22 -05:00
|
|
|
node_version: [14, 16]
|
2021-11-02 09:13:36 -05:00
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
node_version: 16
|
2021-11-11 12:24:48 -05:00
|
|
|
- os: macos-latest
|
|
|
|
node_version: 16
|
2021-07-22 10:51:07 -05:00
|
|
|
fail-fast: false
|
2021-11-29 16:11:15 -05:00
|
|
|
needs:
|
|
|
|
- build
|
2021-07-22 10:51:07 -05:00
|
|
|
steps:
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Checkout
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/checkout@v3
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2022-03-08 16:46:11 -05:00
|
|
|
- name: Setup PNPM
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Setup node@${{ matrix.node_version }}
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-22 10:51:07 -05:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2022-03-08 16:46:11 -05:00
|
|
|
cache: 'pnpm'
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2022-03-30 07:42:19 -05:00
|
|
|
- name: Use Deno
|
|
|
|
uses: denoland/setup-deno@v1
|
|
|
|
with:
|
|
|
|
deno-version: v1.19.3
|
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/download-artifact@v3
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2022-03-09 11:12:12 -05:00
|
|
|
- name: Install dependencies
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm install
|
2021-07-22 10:51:07 -05:00
|
|
|
|
|
|
|
- name: Test
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm run test
|
2021-12-09 19:11:49 -05:00
|
|
|
|
2022-05-15 16:47:28 -05:00
|
|
|
e2e:
|
|
|
|
name: 'E2E: ${{ matrix.os }} (node@${{ matrix.node_version }})'
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
|
|
ASTRO_TELEMETRY_DISABLED: true
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
node_version: [14, 16]
|
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
node_version: 16
|
|
|
|
- os: macos-latest
|
|
|
|
node_version: 16
|
|
|
|
fail-fast: false
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup PNPM
|
|
|
|
uses: pnpm/action-setup@v2.2.1
|
|
|
|
|
|
|
|
- name: Setup node@${{ matrix.node_version }}
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
|
|
|
- name: Download Build Artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: pnpm run test:e2e
|
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
smoke:
|
2021-12-13 17:31:18 -05:00
|
|
|
name: 'Test (Smoke) ${{ matrix.os }}'
|
|
|
|
runs-on: ${{ matrix.os }}
|
2021-11-29 16:11:15 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-12-13 17:31:18 -05:00
|
|
|
os: [windows-latest, ubuntu-latest]
|
2021-11-29 16:11:15 -05:00
|
|
|
needs:
|
|
|
|
- build
|
2021-07-22 10:51:07 -05:00
|
|
|
steps:
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Checkout
|
2022-03-02 17:08:42 -05:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2022-03-08 16:46:11 -05:00
|
|
|
- name: Update submodules
|
|
|
|
run: git submodule update --remote
|
|
|
|
|
|
|
|
- name: Setup PNPM
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 16:46:11 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Setup Node
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-22 10:51:07 -05:00
|
|
|
with:
|
2021-12-13 17:31:18 -05:00
|
|
|
node-version: 14
|
2022-03-08 16:46:11 -05:00
|
|
|
cache: 'pnpm'
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/download-artifact@v3
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
2022-03-09 11:12:12 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install --no-frozen-lockfile
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2022-02-18 16:40:03 -05:00
|
|
|
- name: Test
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm run test:smoke
|
2021-12-13 17:31:18 -05:00
|
|
|
|
2022-02-18 15:23:47 -05:00
|
|
|
- name: Memory Leak Test
|
|
|
|
run: |
|
2022-03-09 11:12:12 -05:00
|
|
|
node ./scripts/memory/mk.js
|
2022-02-18 20:08:28 -05:00
|
|
|
node --expose-gc ./scripts/memory/index.js --ci
|
2022-02-18 15:23:47 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
|
2022-01-10 17:36:41 -05:00
|
|
|
# Changelog can only run _after_ build.
|
2021-11-29 16:11:15 -05:00
|
|
|
# We download all `dist/` artifacts from GitHub to skip the build process.
|
|
|
|
changelog:
|
|
|
|
name: Changelog PR or Release
|
2022-03-04 16:50:30 -05:00
|
|
|
if: ${{ (github.ref_name == 'main' || github.head_ref == 'next') && github.repository_owner == 'withastro' }}
|
2022-01-10 17:36:41 -05:00
|
|
|
needs: [build]
|
2021-11-29 16:11:15 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-09 11:12:12 -05:00
|
|
|
- uses: actions/checkout@v3
|
2021-11-29 16:36:46 -05:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2022-03-08 16:46:11 -05:00
|
|
|
- name: Setup PNPM
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2021-07-22 10:51:07 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Setup Node
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 16:46:11 -05:00
|
|
|
cache: 'pnpm'
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 11:12:12 -05:00
|
|
|
uses: actions/download-artifact@v3
|
2021-11-29 16:11:15 -05:00
|
|
|
|
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
2022-03-09 11:12:12 -05:00
|
|
|
- name: Install dependencies
|
2022-03-08 16:46:11 -05:00
|
|
|
run: pnpm install
|
2022-03-09 11:12:12 -05:00
|
|
|
|
2021-11-29 16:11:15 -05:00
|
|
|
- name: Create Release Pull Request or Publish
|
|
|
|
id: changesets
|
2021-11-29 16:23:08 -05:00
|
|
|
uses: changesets/action@v1
|
2021-11-29 16:11:15 -05:00
|
|
|
with:
|
2022-03-19 12:33:24 -05:00
|
|
|
# Note: pnpm install after versioning is necessary to refresh lockfile
|
2022-03-21 17:55:31 -05:00
|
|
|
version: pnpm run version
|
2022-03-08 16:46:11 -05:00
|
|
|
publish: pnpm exec changeset publish
|
2021-12-16 16:38:55 -05:00
|
|
|
commit: '[ci] release'
|
2021-11-29 16:11:15 -05:00
|
|
|
title: '[ci] release'
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
|
|
|
|
- name: Generate Notification
|
|
|
|
id: notification
|
|
|
|
if: steps.changesets.outputs.published == 'true'
|
|
|
|
run: message=$(node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}') && echo ::set-output name=message::${message//$'\n'/'%0A'}
|
|
|
|
|
|
|
|
- name: Discord Notification
|
|
|
|
if: steps.changesets.outputs.published == 'true'
|
|
|
|
id: discord-notification
|
|
|
|
env:
|
|
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
|
|
uses: Ilshidur/action-discord@0.3.2
|
|
|
|
with:
|
|
|
|
args: ${{ steps.notification.outputs.message }}
|