Skip to content

Commit cb72920

Browse files
chore: reorganise GA to check and build once
Earlier we were running check, build and tests on each OS in our matrix which did not allow us to test whether a build on ubuntu would work fine on Windows / MacOS or not. With this commit we are re-organising to check and build once on ubuntu and use the final artifact later in the test job to run tests against. Accordingly the test-and-build-from-fork and draft-release workflows have been modified to adapt the same change.
1 parent 44a7e24 commit cb72920

File tree

3 files changed

+166
-40
lines changed

3 files changed

+166
-40
lines changed

.github/workflows/draft-release.yaml

Lines changed: 94 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1+
# Run manually to prepare a draft release for the next version of the extension.
2+
# The workflow will create a draft github release where the .vsix can be
3+
# downloaded and manually tested before publishing. To release the version,
4+
# publish the draft release, which will trigger the publish-release workflow.
15
name: Draft release
26

37
on:
48
workflow_dispatch:
59
inputs:
610
versionBump:
7-
description: 'Version bump'
11+
description: "Version bump"
812
type: choice
913
required: true
10-
default: 'patch'
14+
default: "patch"
1115
options:
12-
- patch
13-
- minor
14-
- major
15-
- exact-version
16+
- patch
17+
- minor
18+
- major
19+
- exact-version
1620

1721
exactVersion:
1822
description: 'Exact version: (Only effective selecting "exact-version" as version bump)'
1923
required: false
2024

21-
description: |
22-
Run manually to prepare a draft release for the next version of the extension. The workflow will create a draft
23-
github release where the .vsix can be downloaded and manually tested before publishing. To release the version,
24-
publish the draft release, which will trigger the publish-release workflow.
25-
2625
permissions:
2726
contents: write
2827

2928
jobs:
3029
prepare-release:
3130
runs-on: ubuntu-latest
31+
outputs:
32+
release-tag: ${{ steps.set-tag.outputs.release-tag }}
3233
steps:
3334
- name: Checkout
3435
uses: actions/checkout@v4
@@ -85,8 +86,40 @@ jobs:
8586
exit 1
8687
fi
8788
88-
- name: Run tests and build
89-
uses: ./.github/workflows/actions/test-and-build
89+
- name: Set release tag output
90+
id: set-tag
91+
run: echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
92+
93+
- name: Upload updated package.json
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: updated-package-json
97+
path: package.json
98+
99+
build-and-package:
100+
name: Check, Build and Package
101+
runs-on: ubuntu-latest
102+
needs: prepare-release
103+
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
with:
108+
fetch-depth: 0
109+
110+
- name: Download updated package.json
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: updated-package-json
114+
115+
- name: Setup Node.js Environment
116+
uses: actions/setup-node@v4
117+
with:
118+
node-version: 22.15.1
119+
cache: npm
120+
121+
- name: Check, build and package
122+
uses: ./.github/workflows/actions/build-and-package
90123
with:
91124
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_PROD }}
92125
ARTIFACTORY_HOST: ${{ secrets.ARTIFACTORY_HOST }}
@@ -97,9 +130,57 @@ jobs:
97130
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
98131
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
99132

133+
test:
134+
name: Test
135+
needs: build-and-package
136+
137+
strategy:
138+
matrix:
139+
os: [ubuntu-latest, windows-latest, macos-latest]
140+
fail-fast: false
141+
142+
runs-on: ${{ matrix.os }}
143+
144+
steps:
145+
- name: Checkout
146+
uses: actions/checkout@v4
147+
with:
148+
fetch-depth: 0
149+
150+
- name: Download updated package.json
151+
uses: actions/download-artifact@v4
152+
with:
153+
name: updated-package-json
154+
155+
- name: Setup Node.js Environment
156+
uses: actions/setup-node@v4
157+
with:
158+
node-version: 22.15.1
159+
cache: npm
160+
161+
- name: Run tests
162+
uses: ./.github/workflows/actions/run-tests
163+
with:
164+
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_PROD }}
165+
166+
create-draft-release:
167+
name: Create Draft Release
168+
runs-on: ubuntu-latest
169+
needs: [prepare-release, test]
170+
171+
steps:
172+
- name: Checkout
173+
uses: actions/checkout@v4
174+
175+
- name: Download VSIX artifact
176+
uses: actions/download-artifact@v4
177+
with:
178+
name: VSIX Package
179+
100180
- name: Create Draft Release
101181
run: |
102182
set -e
183+
RELEASE_TAG="${{ needs.prepare-release.outputs.release-tag }}"
103184
echo Creating draft release for: "${RELEASE_TAG}"
104185
ls *.vsix
105186
ls *.vsix.sig
@@ -114,4 +195,3 @@ jobs:
114195
shell: bash
115196
env:
116197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117-

.github/workflows/test-and-build-from-fork.yaml

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,40 @@ permissions:
88
pull-requests: write
99

1010
jobs:
11-
test-and-build:
12-
name: Test and Build
11+
build-and-package:
12+
name: Check, Build and Package
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.full_name != github.repository
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
ref: ${{github.event.pull_request.head.ref}}
22+
repository: ${{github.event.pull_request.head.repo.full_name}}
23+
24+
- name: Setup Node.js Environment
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 22.15.1
28+
cache: npm
29+
30+
- name: Check, build and package
31+
uses: ./.github/workflows/actions/build-and-package
32+
with:
33+
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_DEV }}
34+
ARTIFACTORY_HOST: ${{ secrets.ARTIFACTORY_HOST }}
35+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
36+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
37+
GARASIGN_PASSWORD: ${{ secrets.GARASIGN_PASSWORD }}
38+
GARASIGN_USERNAME: ${{ secrets.GARASIGN_USERNAME }}
39+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
40+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
41+
42+
test:
43+
name: Test
44+
needs: build-and-package
1345
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.full_name != github.repository
1446

1547
strategy:
@@ -33,25 +65,16 @@ jobs:
3365
node-version: 22.15.1
3466
cache: npm
3567

36-
- name: Install Dependencies
37-
run: npm ci --omit=optional
38-
39-
- name: Run Checks
40-
run: npm run check
41-
# the glob here just fails
42-
if: ${{ runner.os != 'Windows' }}
43-
44-
- name: Run Tests
45-
env:
46-
NODE_OPTIONS: "--max_old_space_size=4096"
68+
- name: Run tests
69+
uses: ./.github/workflows/actions/run-tests
70+
with:
4771
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_DEV }}
48-
run: npm run test
4972

5073
merge-dependabot-pr:
5174
name: Merge Dependabot PR
5275
runs-on: ubuntu-latest
5376
needs:
54-
- test-and-build
77+
- test
5578
if: github.event.pull_request.user.login == 'dependabot[bot]'
5679
steps:
5780
- name: Enable auto-merge for Dependabot PRs

.github/workflows/test-and-build.yaml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ permissions:
1414
contents: read
1515

1616
jobs:
17-
test-and-build:
18-
name: Test and Build
17+
build-and-package:
18+
name: Check, Build and Package
19+
runs-on: ubuntu-latest
1920
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
2021

21-
strategy:
22-
matrix:
23-
os: [ubuntu-latest, windows-latest, macos-latest]
24-
fail-fast: false
25-
26-
runs-on: ${{ matrix.os }}
27-
2822
steps:
2923
- name: Checkout
3024
uses: actions/checkout@v4
@@ -37,8 +31,8 @@ jobs:
3731
node-version: 22.15.1
3832
cache: npm
3933

40-
- name: Run tests and build
41-
uses: ./.github/workflows/actions/test-and-build
34+
- name: Check, build and package
35+
uses: ./.github/workflows/actions/build-and-package
4236
with:
4337
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_PROD }}
4438
ARTIFACTORY_HOST: ${{ secrets.ARTIFACTORY_HOST }}
@@ -48,3 +42,32 @@ jobs:
4842
GARASIGN_USERNAME: ${{ secrets.GARASIGN_USERNAME }}
4943
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
5044
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
45+
46+
test:
47+
name: Test
48+
needs: build-and-package
49+
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
50+
51+
strategy:
52+
matrix:
53+
os: [ubuntu-latest, windows-latest, macos-latest]
54+
fail-fast: false
55+
56+
runs-on: ${{ matrix.os }}
57+
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Setup Node.js Environment
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: 22.15.1
68+
cache: npm
69+
70+
- name: Run tests
71+
uses: ./.github/workflows/actions/run-tests
72+
with:
73+
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY_PROD }}

0 commit comments

Comments
 (0)