-
Notifications
You must be signed in to change notification settings - Fork 91
chore: reorganise GA to check and build once and run tests with matrix strategy VSCODE-703 #1133
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
himanshusinghs
wants to merge
18
commits into
main
Choose a base branch
from
chore/gh-actions-reorg-for-install-tests
base: main
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.
+393
−33
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ee29149
fix: snyk will now scan vscode project
himanshusinghs d33dce8
chore: use npm hooks for backup and restore
himanshusinghs 5f98853
chore: fix the method call
himanshusinghs 95accce
chore: reorganise GA to check and build once
himanshusinghs 73b1244
chore: add missing actions
himanshusinghs 5238fda
chore: debug snyk tests
himanshusinghs de36329
chore: compile before the rest
himanshusinghs 9888349
Merge branch 'main' into chore/gh-actions-reorg-for-install-tests
tculig 26d10db
Add MDB_IS_TEST in new actions script
tculig 4942b0d
Add status-check for test and build flows
tculig 24417e8
Use correct action name
tculig 15d18f7
Fix action names
tculig 8b4d386
Move node.js setup to action files
tculig 7e9a749
Upload package-lock.json as well when doing upload-artifact
tculig 1ffad4b
Merge branch 'main' into chore/gh-actions-reorg-for-install-tests
tculig 2bb9629
update to use pnpm
tculig f469c4a
Merge branch 'main' into chore/gh-actions-reorg-for-install-tests
tculig ef1e5dc
Merge branch 'main' into chore/gh-actions-reorg-for-install-tests
tculig 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
152 changes: 152 additions & 0 deletions
152
.github/workflows/actions/build-and-package/action.yaml
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,152 @@ | ||
| name: Check Build and Package | ||
| description: Run checks, build and package VSIX, sign it, and run security scans (Ubuntu only) | ||
| inputs: | ||
| SEGMENT_KEY: | ||
| description: Segment analytics key | ||
| required: true | ||
| ARTIFACTORY_HOST: | ||
| description: Artifactory host for signing | ||
| required: true | ||
| ARTIFACTORY_PASSWORD: | ||
| description: Artifactory password for signing | ||
| required: true | ||
| ARTIFACTORY_USERNAME: | ||
| description: Artifactory username for signing | ||
| required: true | ||
| GARASIGN_PASSWORD: | ||
| description: Garasign password for signing | ||
| required: true | ||
| GARASIGN_USERNAME: | ||
| description: Garasign username for signing | ||
| required: true | ||
| SNYK_TOKEN: | ||
| description: Snyk token for security scanning | ||
| required: true | ||
| JIRA_API_TOKEN: | ||
| description: Jira API token for vulnerability tickets | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Setup Node.js Environment | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22.15.1 | ||
| cache: pnpm | ||
|
|
||
| - name: Install Deps Ubuntu | ||
| run: sudo apt-get update -y && sudo apt-get -y install libkrb5-dev libsecret-1-dev net-tools libstdc++6 gnome-keyring | ||
| shell: bash | ||
|
|
||
| # Default Python (3.12) doesn't have support for distutils because of | ||
| # which the dep install fails constantly on macos | ||
| # https://github.com/nodejs/node-gyp/issues/2869 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Run node-gyp bug workaround script | ||
| run: | | ||
| curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh | ||
| shell: bash | ||
|
|
||
| - name: Set SEGMENT_KEY | ||
| env: | ||
| SEGMENT_KEY: ${{ inputs.SEGMENT_KEY }} | ||
| run: | | ||
| echo "SEGMENT_KEY=${SEGMENT_KEY}" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| - name: Validate SEGMENT_KEY | ||
| run: | | ||
| if [ -z "${SEGMENT_KEY}" ]; then | ||
| echo "SEGMENT_KEY is not set or is empty" | ||
| exit 1 | ||
| fi | ||
| shell: bash | ||
|
|
||
| - name: Install Dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| shell: bash | ||
|
|
||
| - name: Compile | ||
| run: pnpm run compile | ||
| shell: bash | ||
|
|
||
| - name: Run Checks | ||
| run: pnpm run check | ||
| shell: bash | ||
|
|
||
| - name: Build .vsix | ||
| env: | ||
| NODE_OPTIONS: "--require ./scripts/no-npm-list-fail.js --max_old_space_size=4096" | ||
| # NOTE: --githubBranch is "The GitHub branch used to infer relative links in README.md." | ||
| run: | | ||
| pnpm exec vsce package --githubBranch main | ||
| shell: bash | ||
|
|
||
| - name: Check .vsix filesize | ||
| run: pnpm run check-vsix-size | ||
| shell: bash | ||
|
|
||
| - name: Sign .vsix | ||
| env: | ||
| ARTIFACTORY_PASSWORD: ${{ inputs.ARTIFACTORY_PASSWORD }} | ||
| ARTIFACTORY_USERNAME: ${{ inputs.ARTIFACTORY_USERNAME }} | ||
| GARASIGN_PASSWORD: ${{ inputs.GARASIGN_PASSWORD }} | ||
| GARASIGN_USERNAME: ${{ inputs.GARASIGN_USERNAME }} | ||
| run: | | ||
| set -e | ||
| FILE_TO_SIGN=$(find . -maxdepth 1 -name '*.vsix' -print -quit) | ||
| if [ -z "$FILE_TO_SIGN" ]; then | ||
| echo "Error: No .vsix file found in the current directory." >&2 | ||
| exit 1 | ||
| fi | ||
| node scripts/sign-vsix.js "${FILE_TO_SIGN}" | ||
| ls *.vsix.sig | ||
| shell: bash | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: VSIX Package | ||
| path: | | ||
| *.vsix | ||
| *.vsix.sig | ||
|
|
||
| - name: Run Snyk Test | ||
| shell: bash | ||
| env: | ||
| SNYK_TOKEN: ${{ inputs.SNYK_TOKEN }} | ||
| run: | | ||
| pnpm run snyk-test | ||
|
|
||
| - name: Create Jira Tickets | ||
| if: > | ||
| ( | ||
| github.event_name == 'push' && github.ref == 'refs/heads/main' || | ||
| github.event_name == 'workflow_dispatch' || | ||
| github.event_name == 'schedule' | ||
| ) | ||
| shell: bash | ||
| env: | ||
| JIRA_API_TOKEN: ${{ inputs.JIRA_API_TOKEN }} | ||
| JIRA_BASE_URL: "https://jira.mongodb.org" | ||
| JIRA_PROJECT: "VSCODE" | ||
| JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]" | ||
| run: | | ||
| pnpm run create-vulnerability-tickets > /dev/null | ||
|
|
||
| - name: Generate Vulnerability Report (Fail on >= High) | ||
| continue-on-error: ${{ github.event_name == 'pull_request' }} | ||
| shell: bash | ||
| run: | | ||
| # The standard output is suppressed since Github Actions logs are | ||
| # available for everyone with read access to the repo, which is everyone that is | ||
| # logged in for public repos. | ||
| # This command is only here to fail on failures for `main` and tags. | ||
| pnpm run generate-vulnerability-report > /dev/null | ||
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,87 @@ | ||
| name: Run Tests | ||
| description: Run checks, tests, and install tests on the VSIX package | ||
| inputs: | ||
| SEGMENT_KEY: | ||
| description: Segment analytics key | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Setup Node.js Environment | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22.15.1 | ||
| cache: pnpm | ||
|
|
||
| - name: Install Deps Ubuntu | ||
| if: ${{ runner.os == 'Linux' }} | ||
| run: sudo apt-get update -y && sudo apt-get -y install libkrb5-dev libsecret-1-dev net-tools libstdc++6 gnome-keyring | ||
| shell: bash | ||
|
|
||
| # Default Python (3.12) doesn't have support for distutils because of | ||
| # which the dep install fails constantly on macos | ||
| # https://github.com/nodejs/node-gyp/issues/2869 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Run node-gyp bug workaround script | ||
| run: | | ||
| curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh | ||
| shell: bash | ||
|
|
||
| - name: Set SEGMENT_KEY | ||
| env: | ||
| SEGMENT_KEY: ${{ inputs.SEGMENT_KEY }} | ||
| run: | | ||
| echo "SEGMENT_KEY=${SEGMENT_KEY}" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| - name: Validate SEGMENT_KEY | ||
| run: | | ||
| if [ -z "${SEGMENT_KEY}" ]; then | ||
| echo "SEGMENT_KEY is not set or is empty" | ||
| exit 1 | ||
| fi | ||
| shell: bash | ||
|
|
||
| - name: Install Dependencies | ||
| shell: bash | ||
| run: | | ||
| pnpm install --frozen-lockfile | ||
|
|
||
| - name: Download VSIX artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: VSIX Package | ||
|
|
||
| - name: Run Tests | ||
| env: | ||
| NODE_OPTIONS: "--max_old_space_size=4096" | ||
| MDB_IS_TEST: "true" | ||
| run: | | ||
| pnpm run test | ||
| shell: bash | ||
|
|
||
| - name: Install VSIX and Test | ||
| shell: bash | ||
| run: | | ||
| # Find the VSIX file | ||
| VSIX_FILE=$(find . -maxdepth 1 -name '*.vsix' -print -quit) | ||
| if [ -z "$VSIX_FILE" ]; then | ||
| echo "Error: No .vsix file found" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found VSIX file: $VSIX_FILE" | ||
|
|
||
| # For now, just verify the file exists and is readable | ||
| # Next, this will include actual VS Code installation tests | ||
| if [ ! -r "$VSIX_FILE" ]; then | ||
| echo "Error: VSIX file is not readable" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "VSIX file validation passed" | ||
| ls -la "$VSIX_FILE" |
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.
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.
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.
this is broken right now, I found out the hard way just now #1196