2021-07-22 15:51:07 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
2021-09-15 04:23:39 +00:00
|
|
|
paths-ignore:
|
|
|
|
- '.vscode/**'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00: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 15:51:07 +00:00
|
|
|
jobs:
|
2021-11-29 21:11:15 +00:00
|
|
|
# Lint can run in parallel with Build.
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
|
2022-03-08 21:46:11 +00:00
|
|
|
- name: Setup PNPM
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 21:46:11 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 21:46:11 +00:00
|
|
|
cache: 'pnpm'
|
2021-11-29 21:11:15 +00:00
|
|
|
|
2022-03-09 16:12:12 +00:00
|
|
|
- name: Install dependencies
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm install
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Status
|
|
|
|
run: git status
|
|
|
|
|
2021-12-02 03:58:34 +00: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 21:46:11 +00:00
|
|
|
run: pnpm run lint
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-12-02 03:58:34 +00:00
|
|
|
# Otherwise, run lint autofixer
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Lint
|
2021-12-02 03:58:34 +00:00
|
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: wearerequired/lint-action@v1.11.1
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
eslint: true
|
2021-12-23 21:16:22 +00:00
|
|
|
prettier: false
|
2021-11-29 21:11:15 +00:00
|
|
|
auto_fix: true
|
2021-12-07 18:29:30 +00:00
|
|
|
git_name: github-actions[bot]
|
|
|
|
git_email: github-actions[bot]@users.noreply.github.com
|
2021-12-02 20:04:11 +00:00
|
|
|
commit_message: 'chore(lint): ${linter} fix'
|
2021-11-29 21:11:15 +00:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
neutral_check_on_warning: true
|
|
|
|
|
2022-03-01 19:59:06 +00: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 21:11:15 +00: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 15:51:07 +00:00
|
|
|
build:
|
2021-11-29 21:11:15 +00:00
|
|
|
name: Build Packages
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
|
2022-03-08 21:46:11 +00:00
|
|
|
- name: Setup PNPM
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 21:46:11 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 21:46:11 +00:00
|
|
|
cache: 'pnpm'
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2022-03-09 16:12:12 +00:00
|
|
|
- name: Install dependencies
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm install
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
- name: Build Packages
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm run build
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
- name: Upload Package Artifacts
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
|
|
|
name: artifacts
|
2022-03-08 21:46:11 +00:00
|
|
|
path: |
|
2022-03-18 22:35:45 +00:00
|
|
|
packages/*/dist/**
|
|
|
|
packages/*/*/dist/**
|
2022-03-08 21:46:11 +00:00
|
|
|
packages/webapi/mod.js
|
|
|
|
packages/webapi/mod.js.map
|
2021-11-29 21:11:15 +00:00
|
|
|
if-no-files-found: error
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00: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 15:51:07 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-05-03 13:07:28 +00:00
|
|
|
env:
|
|
|
|
ASTRO_TELEMETRY_DISABLED: true
|
2021-07-22 15:51:07 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2021-12-16 23:53:22 +00:00
|
|
|
node_version: [14, 16]
|
2021-11-02 14:13:36 +00:00
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
node_version: 16
|
2021-11-11 17:24:48 +00:00
|
|
|
- os: macos-latest
|
|
|
|
node_version: 16
|
2021-07-22 15:51:07 +00:00
|
|
|
fail-fast: false
|
2021-11-29 21:11:15 +00:00
|
|
|
needs:
|
|
|
|
- build
|
2021-07-22 15:51:07 +00:00
|
|
|
steps:
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Checkout
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2022-03-08 21:46:11 +00:00
|
|
|
- name: Setup PNPM
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup node@${{ matrix.node_version }}
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-22 15:51:07 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2022-03-08 21:46:11 +00:00
|
|
|
cache: 'pnpm'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2022-03-30 12:42:19 +00:00
|
|
|
- name: Use Deno
|
|
|
|
uses: denoland/setup-deno@v1
|
|
|
|
with:
|
|
|
|
deno-version: v1.19.3
|
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2022-03-09 16:12:12 +00:00
|
|
|
- name: Install dependencies
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm install
|
2021-07-22 15:51:07 +00:00
|
|
|
|
|
|
|
- name: Test
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm run test
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2022-05-15 21:47:28 +00: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 21:11:15 +00:00
|
|
|
smoke:
|
2021-12-13 22:31:18 +00:00
|
|
|
name: 'Test (Smoke) ${{ matrix.os }}'
|
|
|
|
runs-on: ${{ matrix.os }}
|
2021-11-29 21:11:15 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-12-13 22:31:18 +00:00
|
|
|
os: [windows-latest, ubuntu-latest]
|
2021-11-29 21:11:15 +00:00
|
|
|
needs:
|
|
|
|
- build
|
2021-07-22 15:51:07 +00:00
|
|
|
steps:
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Checkout
|
2022-03-02 22:08:42 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2022-03-08 21:46:11 +00:00
|
|
|
- name: Update submodules
|
|
|
|
run: git submodule update --remote
|
|
|
|
|
|
|
|
- name: Setup PNPM
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2022-03-08 21:46:11 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-22 15:51:07 +00:00
|
|
|
with:
|
2021-12-13 22:31:18 +00:00
|
|
|
node-version: 14
|
2022-03-08 21:46:11 +00:00
|
|
|
cache: 'pnpm'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
2022-03-09 16:12:12 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install --no-frozen-lockfile
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2022-02-18 21:40:03 +00:00
|
|
|
- name: Test
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm run test:smoke
|
2021-12-13 22:31:18 +00:00
|
|
|
|
2022-02-18 20:23:47 +00:00
|
|
|
- name: Memory Leak Test
|
|
|
|
run: |
|
2022-03-09 16:12:12 +00:00
|
|
|
node ./scripts/memory/mk.js
|
2022-02-19 01:08:28 +00:00
|
|
|
node --expose-gc ./scripts/memory/index.js --ci
|
2022-02-18 20:23:47 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
|
2022-01-10 22:36:41 +00:00
|
|
|
# Changelog can only run _after_ build.
|
2021-11-29 21:11:15 +00:00
|
|
|
# We download all `dist/` artifacts from GitHub to skip the build process.
|
|
|
|
changelog:
|
|
|
|
name: Changelog PR or Release
|
2022-03-04 21:50:30 +00:00
|
|
|
if: ${{ (github.ref_name == 'main' || github.head_ref == 'next') && github.repository_owner == 'withastro' }}
|
2022-01-10 22:36:41 +00:00
|
|
|
needs: [build]
|
2021-11-29 21:11:15 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-09 16:12:12 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2022-03-08 21:46:11 +00:00
|
|
|
- name: Setup PNPM
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: pnpm/action-setup@v2.2.1
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
|
|
|
node-version: 16
|
2022-03-08 21:46:11 +00:00
|
|
|
cache: 'pnpm'
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Download Build Artifacts
|
2022-03-09 16:12:12 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
2022-03-09 16:12:12 +00:00
|
|
|
- name: Install dependencies
|
2022-03-08 21:46:11 +00:00
|
|
|
run: pnpm install
|
2022-03-09 16:12:12 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Create Release Pull Request or Publish
|
|
|
|
id: changesets
|
2021-11-29 21:23:08 +00:00
|
|
|
uses: changesets/action@v1
|
2021-11-29 21:11:15 +00:00
|
|
|
with:
|
2022-03-19 17:33:24 +00:00
|
|
|
# Note: pnpm install after versioning is necessary to refresh lockfile
|
2022-03-21 22:55:31 +00:00
|
|
|
version: pnpm run version
|
2022-03-08 21:46:11 +00:00
|
|
|
publish: pnpm exec changeset publish
|
2021-12-16 21:38:55 +00:00
|
|
|
commit: '[ci] release'
|
2021-11-29 21:11:15 +00:00
|
|
|
title: '[ci] release'
|
|
|
|
env:
|
2022-06-27 18:02:44 +00:00
|
|
|
# Needs access to push to main
|
|
|
|
GITHUB_TOKEN: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
|
|
|
|
# Needs access to publish to npm
|
2021-11-29 21:11:15 +00:00
|
|
|
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 }}
|