Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split scripts and refine triggers #8356

Merged
merged 7 commits into from Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/check-toc.yml
@@ -0,0 +1,53 @@
name: Check

on:
workflow_dispatch:
pull_request:
paths:
- 'site/**'
- 'scripts/**'

jobs:
toc:
name: TOC
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}
ref: ${{ github.head_ref }}

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install Node dependencies
run: yarn --frozen-lockfile

- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.x'

- name: Setup data
run: yarn data

- name: Build Jekyll
run: |
gem install bundler
pushd site
bundle install
bundle exec jekyll build -q
popd

- name: Build TOC
run: scripts/generate-toc

- name: Setup Git remote
run: scripts/setup-git-ci.sh

- name: Check and Commit
run: scripts/check-and-commit-toc.sh
56 changes: 6 additions & 50 deletions .github/workflows/check.yml
@@ -1,9 +1,8 @@
name: Check

on:
push:
branches:
- '**'
workflow_dispatch:
pull_request:

jobs:
check:
Expand All @@ -14,6 +13,7 @@ jobs:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}
ref: ${{ github.head_ref }}

- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -35,60 +35,16 @@ jobs:
sudo mv parallel sem /usr/local/bin

- name: Format
if: github.ref != 'refs/heads/next'
run: yarn format

- name: Build Schema
run: yarn schema

- name: Check Schema
run: ./scripts/check-schema.sh
run: scripts/check-schema.sh

- name: Setup Git remote
run: ./scripts/setup-git-ci.sh
run: scripts/setup-git-ci.sh

- name: Check and Commit
run: ./scripts/check-and-commit.sh

toc:
name: TOC
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT || github.token }}

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install Node dependencies
run: yarn --frozen-lockfile

- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.x'

- name: Setup data
run: yarn data

- name: Build Jekyll
run: |
gem install bundler
pushd site
bundle install
bundle exec jekyll build -q
popd

- name: Build TOC
run: scripts/generate-toc

- name: Setup Git remote
run: ./scripts/setup-git-ci.sh

- name: Check and Commit
run: ./scripts/check-and-commit-toc.sh
run: scripts/check-and-commit.sh
3 changes: 3 additions & 0 deletions .github/workflows/merge-dependabot.yml
@@ -1,7 +1,10 @@
name: Auto-merge Dependabot PRs

on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'

jobs:
auto_merge:
name: Auto-merge Dependabot PRs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-to-npm.yml
Expand Up @@ -7,6 +7,8 @@ on:
- 'dependabot/**'
# documentation site should not trigger releases
- 'gh-pages'
paths-ignore:
- 'site/**'

jobs:
publish:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-docs-and-schema.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
run: yarn build

- name: Setup Git remote
run: ./scripts/setup-git-ci.sh
run: scripts/setup-git-ci.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -49,4 +49,4 @@ jobs:
site-directory: 'site/'

- name: Publish schema
run: ./scripts/deploy-schema.sh
run: scripts/deploy-schema.sh
31 changes: 31 additions & 0 deletions .github/workflows/test-docs.yml
@@ -0,0 +1,31 @@
name: Test

on:
workflow_dispatch:
pull_request:
paths:
- 'site/**'
- 'yarn.lock'
- '**prettier**'

jobs:
build-site:
name: Build Site
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install Node dependencies
run: yarn --frozen-lockfile

- name: Lint
run: yarn prettierbase --check

- name: Build
run: yarn build:site
24 changes: 3 additions & 21 deletions .github/workflows/test.yml
@@ -1,10 +1,10 @@
name: Test

on:
push:
branches:
- next
workflow_dispatch:
pull_request:
paths-ignore:
- 'site/**'

jobs:
test:
Expand All @@ -31,24 +31,6 @@ jobs:
- name: Build
run: yarn build

build-site:
name: Build Site
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install Node dependencies
run: yarn --frozen-lockfile

- name: Build
run: yarn build:site

runtime-lint-coverage:
name: Runtime, Linting, and Coverage
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions scripts/check-and-commit-toc.sh
Expand Up @@ -3,9 +3,6 @@
set -euo pipefail

GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
git checkout $GIT_BRANCH

echo "On branch $GIT_BRANCH."

# Only push on human pull request branches. Exclude release, prerelease, and bot branches.
if [ "$GIT_BRANCH" != "stable" ] && [ "$GIT_BRANCH" != "next" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then
Expand Down
3 changes: 0 additions & 3 deletions scripts/check-and-commit.sh
Expand Up @@ -3,9 +3,6 @@
set -euo pipefail

GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
git checkout $GIT_BRANCH

echo "On branch $GIT_BRANCH."

# Only push on human pull request branches. Exclude release, prerelease, and bot branches.
if [ "$GIT_BRANCH" != "stable" ] && [ "$GIT_BRANCH" != "next" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then
Expand Down