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/**'
|
|
|
|
- 'docs/**'
|
|
|
|
- 'examples/**'
|
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.
|
|
|
|
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install NPM Dependencies
|
2021-12-10 00:11:49 +00:00
|
|
|
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
- 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 }}
|
|
|
|
run: yarn lint
|
|
|
|
|
|
|
|
# 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 }}
|
2021-11-29 21:11:15 +00:00
|
|
|
uses: wearerequired/lint-action@v1.10.0
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
eslint: true
|
|
|
|
eslint_args: --ignore-pattern test --ignore-pattern vendor
|
|
|
|
eslint_dir: packages/astro
|
|
|
|
eslint_extensions: ts
|
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
|
|
|
|
|
|
|
|
# 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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
cache: 'yarn'
|
|
|
|
|
2021-12-13 19:55:35 +00:00
|
|
|
- name: Cache Node Modules
|
|
|
|
id: cache-node
|
2021-12-10 00:11:49 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-12-13 19:55:35 +00:00
|
|
|
path: "**/node_modules"
|
2021-12-16 21:38:55 +00:00
|
|
|
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
2021-12-13 19:55:35 +00:00
|
|
|
restore-keys: |
|
2021-12-16 21:38:55 +00:00
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Install NPM Dependencies
|
2021-12-10 00:11:49 +00:00
|
|
|
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
- name: Build Packages
|
2021-12-13 19:55:35 +00:00
|
|
|
run: yarn build --force
|
2021-11-29 21:11:15 +00:00
|
|
|
|
|
|
|
- name: Upload Package Artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: artifacts
|
2021-12-10 00:11:49 +00:00
|
|
|
path: packages/**/dist/**
|
2021-11-29 21:11:15 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
|
|
|
|
# Test depends on Build's output, which allows us to skip any build process!
|
|
|
|
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
|
|
|
|
test:
|
|
|
|
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
|
2021-07-22 15:51:07 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
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
|
2021-07-22 15:51:07 +00:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup node@${{ matrix.node_version }}
|
2021-07-22 15:51:07 +00:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node_version }}
|
2021-10-03 06:28:50 +00:00
|
|
|
cache: 'yarn'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Download Build Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
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
|
|
|
|
2021-12-13 19:55:35 +00:00
|
|
|
- name: Cache Node Modules
|
|
|
|
id: cache-node
|
2021-12-10 00:11:49 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-12-13 19:55:35 +00:00
|
|
|
path: "**/node_modules"
|
2021-12-16 21:38:55 +00:00
|
|
|
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
restore-keys: |
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Install NPM Dependencies
|
2021-12-10 00:11:49 +00:00
|
|
|
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
CI: true
|
2021-07-22 15:51:07 +00:00
|
|
|
|
|
|
|
- name: Test
|
2021-12-10 00:11:49 +00:00
|
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
2021-07-22 15:51:07 +00:00
|
|
|
run: yarn test
|
|
|
|
|
2021-12-10 00:11:49 +00:00
|
|
|
# Turbo seems to make the tests hang on Windows, just run them directly
|
|
|
|
- name: Test (Windows)
|
|
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
|
|
run: yarn workspace astro run test
|
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
2021-07-22 15:51:07 +00:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-12-13 22:31:18 +00:00
|
|
|
node-version: 14
|
2021-10-03 06:28:50 +00:00
|
|
|
cache: 'yarn'
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Download Build Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
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-12-13 19:55:35 +00:00
|
|
|
- name: Cache Node Modules
|
|
|
|
id: cache-node
|
2021-12-10 00:11:49 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-12-13 19:55:35 +00:00
|
|
|
path: "**/node_modules"
|
2021-12-16 21:38:55 +00:00
|
|
|
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
restore-keys: |
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Install NPM Dependencies
|
2021-12-10 00:11:49 +00:00
|
|
|
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
CI: true
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-12-13 22:31:18 +00:00
|
|
|
- name: Test
|
|
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
|
|
run: yarn run build:examples --concurrency=1
|
|
|
|
|
|
|
|
# Turbo seems to fail on Windows, so run a custom script directly.
|
|
|
|
- name: Test (Windows)
|
|
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
|
|
run: node ./scripts/smoke/index.js
|
|
|
|
|
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
|
2021-12-16 22:48:09 +00:00
|
|
|
if: ${{ github.ref_name == 'main' && 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:
|
|
|
|
- uses: actions/checkout@v2
|
2021-11-29 21:36:46 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-07-22 15:51:07 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Download Build Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
|
|
|
|
- name: Extract Artifacts
|
|
|
|
run: ./.github/extract-artifacts.sh
|
|
|
|
|
2021-12-13 19:55:35 +00:00
|
|
|
- name: Cache Node Modules
|
|
|
|
id: cache-node
|
2021-12-10 00:11:49 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-12-13 19:55:35 +00:00
|
|
|
path: "**/node_modules"
|
2021-12-16 21:38:55 +00:00
|
|
|
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
restore-keys: |
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
|
|
|
|
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
|
2021-12-10 00:11:49 +00:00
|
|
|
|
2021-11-29 21:11:15 +00:00
|
|
|
- name: Install NPM Dependencies
|
2021-12-10 00:11:49 +00:00
|
|
|
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
|
2021-11-29 21:11:15 +00:00
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
- 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:
|
2021-11-29 21:23:08 +00:00
|
|
|
publish: yarn 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:
|
|
|
|
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 }}
|