Skip to content

Bundle Actions using esbuild #3054

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fee3663
Bundle Actions using esbuild
henrymercer Aug 21, 2025
67d4718
Compile sources to separate directory for tests
henrymercer Aug 21, 2025
8b7a4ec
Remove `node_modules` directory
henrymercer Aug 21, 2025
88d8b86
Check in compiled files
henrymercer Aug 21, 2025
6d34e4e
Use "Rebuild" workflow instead of "Update dependencies"
henrymercer Aug 20, 2025
31ee7f5
Install dependencies in PR checks
henrymercer Aug 21, 2025
06f83b7
Run more checks on `push`
henrymercer Aug 21, 2025
3edad3e
Combine basic jobs to reduce Actions usage
henrymercer Aug 21, 2025
a2df83b
Cache npm dependencies
henrymercer Aug 21, 2025
d8905c2
Don't run linter in CI on Windows
henrymercer Aug 21, 2025
f04e228
Merge branch 'main' into henrymercer/bundle
henrymercer Aug 21, 2025
3e725de
Copy `defaults.json` to `lib`
henrymercer Aug 21, 2025
f8c0d73
Install dependencies in code scanning config test
henrymercer Aug 21, 2025
879c788
Install npm dependencies where necessary in generated workflows
henrymercer Aug 21, 2025
88f7d3d
Install dependencies in query filters tests
henrymercer Aug 21, 2025
36468ba
Delete expected queries runs check
henrymercer Aug 21, 2025
786d3aa
Remove unused import in build script
henrymercer Aug 21, 2025
4da503e
Use `npm ci` in CI
henrymercer Aug 21, 2025
8a3bfe6
Transpile separately in both build and test steps
henrymercer Aug 22, 2025
e274fb8
Implement clean and copy as custom plugins
henrymercer Aug 22, 2025
ca5a69b
Specify esbuild target
henrymercer Aug 22, 2025
d7c1640
Avoid automatic semicolon insertion
henrymercer Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: weekly
labels:
- Update dependencies
- Rebuild
# Ignore incompatible dependency updates
ignore:
# There is a type incompatibility issue between v0.0.9 and our other dependencies.
Expand Down
8 changes: 4 additions & 4 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def open_pr(
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')

if not is_primary_release:
body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
body.append(' - [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.')

body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')
body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
Expand All @@ -108,7 +108,7 @@ def open_pr(
body.append(' - [ ] Merge all backport PRs to older release branches, that will automatically be created once this PR is merged.')

title = f'Merge {source_branch} into {target_branch}'
labels = ['Update dependencies'] if not is_primary_release else []
labels = ['Rebuild'] if not is_primary_release else []

# Create the pull request
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
Expand Down Expand Up @@ -389,7 +389,7 @@ def main():

# Migrate the package version number from a vLatest version number to a vOlder version number
print(f'Setting version number to {version} in package.json')
replace_version_package_json(get_current_version(), version) # We rely on the `Update dependencies` workflow to update package-lock.json
replace_version_package_json(get_current_version(), version) # We rely on the `Rebuild` workflow to update package-lock.json
run_git('add', 'package.json')

# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/__config-input.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .github/workflows/__packaging-config-inputs-js.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .github/workflows/__packaging-config-js.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .github/workflows/__packaging-inputs-js.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .github/workflows/codescanning-config-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/expected-queries-runs.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/post-release-mergeback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# tag
# 2. Updates the `vN` tag to refer to this merge commit.
# 3. Iff vN == vLatest, merges any changes from the release back into the main branch.
# Typically, this is two commits – one to update the version number and one to update dependencies.
# Typically, this is two commits – one to update the version number and one to rebuild.
name: Tag release and merge back

on:
Expand Down Expand Up @@ -138,8 +138,8 @@ jobs:

Please do the following:

- [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.
- [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.
- [ ] Remove and re-add the "Rebuild" label to the PR to trigger just this workflow.
- [ ] Wait for the "Rebuild" workflow to push a commit updating the distribution files.
- [ ] Mark the PR as ready for review to trigger the full set of PR checks.
- [ ] Approve and merge the PR. When merging the PR, make sure "Create a merge commit" is
selected rather than "Squash and merge" or "Rebase and merge".
Expand All @@ -162,7 +162,7 @@ jobs:
--head "${NEW_BRANCH}" \
--base "${BASE_BRANCH}" \
--title "${pr_title}" \
--label "Update dependencies" \
--label "Rebuild" \
--body "${pr_body}" \
--assignee "${GITHUB_ACTOR}" \
--draft
Expand Down
99 changes: 34 additions & 65 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,58 @@ on:
workflow_dispatch:

jobs:
check-js:
name: Check JS
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
security-events: write # needed to upload ESLint results

unit-tests:
name: Unit Tests
strategy:
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Lint
id: lint
run: npm run-script lint-ci

- name: Upload sarif
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: eslint.sarif
category: eslint

- name: Check generated JS
run: .github/workflows/script/check-js.sh

check-node-modules:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check modules up to date
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
permissions:
contents: read
runs-on: macos-latest
security-events: write # needed to upload ESLint results
runs-on: ${{ matrix.os }}
timeout-minutes: 45

steps:
- uses: actions/checkout@v5
- name: Check node modules up to date
run: .github/workflows/script/check-node-modules.sh

check-file-contents:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Check file contents
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 45

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

# Ensure the generated PR check workflows are up to date.
- name: Install dependencies
run: |
# Use the system Bash shell to ensure we can run commands like `npm ci`
# that are not available in the default shell on Windows.
npm config set script-shell bash
npm ci

- name: Verify compiled JS up to date
run: .github/workflows/script/check-js.sh

- name: Verify PR checks up to date
run: .github/workflows/script/verify-pr-checks.sh

npm-test:
if: github.event_name != 'push' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/v')
name: Unit Test
needs: [check-js, check-node-modules]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
permissions:
contents: read
runs-on: ${{ matrix.os }}
timeout-minutes: 45
- name: Run unit tests
run: npm test

steps:
- uses: actions/checkout@v5
- name: npm test
run: |
# Run any commands referenced in package.json using Bash, otherwise
# we won't be able to find them on Windows.
npm config set script-shell bash
npm test
- name: Lint
if: matrix.os != 'windows-latest'
run: npm run lint-ci

- name: Upload sarif
uses: github/codeql-action/upload-sarif@v3
if: matrix.os == 'ubuntu-latest'
with:
sarif_file: eslint.sarif
category: eslint

check-node-version:
if: github.event.pull_request
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/query-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm

- name: Install dependencies
run: npm ci

- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Compile TypeScript
run: |
npm install
npm ci
npm run lint -- --fix
npm run build

Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/script/check-node-modules.sh

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/script/update-node-modules.sh

This file was deleted.

Loading
Loading