-
Notifications
You must be signed in to change notification settings - Fork 65
chore: Migrate CodeBuild release to GHA (without publishing step) #1614
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
19
commits into
master
Choose a base branch
from
release-gha
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.
+185
−1
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
72227f1
m
02c7123
m
7ca039a
m
365996b
m
df6b270
m
e6c405e
m
5b998e3
m
60f39e3
m
baf3332
m
628f323
m
d4c6696
m
39efcd5
m
b8599e5
m
fd51dd2
m
9ac58d2
m
8e7815a
m
7c0f63c
m
998c005
m
cdd94f2
m
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
There are no files selected for viewing
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,301 @@ | ||
| name: Release | ||
| permissions: | ||
| contents: read | ||
|
|
||
| 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: | ||
| compliance: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 18 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| - name: Run compliance checks | ||
| run: | | ||
| npm run lint | ||
| npm run test_conditions | ||
|
|
||
| test-nodejs20: | ||
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies and build | ||
| run: | | ||
| npm ci --unsafe-perm | ||
| npm run build | ||
|
|
||
| - name: Run Node.js tests | ||
| run: npm run coverage-node | ||
|
|
||
| test-browser18: | ||
seebees marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 18 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies and build | ||
| run: | | ||
| npm ci --unsafe-perm | ||
| npm run build | ||
|
|
||
| - name: Run browser tests | ||
| run: npm run coverage-browser | ||
|
|
||
| test-vectors-nodejs20: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies and build | ||
| run: | | ||
| npm ci --unsafe-perm | ||
| npm run build | ||
|
|
||
| - name: Run integration tests with local publish | ||
| run: | | ||
| npm run verdaccio-publish | ||
| npm run verdaccio-node-decrypt | ||
| npm run verdaccio-node-encrypt | ||
|
|
||
| test-vectors-browser18: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 18 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies and build | ||
| run: | | ||
| npm ci --unsafe-perm | ||
| npm run build | ||
|
|
||
| - name: Run integration tests with local publish | ||
| run: | | ||
| npm run verdaccio-publish | ||
| npm run verdaccio-browser-decrypt | ||
| npm run verdaccio-browser-encrypt | ||
|
|
||
| # Once all tests have passed, run semantic versioning | ||
| version: | ||
| runs-on: ubuntu-latest | ||
| needs: [compliance, test-nodejs20, test-browser18, test-vectors-nodejs20, test-vectors-browser18] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 16 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 16?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what the CodeBuild uses today |
||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '16' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| - name: Configure git | ||
| env: | ||
| BRANCH: ${{ github.event.inputs.branch }} | ||
| VERSION_BUMP: ${{ github.event.inputs.version_bump }} | ||
| run: | | ||
| git config --global user.name "aws-crypto-tools-ci-bot" | ||
| git config --global user.email "[email protected]" | ||
| git checkout $BRANCH | ||
|
|
||
| - name: Version packages (dry run - no push) | ||
| 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 | ||
|
|
||
| # Once semantic versioning has run and bumped versions, publish to npm | ||
| # TODO: Publish step that doesn't use OTP but instead follows | ||
| # https://docs.npmjs.com/trusted-publishers | ||
|
|
||
| # Once publishing is complete, validate that the published packages are useable | ||
| validate-nodejs: | ||
| runs-on: ubuntu-latest | ||
| # TODO: Uncomment when adding publish step | ||
| # needs: [publish] | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 20 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| - name: Validate published packages - Node.js | ||
| run: | | ||
| npm run verdaccio-node-decrypt | ||
| npm run verdaccio-node-encrypt | ||
|
|
||
| validate-browser: | ||
| runs-on: ubuntu-latest | ||
| # TODO: Uncomment when adding publish step | ||
| # needs: [publish] | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js 18 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
|
|
||
| - name: Configure AWS Credentials for Tests | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
| role-session-name: JavaScriptTests | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --unsafe-perm | ||
|
|
||
| - name: Validate published packages - Browser | ||
| # This will fail until the publish step is run for the first time. | ||
| # A dependency change broke the browser tests. | ||
| # Commit fb10180dfb451ff5359ebc703c58eaf5393971ac fixes this. | ||
| # The first publish step for v4.2.2+ should make this pass. | ||
| # TODO: Remove this comment block after first successful publish of v4.2.2+. | ||
| run: | | ||
| npm run verdaccio-browser-decrypt | ||
| npm run verdaccio-browser-encrypt | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to come first? Can we break this up maybe? To have the publishing things come first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need some validations to come first: