Skip to content

Commit 73b1244

Browse files
chore: add missing actions
1 parent 95accce commit 73b1244

File tree

2 files changed

+220
-0
lines changed

2 files changed

+220
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Check Build and Package
2+
description: Run checks, build and package VSIX, sign it, and run security scans (Ubuntu only)
3+
inputs:
4+
SEGMENT_KEY:
5+
description: Segment analytics key
6+
required: true
7+
ARTIFACTORY_HOST:
8+
description: Artifactory host for signing
9+
required: true
10+
ARTIFACTORY_PASSWORD:
11+
description: Artifactory password for signing
12+
required: true
13+
ARTIFACTORY_USERNAME:
14+
description: Artifactory username for signing
15+
required: true
16+
GARASIGN_PASSWORD:
17+
description: Garasign password for signing
18+
required: true
19+
GARASIGN_USERNAME:
20+
description: Garasign username for signing
21+
required: true
22+
SNYK_TOKEN:
23+
description: Snyk token for security scanning
24+
required: true
25+
JIRA_API_TOKEN:
26+
description: Jira API token for vulnerability tickets
27+
required: true
28+
29+
runs:
30+
using: "composite"
31+
steps:
32+
- name: Install Deps Ubuntu
33+
run: sudo apt-get update -y && sudo apt-get -y install libkrb5-dev libsecret-1-dev net-tools libstdc++6 gnome-keyring
34+
shell: bash
35+
36+
# Default Python (3.12) doesn't have support for distutils because of
37+
# which the dep install fails constantly on macos
38+
# https://github.com/nodejs/node-gyp/issues/2869
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.11"
42+
43+
- name: Run node-gyp bug workaround script
44+
run: |
45+
curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh
46+
shell: bash
47+
48+
- name: Set SEGMENT_KEY
49+
env:
50+
SEGMENT_KEY: ${{ inputs.SEGMENT_KEY }}
51+
run: |
52+
echo "SEGMENT_KEY=${SEGMENT_KEY}" >> $GITHUB_ENV
53+
shell: bash
54+
55+
- name: Validate SEGMENT_KEY
56+
run: |
57+
if [ -z "${SEGMENT_KEY}" ]; then
58+
echo "SEGMENT_KEY is not set or is empty"
59+
exit 1
60+
fi
61+
shell: bash
62+
63+
- name: Install Dependencies
64+
shell: bash
65+
run: |
66+
npm ci --omit=optional
67+
68+
- name: Run Checks
69+
run: npm run check
70+
shell: bash
71+
72+
- name: Build .vsix
73+
env:
74+
NODE_OPTIONS: "--require ./scripts/no-npm-list-fail.js --max_old_space_size=4096"
75+
# NOTE: --githubBranch is "The GitHub branch used to infer relative links in README.md."
76+
run: |
77+
npx vsce package --githubBranch main
78+
shell: bash
79+
80+
- name: Check .vsix filesize
81+
run: npm run check-vsix-size
82+
shell: bash
83+
84+
- name: Sign .vsix
85+
env:
86+
ARTIFACTORY_PASSWORD: ${{ inputs.ARTIFACTORY_PASSWORD }}
87+
ARTIFACTORY_USERNAME: ${{ inputs.ARTIFACTORY_USERNAME }}
88+
GARASIGN_PASSWORD: ${{ inputs.GARASIGN_PASSWORD }}
89+
GARASIGN_USERNAME: ${{ inputs.GARASIGN_USERNAME }}
90+
run: |
91+
set -e
92+
FILE_TO_SIGN=$(find . -maxdepth 1 -name '*.vsix' -print -quit)
93+
if [ -z "$FILE_TO_SIGN" ]; then
94+
echo "Error: No .vsix file found in the current directory." >&2
95+
exit 1
96+
fi
97+
node scripts/sign-vsix.js "${FILE_TO_SIGN}"
98+
ls *.vsix.sig
99+
shell: bash
100+
101+
- name: Upload artifacts
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: VSIX Package
105+
path: |
106+
*.vsix
107+
*.vsix.sig
108+
109+
- name: Run Snyk Test
110+
shell: bash
111+
env:
112+
SNYK_TOKEN: ${{ inputs.SNYK_TOKEN }}
113+
run: |
114+
npm run snyk-test > /dev/null 2>&1
115+
116+
- name: Create Jira Tickets
117+
if: >
118+
(
119+
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
120+
github.event_name == 'workflow_dispatch' ||
121+
github.event_name == 'schedule'
122+
)
123+
shell: bash
124+
env:
125+
JIRA_API_TOKEN: ${{ inputs.JIRA_API_TOKEN }}
126+
JIRA_BASE_URL: "https://jira.mongodb.org"
127+
JIRA_PROJECT: "VSCODE"
128+
JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]"
129+
run: |
130+
npm run create-vulnerability-tickets > /dev/null
131+
132+
- name: Generate Vulnerability Report (Fail on >= High)
133+
continue-on-error: ${{ github.event_name == 'pull_request' }}
134+
shell: bash
135+
run: |
136+
# The standard output is suppressed since Github Actions logs are
137+
# available for everyone with read access to the repo, which is everyone that is
138+
# logged in for public repos.
139+
# This command is only here to fail on failures for `main` and tags.
140+
npm run generate-vulnerability-report > /dev/null
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Run Tests
2+
description: Run checks, tests, and install tests on the VSIX package
3+
inputs:
4+
SEGMENT_KEY:
5+
description: Segment analytics key
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Install Deps Ubuntu
12+
if: ${{ runner.os == 'Linux' }}
13+
run: sudo apt-get update -y && sudo apt-get -y install libkrb5-dev libsecret-1-dev net-tools libstdc++6 gnome-keyring
14+
shell: bash
15+
16+
# Default Python (3.12) doesn't have support for distutils because of
17+
# which the dep install fails constantly on macos
18+
# https://github.com/nodejs/node-gyp/issues/2869
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Run node-gyp bug workaround script
24+
run: |
25+
curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh
26+
shell: bash
27+
28+
- name: Set SEGMENT_KEY
29+
env:
30+
SEGMENT_KEY: ${{ inputs.SEGMENT_KEY }}
31+
run: |
32+
echo "SEGMENT_KEY=${SEGMENT_KEY}" >> $GITHUB_ENV
33+
shell: bash
34+
35+
- name: Validate SEGMENT_KEY
36+
run: |
37+
if [ -z "${SEGMENT_KEY}" ]; then
38+
echo "SEGMENT_KEY is not set or is empty"
39+
exit 1
40+
fi
41+
shell: bash
42+
43+
- name: Install Dependencies
44+
shell: bash
45+
run: |
46+
npm ci --omit=optional
47+
48+
- name: Download VSIX artifact
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: VSIX Package
52+
53+
- name: Run Tests
54+
env:
55+
NODE_OPTIONS: "--max_old_space_size=4096"
56+
run: |
57+
npm run test
58+
shell: bash
59+
60+
- name: Install VSIX and Test
61+
shell: bash
62+
run: |
63+
# Find the VSIX file
64+
VSIX_FILE=$(find . -maxdepth 1 -name '*.vsix' -print -quit)
65+
if [ -z "$VSIX_FILE" ]; then
66+
echo "Error: No .vsix file found" >&2
67+
exit 1
68+
fi
69+
70+
echo "Found VSIX file: $VSIX_FILE"
71+
72+
# For now, just verify the file exists and is readable
73+
# Next, this will include actual VS Code installation tests
74+
if [ ! -r "$VSIX_FILE" ]; then
75+
echo "Error: VSIX file is not readable" >&2
76+
exit 1
77+
fi
78+
79+
echo "VSIX file validation passed"
80+
ls -la "$VSIX_FILE"

0 commit comments

Comments
 (0)