From 213cd8ce0652d75b70f5199c894a8164ac25b271 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 09:58:46 -0400 Subject: [PATCH 1/6] ci: split scripts and refine triggers --- .github/workflows/check-toc.yml | 56 +++++++++++++++++++ .github/workflows/check.yml | 55 +++--------------- .github/workflows/publish-to-npm.yml | 2 + .github/workflows/release-docs-and-schema.yml | 6 +- .github/workflows/test-docs.yml | 29 ++++++++++ .github/workflows/test.yml | 23 +------- 6 files changed, 100 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/check-toc.yml create mode 100644 .github/workflows/test-docs.yml diff --git a/.github/workflows/check-toc.yml b/.github/workflows/check-toc.yml new file mode 100644 index 0000000000..d65b192441 --- /dev/null +++ b/.github/workflows/check-toc.yml @@ -0,0 +1,56 @@ +name: Check + +on: + workflow_dispatch: + push: + branches-ignore: + - stable + - next + paths: + - 'site/**' + - 'scripts/**' + pull_request: + +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 }} + + - 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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 90cee05c97..337874d556 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,9 +1,11 @@ name: Check on: + workflow_dispatch: push: - branches: - - '**' + branches-ignore: + - stable + pull_request: jobs: check: @@ -42,53 +44,10 @@ jobs: 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 diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index f45a04513f..8125066c5d 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -7,6 +7,8 @@ on: - 'dependabot/**' # documentation site should not trigger releases - 'gh-pages' + paths-ignore: + - 'site/**' jobs: publish: diff --git a/.github/workflows/release-docs-and-schema.yml b/.github/workflows/release-docs-and-schema.yml index 10e1be7247..cb8d96d4ae 100644 --- a/.github/workflows/release-docs-and-schema.yml +++ b/.github/workflows/release-docs-and-schema.yml @@ -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 }} @@ -40,7 +40,7 @@ jobs: GH_PAT: ${{ secrets.GH_PAT }} - name: Check NPM deployment - run: ./scripts/check-npm.sh + run: scripts/check-npm.sh - uses: actions/setup-node@v3 with: @@ -56,4 +56,4 @@ jobs: site-directory: 'site/' - name: Publish schema - run: ./scripts/deploy-schema.sh + run: scripts/deploy-schema.sh diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml new file mode 100644 index 0000000000..c12c11b187 --- /dev/null +++ b/.github/workflows/test-docs.yml @@ -0,0 +1,29 @@ +name: Test Docs + +on: + workflow_dispatch: + push: + branches-ignore: + - stable + paths-ignore: + - 'src/**' + pull_request: + +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: Build + run: yarn build:site diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c1f1946f9..dd52ed8b89 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,10 @@ name: Test on: + workflow_dispatch: push: - branches: - - next + branches-ignore: + - stable pull_request: jobs: @@ -31,24 +32,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 From 519cddd0bd58927563afc0286dfbdb79daedbd5f Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:09:25 -0400 Subject: [PATCH 2/6] ci: run on pr --- .github/workflows/check-toc.yml | 6 +----- .github/workflows/check.yml | 3 --- .github/workflows/test-docs.yml | 14 ++++++++------ .github/workflows/test.yml | 7 +++---- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check-toc.yml b/.github/workflows/check-toc.yml index d65b192441..35a27396bb 100644 --- a/.github/workflows/check-toc.yml +++ b/.github/workflows/check-toc.yml @@ -2,14 +2,10 @@ name: Check on: workflow_dispatch: - push: - branches-ignore: - - stable - - next + pull_request: paths: - 'site/**' - 'scripts/**' - pull_request: jobs: toc: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 337874d556..9bc65e1840 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,9 +2,6 @@ name: Check on: workflow_dispatch: - push: - branches-ignore: - - stable pull_request: jobs: diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index c12c11b187..a581ad046f 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -1,13 +1,12 @@ -name: Test Docs +name: Test on: workflow_dispatch: - push: - branches-ignore: - - stable - paths-ignore: - - 'src/**' pull_request: + paths: + - 'site/**' + - 'yarn.lock' + - '**prettier**' jobs: build-site: @@ -25,5 +24,8 @@ jobs: - name: Install Node dependencies run: yarn --frozen-lockfile + - name: Lint + run: yarn prettierbase --check + - name: Build run: yarn build:site diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd52ed8b89..bad02e35dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,13 +2,12 @@ name: Test on: workflow_dispatch: - push: - branches-ignore: - - stable pull_request: + paths-ignore: + - 'site/**' jobs: - test-matrix: + test: name: Node runs-on: ubuntu-latest From e852c2369d65b745ded509f43470444536b2edf1 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:56:19 -0400 Subject: [PATCH 3/6] Use original branch for check jobs --- .github/workflows/check-toc.yml | 1 + .github/workflows/check.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/check-toc.yml b/.github/workflows/check-toc.yml index 35a27396bb..21d4cb2630 100644 --- a/.github/workflows/check-toc.yml +++ b/.github/workflows/check-toc.yml @@ -17,6 +17,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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9bc65e1840..7e87bf3034 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,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 From f47ee66990409941d2ad8feaf97b272e23be8eb0 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:58:43 -0400 Subject: [PATCH 4/6] Manually trigger merge --- .github/workflows/merge-dependabot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/merge-dependabot.yml b/.github/workflows/merge-dependabot.yml index 4fb46f6c1c..631b708ab4 100644 --- a/.github/workflows/merge-dependabot.yml +++ b/.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 From 9b76cbe23c5b36a6e6125f5d72f2d273d01b0b85 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 11:01:42 -0400 Subject: [PATCH 5/6] use default refs --- .github/workflows/check.yml | 1 - scripts/check-and-commit-toc.sh | 5 ----- scripts/check-and-commit.sh | 5 ----- 3 files changed, 11 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7e87bf3034..93af350d60 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -35,7 +35,6 @@ jobs: sudo mv parallel sem /usr/local/bin - name: Format - if: github.ref != 'refs/heads/next' run: yarn format - name: Build Schema diff --git a/scripts/check-and-commit-toc.sh b/scripts/check-and-commit-toc.sh index 17a4fe988a..4d4ea63dbf 100755 --- a/scripts/check-and-commit-toc.sh +++ b/scripts/check-and-commit-toc.sh @@ -2,11 +2,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 PUSH_BRANCH=true diff --git a/scripts/check-and-commit.sh b/scripts/check-and-commit.sh index 2212938cd4..9e3f599c2e 100755 --- a/scripts/check-and-commit.sh +++ b/scripts/check-and-commit.sh @@ -2,11 +2,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 PUSH_BRANCH=true From 5b3a942ef7d66ff8ce2f20e47b44610735a25f3f Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 11:08:23 -0400 Subject: [PATCH 6/6] Add back branch --- scripts/check-and-commit-toc.sh | 2 ++ scripts/check-and-commit.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/check-and-commit-toc.sh b/scripts/check-and-commit-toc.sh index 4d4ea63dbf..f853cb8a69 100755 --- a/scripts/check-and-commit-toc.sh +++ b/scripts/check-and-commit-toc.sh @@ -2,6 +2,8 @@ set -euo pipefail +GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + # Only push on human pull request branches. Exclude release, prerelease, and bot branches. if [ "$GIT_BRANCH" != "stable" ] && [ "$GIT_BRANCH" != "next" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then PUSH_BRANCH=true diff --git a/scripts/check-and-commit.sh b/scripts/check-and-commit.sh index 9e3f599c2e..8f2e33b213 100755 --- a/scripts/check-and-commit.sh +++ b/scripts/check-and-commit.sh @@ -2,6 +2,8 @@ set -euo pipefail +GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + # Only push on human pull request branches. Exclude release, prerelease, and bot branches. if [ "$GIT_BRANCH" != "stable" ] && [ "$GIT_BRANCH" != "next" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then PUSH_BRANCH=true