-
Notifications
You must be signed in to change notification settings - Fork 91
test: add install tests for vs code extension VSCODE-703 #1188
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
tculig
wants to merge
28
commits into
main
Choose a base branch
from
VSCODE-703-add-install-tests-for-VSCode-extension
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.
Open
Changes from all commits
Commits
Show all changes
28 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 163d5bb
Merge remote-tracking branch 'origin/chore/gh-actions-reorg-for-insta…
tculig ecefe4d
Merge branch 'main' into VSCODE-703-add-install-tests-for-VSCode-exte…
tculig 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 15cebc0
Merge branch 'chore/gh-actions-reorg-for-install-tests' into VSCODE-7…
tculig be23da8
Update action.yaml
tculig 23677a8
Add verify step
tculig 0f103ef
Remove excessive commenting
tculig bc853ba
Return the vsix is readable check
tculig 8784223
add retry to avoid "HTTPError: Response code 503 (Service Unavailable)"
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 fc51c11
Merge branch 'chore/gh-actions-reorg-for-install-tests' into VSCODE-7…
tculig 6bce80a
Merge branch 'main' into VSCODE-703-add-install-tests-for-VSCode-exte…
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
172 changes: 172 additions & 0 deletions
172
.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,172 @@ | ||
| 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 | ||
| shell: bash | ||
| run: | | ||
| # Retry npm ci up to 3 times to handle transient network errors | ||
| for i in 1 2 3; do | ||
| pnpm install --frozen-lockfile && break || { | ||
| if [ $i -eq 3 ]; then | ||
| echo "pnpm install failed after 3 attempts" | ||
| exit 1 | ||
| fi | ||
| echo "pnpm install failed, retrying in 10 seconds... (attempt $i/3)" | ||
| sleep 10 | ||
| } | ||
| done | ||
|
|
||
| - 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: Prepare artifact upload | ||
| shell: bash | ||
| run: | | ||
| echo "Files to be uploaded:" | ||
| ls -lh *.vsix *.vsix.sig | ||
| echo "" | ||
| echo "VSIX checksum (SHA256):" | ||
| sha256sum *.vsix | ||
|
|
||
| - 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 | ||
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.
end of this file should match the new main:
vscode/.github/workflows/actions/test-and-build/action.yaml
Lines 122 to 158 in 6bce80a