Skip to content

Commit b547c18

Browse files
authored
chore(repo): turbo caching improvements and minor packaging simplification (#3913)
Subset of changes from #3791, avoiding the titular "skip hangar" part. Primary Goal: Tweak turbo configuration to both more granular and more accurate in general Changes: - (turbo) Tests do not effect compile/package output - (turbo) Stop using `src/**` when possible, using more specific file extensions - Make wingc.wasm and docs.tgz part of npm scripts and put the result alongside the other distributables - the github workflow was simplified to be able to just upload/download all these dists - (workflow) Made sure rust only caches in the test workflow, otherwise the build and test workflows fight over the cache - Fixed #3842 by explicitly publishing packages in order. Might do something more robust later, but this at least avoids the out-of-order issue - Deleted several extra license files (projen generated a `LICENSE`, while we had `LICENSE.md` as well) *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
1 parent 6a0ebfb commit b547c18

23 files changed

+73
-349
lines changed

.github/workflows/build.yml

+24-52
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ env:
2222
RUST_VERSION: "1.67.1"
2323
NODE_VERSION: "18.16.0"
2424
PNPM_VERSION: "8.6.3"
25+
CARGO_TERM_COLOR: always
26+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
27+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
2528

2629
jobs:
2730
build:
2831
name: "Build"
2932
timeout-minutes: 30
3033
runs-on: ubuntu-latest
31-
env:
32-
CARGO_TERM_COLOR: always
33-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
34-
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
3534
outputs:
3635
version: ${{ fromJson(steps.changelog.outputs.data).newVersion }}
3736
last-version: ${{ fromJson(steps.changelog.outputs.data).lastVersion }}
@@ -66,6 +65,9 @@ jobs:
6665

6766
- name: Setup Cargo Cache
6867
uses: Swatinem/rust-cache@v2
68+
with:
69+
# Don't save cache here, to avoid thrashing with test job
70+
save-if: false
6971

7072
- name: Install Dependencies
7173
run: pnpm install --frozen-lockfile
@@ -81,18 +83,6 @@ jobs:
8183
env:
8284
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
8385

84-
- name: Upload Artifacts
85-
uses: actions/upload-artifact@v3
86-
with:
87-
name: dist
88-
path: dist/*.tgz
89-
90-
- name: Upload WingC WASM
91-
uses: actions/upload-artifact@v3
92-
with:
93-
name: wingc
94-
path: libs/wingcompiler/wingc.wasm
95-
9686
- name: Derive appropriate SHAs for base and head
9787
id: setSHAs
9888
uses: nrwl/nx-set-shas@v3
@@ -106,35 +96,19 @@ jobs:
10696
echo "diff=true" >> "$GITHUB_OUTPUT"
10797
fi
10898
109-
- name: Upload Extension
110-
uses: actions/upload-artifact@v3
111-
with:
112-
name: vscode-wing
113-
path: apps/vscode-wing/vscode-wing.vsix
114-
115-
- name: Compress Docs
116-
run: tar -czvf docs.tgz docs/*
117-
118-
- name: Upload Docs
99+
- name: Upload Artifacts
119100
uses: actions/upload-artifact@v3
120101
with:
121-
name: docs
122-
path: docs.tgz
102+
name: dist
103+
path: dist/*
123104

124105
test:
125106
name: Test
126107
timeout-minutes: 30
127108
runs-on: ubuntu-latest
128-
env:
129-
CARGO_TERM_COLOR: always
130-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
131-
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
132-
133109
steps:
134110
- name: Checkout
135111
uses: actions/checkout@v3
136-
with:
137-
fetch-depth: 1
138112

139113
- name: Setup pnpm
140114
uses: pnpm/[email protected]
@@ -227,7 +201,7 @@ jobs:
227201
path: tools/hangar/results/report.json
228202

229203
- name: Create Markdown report
230-
run: node scripts/benchmark_json_to_table.mjs
204+
run: scripts/benchmark_json_to_table.mjs
231205

232206
e2e-test:
233207
name: "E2E / ${{ matrix.runner }} + Node${{ matrix.node }} [${{ matrix.shard }}]"
@@ -254,8 +228,6 @@ jobs:
254228
steps:
255229
- name: Checkout
256230
uses: actions/checkout@v3
257-
with:
258-
fetch-depth: 1
259231

260232
- name: Setup pnpm
261233
uses: pnpm/[email protected]
@@ -349,25 +321,28 @@ jobs:
349321
repo-token: "${{ secrets.PROJEN_GITHUB_TOKEN }}"
350322
tag: "v${{ needs.build.outputs.version }}"
351323

324+
- name: Login to NPM registry
325+
run: npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_PUBLISH_TOKEN }}
326+
327+
- name: Publish npm packages
328+
working-directory: dist
329+
env:
330+
PACKAGE_VERSION: ${{ needs.build.outputs.version }}
331+
run: |
332+
PACKAGES=("winglang-sdk" "winglang-compiler" "wingconsole-design-system" "wingconsole-ui" "wingconsole-server" "wingconsole-app")
333+
for PACKAGE in $PACKAGES; do
334+
npm publish "$PACKAGE-$PACKAGE_VERSION.tgz" --access public
335+
done
336+
352337
- name: Publish Extension to Visual Studio Marketplace
353338
if: needs.build.outputs.vscode-wing-changed == 'true'
354339
uses: "HaaLeo/publish-vscode-extension@v1"
355340
with:
356341
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
357342
registryUrl: "https://marketplace.visualstudio.com"
358-
extensionFile: "vscode-wing/vscode-wing.vsix"
343+
extensionFile: "dist/vscode-wing.vsix"
359344
dependencies: false
360345

361-
- name: Login to NPM registry
362-
run: npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_PUBLISH_TOKEN }}
363-
364-
- name: Publish npm packages
365-
run: |
366-
for file in *.tgz; do
367-
npm publish "$file" --access public
368-
done
369-
working-directory: dist
370-
371346
- name: Write Changelog
372347
uses: DamianReeves/[email protected]
373348
with:
@@ -377,9 +352,6 @@ jobs:
377352

378353
- name: Compute Checksums
379354
run: |
380-
mv ./docs/*.tgz ./dist
381-
mv ./*/*.vsix ./dist
382-
mv ./*/*.wasm ./dist
383355
mv ./benchmarks/* ./dist
384356
cd dist
385357

apps/jsii-docgen/LICENSE.md

-202
This file was deleted.

apps/vscode-wing/.projen/tasks.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/vscode-wing/.projenrc.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ project.watchTask.reset("tsup --watch");
237237
project.packageTask.reset(
238238
"pnpm version ${PROJEN_BUMP_VERSION:-0.0.0} --allow-same-version"
239239
);
240-
project.packageTask.exec("vsce package --no-dependencies -o vscode-wing.vsix");
240+
project.packageTask.exec(
241+
"vsce package --no-dependencies -o ../../dist/vscode-wing.vsix"
242+
);
241243

242244
project.addFields({
243245
volta: {

apps/vscode-wing/LICENSE.md

-19
This file was deleted.

0 commit comments

Comments
 (0)