-
Notifications
You must be signed in to change notification settings - Fork 33
chore: Migrate publishing to GHA, consolidate CI workflows #879
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
lucasmcdonald3
wants to merge
18
commits into
master
Choose a base branch
from
gha-publish
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6c71f61
m
131fded
m
fc95c8e
m
88d6359
m
1b99627
m
80016a0
m
c23f1bd
m
d9f322c
m
4b1d15a
m
b8fa035
m
b2db653
m
e8c6d92
m
6f7ace1
test published
43fb081
m
468d928
m
e980b4c
m
d2f1c05
m
10d46e4
Potential fix for code scanning alert no. 11: Workflow does not conta…
lucasmcdonald3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ | |
|
|
||
| jobs: | ||
| daily-ci-js-helpers: | ||
| uses: ./.github/workflows/ci-unit-tests.yaml | ||
| uses: ./.github/workflows/shared-ci.yml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Release | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version_bump: | ||
| required: false | ||
| description: '[Optional] Override semantic versioning with explict version (allowed values: "patch", "minor", "major", or explicit version)' | ||
| default: '' | ||
| dist_tag: | ||
| description: 'NPM distribution tag' | ||
| required: false | ||
| default: 'latest' | ||
| branch: | ||
| description: 'The branch to release from' | ||
| required: false | ||
| default: 'master' | ||
|
|
||
| env: | ||
| NODE_OPTIONS: "--max-old-space-size=4096" | ||
| NPM_CONFIG_UNSAFE_PERM: true | ||
|
|
||
| jobs: | ||
| pre-release-ci: | ||
| uses: ./.github/workflows/shared-ci.yml | ||
|
|
||
| # Once all tests have passed, run semantic versioning | ||
| version: | ||
| runs-on: ubuntu-latest | ||
| needs: [pre-release-ci] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Setup Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| - name: Configure git | ||
| env: | ||
| BRANCH: ${{ github.event.inputs.branch }} | ||
| run: | | ||
| git config --global user.name "aws-crypto-tools-ci-bot" | ||
| git config --global user.email "[email protected]" | ||
| git checkout $BRANCH | ||
|
|
||
| - name: Version packages and push | ||
| env: | ||
| VERSION_BUMP: ${{ github.event.inputs.version_bump }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Generate new version and CHANGELOG entry and push it | ||
| npx lerna version --conventional-commits --git-remote origin --yes ${VERSION_BUMP:+$VERSION_BUMP --force-publish} | ||
| # Log the commit for posterity | ||
| git log -n 1 | ||
|
|
||
| publish: | ||
| runs-on: ubuntu-latest | ||
| needs: [pre-release-ci, version] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| # Ensure npm 11.5.1 or later is installed | ||
| - name: Update npm | ||
| run: npm install -g npm@latest | ||
| - run: npm ci --unsafe-perm | ||
| - run: npm run build --if-present | ||
| - run: npx lerna publish from-package --yes --dist-tag ${{ github.event.inputs.dist_tag }} | ||
|
|
||
| # Once publishing is complete, validate that the published packages are useable | ||
| validate: | ||
| uses: ./.github/workflows/shared-ci.yml | ||
| needs: [publish] | ||
| with: | ||
| test-published-packages: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| # This workflow runs for every pull request | ||
| name: PR CI | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| pr-ci-js-helpers-test: | ||
| uses: ./.github/workflows/ci-unit-tests.yaml | ||
| uses: ./.github/workflows/shared-ci.yml | ||
| pr-ci-all-required: | ||
| if: always() | ||
| needs: | ||
| - pr-ci-js-helpers-test | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Verify all required jobs passed | ||
| uses: re-actors/alls-green@release/v1 | ||
| with: | ||
| jobs: ${{ toJSON(needs) }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Shared CI Tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| test-published-packages: | ||
| description: 'Test against published packages instead of checked out code' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
|
||
| env: | ||
| NODE_OPTIONS: "--max-old-space-size=4096" | ||
| NPM_CONFIG_UNSAFE_PERM: true | ||
|
|
||
| jobs: | ||
| ci-unit-tests: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| node: ["16.x", "18.x", "20.x"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js ${{ matrix.node }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| # `npm test` only works for local code, testing published packages requires setup | ||
| - name: Test local code | ||
| if: ${{ !inputs.test-published-packages }} | ||
| run: npm test | ||
|
|
||
| - name: Build (for source code testing) | ||
| if: ${{ !inputs.test-published-packages }} | ||
| run: npm run build | ||
|
|
||
| # Run vector tests for all CI runs (Ubuntu only) | ||
| # Verdaccio is only supported on Node.js v18 and higher | ||
| # Weird syntax issues on Windows prevent us from running these tests there | ||
| - name: Publish locally for vector tests (except Node.js 16) | ||
| if: ${{ !inputs.test-published-packages && matrix.node != '16.x' && matrix.os != 'windows-latest' }} | ||
| run: npm run verdaccio-publish | ||
|
|
||
| - name: Run vector tests (local packages) | ||
| if: ${{ !inputs.test-published-packages && matrix.node != '16.x' && matrix.os != 'windows-latest' }} | ||
| run: npm run verdaccio-verify-publish -- ci | ||
|
|
||
| # Run vector tests against published packages (release workflow validation, Ubuntu only) | ||
| - name: Run vector tests (published packages) | ||
| if: ${{ inputs.test-published-packages && matrix.node != '16.x' && matrix.os != 'windows-latest' }} | ||
| run: npm run verdaccio-verify-publish -- public |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.