Skip to content

Commit 7a8b70c

Browse files
committed
More refactors
1 parent 58617b9 commit 7a8b70c

File tree

3 files changed

+54
-140
lines changed

3 files changed

+54
-140
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
uses: actions/cache@v4
6767
with:
6868
path: ./packages/core-bridge/releases
69-
key: corebridge-artifactcache-${{ matrix.platform }}-${{ hashFiles('./packages/core-bridge/**/Cargo.lock', './packages/core-bridge/**/*.rs') }}
69+
key: corebridge-artifactcache-debug-${{ matrix.platform }}-${{ hashFiles('./packages/core-bridge/**/Cargo.lock', './packages/core-bridge/**/*.rs') }}
7070

7171
- name: Install Rust
7272
if: steps.cached-artifact.outputs.cache-hit != 'true'
@@ -85,7 +85,7 @@ jobs:
8585
uses: Swatinem/rust-cache@v2
8686
with:
8787
workspaces: packages/core-bridge -> target
88-
prefix-key: corebridge-buildcache
88+
prefix-key: corebridge-buildcache-debug
8989
shared-key: ${{ matrix.platform }}
9090
env-vars: ''
9191
save-if: ${{ env.IS_MAIN_OR_RELEASE == 'true' }}
@@ -101,7 +101,7 @@ jobs:
101101
102102
- uses: actions/upload-artifact@v4
103103
with:
104-
name: corebridge-native-${{ matrix.platform }}
104+
name: corebridge-native-debug-${{ matrix.platform }}
105105
# Actual file will be named ${{ matrix.target }}/index.node
106106
path: ./packages/core-bridge/releases/*/index.node
107107

@@ -138,7 +138,7 @@ jobs:
138138
- name: Put native files into place
139139
working-directory: ./packages/core-bridge/releases
140140
run: |
141-
mv tmp/corebridge-*/* ./
141+
mv tmp/corebridge-native-debug-*/* ./
142142
rm -rf tmp
143143
144144
- name: Install Node
@@ -215,9 +215,6 @@ jobs:
215215
reuse-v8-context: true
216216
runs-on: ${{ matrix.runner }}
217217
name: Run Integration Tests (${{ matrix.platform }}, Node ${{ matrix.node }}, Reuse V8 Context ${{ matrix.reuse-v8-context }})
218-
defaults:
219-
run:
220-
shell: bash
221218
steps:
222219
- name: 'Checkout code'
223220
uses: actions/checkout@v4
@@ -227,7 +224,7 @@ jobs:
227224
- name: Download core-bridge native libraries
228225
uses: actions/download-artifact@v4
229226
with:
230-
name: corebridge-native-${{ matrix.platform }}
227+
name: corebridge-native-debug-${{ matrix.platform }}
231228
path: ./packages/core-bridge/releases
232229

233230
- name: Install Node
@@ -237,7 +234,6 @@ jobs:
237234

238235
- name: Get NPM cache directory
239236
id: npm-cache-dir
240-
shell: bash
241237
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
242238

243239
- name: Restore NPM cache
@@ -262,14 +258,18 @@ jobs:
262258

263259
- name: Run Temporal CLI
264260
if: matrix.server == 'cli'
265-
shell: bash
266261
run: |
267262
temporal server start-dev \
268263
--db-filename temporal.sqlite \
269264
--sqlite-pragma journal_mode=WAL \
270265
--sqlite-pragma synchronous=OFF \
271266
--headless &> /tmp/devserver.log &
272267
268+
# We write the certs to disk because it serves the sample. Written into /tmp/temporal-certs
269+
- name: Create certs dir
270+
run: node scripts/create-certs-dir.js "${{ runner.temp }}/certs"
271+
if: ${{ vars.TEMPORAL_CLIENT_NAMESPACE != '' }}
272+
273273
- name: Run Tests
274274
run: npm test
275275
env:
@@ -282,146 +282,61 @@ jobs:
282282
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
283283
TEMPORAL_CLIENT_CLOUD_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
284284

285-
- name: Upload NPM logs
286-
uses: actions/upload-artifact@v4
287-
if: failure() || cancelled()
288-
with:
289-
name: integration-tests-${{ matrix.platform }}-node${{ matrix.node }}-${{ matrix.server }}-${{ matrix.reuse-v8-context && 'reuse' || 'noreuse' }}-logs
290-
path: ${{ startsWith(matrix.platform, 'windows') && 'C:\\npm\\_logs\\' || '~/.npm/_logs/' }}
291-
292-
- name: Upload Dev Server logs
293-
uses: actions/upload-artifact@v4
294-
if: failure() || cancelled()
295-
with:
296-
name: integration-tests-${{ matrix.platform }}-node${{ matrix.node }}-${{ matrix.server }}-${{ matrix.reuse-v8-context && 'reuse' || 'noreuse' }}-devserver-logs
297-
path: /tmp/devserver.log
298-
299-
# FIXME: Use a single job instance to run all samples for a given platform
300-
# FIXME: Merge sample testing into integration-tests
301-
# FIXME: Once merged in integration-tests, remove the matrix and use a single job instance
302-
# Tests that npm init @temporalio results in a working worker and client
303-
test-npm-init:
304-
needs: build-packages
305-
strategy:
306-
fail-fast: false
307-
matrix:
308-
node: [16, 22] # Min and max supported Node versions
309-
platform: [linux-x64, linux-arm, macos-x64, macos-arm, windows-x64]
310-
sample: [hello-world, fetch-esm, hello-world-mtls]
311-
server: [cli, cloud]
312-
exclude:
313-
# Exclude non-mtls tests on cloud
314-
- sample: hello-world
315-
server: cloud
316-
# Exclude mtls tests on cli
317-
- sample: hello-world-mtls
318-
server: cli
319-
- sample: fetch-esm
320-
server: cloud
321-
# FIXME: investigate why 'fetch-esm' always hangs on Windows
322-
- sample: fetch-esm
323-
platform: windows-x64
324-
# Exclude cloud tests if we don't have cloud namespace and certs
325-
- server: ${{ vars.TEMPORAL_CLIENT_NAMESPACE == '' && 'cloud' || '' }}
326-
include:
327-
- platform: linux-x64
328-
runner: ubuntu-latest-4-cores
329-
- platform: linux-arm
330-
runner: ubuntu-24.04-arm64-2-core
331-
- platform: macos-x64
332-
runner: macos-13
333-
- platform: macos-arm
334-
runner: macos-14
335-
- platform: windows-x64
336-
runner: windows-latest
337-
runs-on: ${{ matrix.runner }}
338-
name: Run Samples Tests - ${{ matrix.sample }} (${{ matrix.platform }}, Node ${{ matrix.node }}, ${{ matrix.server }})
339-
env:
340-
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
341-
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
342-
steps:
343-
- name: 'Checkout code'
344-
uses: actions/checkout@v4
345-
with:
346-
# We don't need the core submodule here since won't build the project
347-
submodules: false
348-
349-
- name: Install Node
350-
uses: actions/setup-node@v4
351-
with:
352-
node-version: ${{ matrix.node }}
353-
354-
- name: Get NPM cache directory
355-
id: npm-cache-dir
356-
shell: bash
357-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
358-
359-
- name: Restore NPM cache
360-
uses: actions/cache/restore@v4
361-
with:
362-
path: ${{ steps.npm-cache-dir.outputs.dir }}
363-
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
364-
restore-keys: |
365-
npm-main-${{ matrix.platform }}-
366-
367-
# No need to compile anything, we just need the package ./scripts and their dependencies
368-
- name: Install dependencies without compilation
285+
# FIXME: Move samples tests to a custom activity
286+
# Sample 1: hello-world to local server
287+
- name: Instantiate sample project using verdaccio artifacts - Hello World
288+
# Note: here, `npx create` fails on windows if shell is bash.
369289
run: |
370-
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
371-
372-
- name: Restore Verdaccio repo artifact
373-
uses: actions/download-artifact@v4
374-
with:
375-
name: verdaccio-repo
376-
path: ./tmp/registry/storage
290+
node scripts/init-from-verdaccio.js --registry-dir ./tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/main/hello-world --target-dir ${{ runner.temp }}/sample-hello-world
291+
node scripts/test-example.js --work-dir "${{ runner.temp }}/sample-hello-world"
377292
378-
# Note: here, `npx create` fails on windows if shell is bash.
379-
- name: Instantiate sample project using verdaccio artifacts
380-
run: node scripts/init-from-verdaccio.js --registry-dir ./tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/next/${{ matrix.sample }} --target-dir ${{ runner.temp }}/example
381-
382-
- name: Install Temporal CLI
383-
if: matrix.server == 'cli'
384-
uses: temporalio/setup-temporal@v0
385-
386-
- name: Run Temporal CLI
387-
if: matrix.server == 'cli'
388-
shell: bash
293+
# Sample 2: hello-world-mtls to cloud server
294+
- name: Instantiate sample project using verdaccio artifacts - Hello World MTLS
295+
# Note: here, `npx create` fails on windows if shell is bash.
389296
run: |
390-
temporal server start-dev \
391-
--db-filename temporal.sqlite \
392-
--sqlite-pragma journal_mode=WAL \
393-
--sqlite-pragma synchronous=OFF \
394-
--headless &
395-
396-
# We write the certs to disk because it serves the sample. Written into /tmp/temporal-certs
397-
- name: Create certs dir
398-
shell: bash
399-
run: node scripts/create-certs-dir.js "${{ runner.temp }}/certs"
400-
if: matrix.server == 'cloud'
401-
402-
- name: Test run a workflow (non-cloud)
403-
run: node scripts/test-example.js --work-dir "${{ runner.temp }}/example"
404-
shell: bash
405-
if: matrix.server == 'cli'
406-
407-
- name: Test run a workflow (cloud)
408-
run: node scripts/test-example.js --work-dir "${{ runner.temp }}/example"
409-
shell: bash
297+
node scripts/init-from-verdaccio.js --registry-dir ./tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/main/hello-world-mtls --target-dir ${{ runner.temp }}/sample-hello-world-mtls
298+
node scripts/test-example.js --work-dir "${{ runner.temp }}/sample-hello-world-mtls"
410299
env:
411300
# These env vars are used by the hello-world-mtls sample
412301
TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud
413302
TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
414303
TEMPORAL_CLIENT_CERT_PATH: ${{ runner.temp }}/certs/client.pem
415304
TEMPORAL_CLIENT_KEY_PATH: ${{ runner.temp }}/certs/client.key
416-
TEMPORAL_TASK_QUEUE: ${{ format('{0}-{1}-{2}', matrix.platform, matrix.node, matrix.sample) }}
417-
if: matrix.server == 'cloud'
305+
TEMPORAL_TASK_QUEUE: ${{ format('{0}-{1}-sample-hello-world-mtls', matrix.platform, matrix.node) }}
306+
307+
# Sample 3: fetch-esm to local server
308+
- name: Instantiate sample project using verdaccio artifacts - Fetch ESM
309+
# Note: here, `npx create` fails on windows if shell is bash.
310+
run: |
311+
node scripts/init-from-verdaccio.js --registry-dir ./tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/main/fetch-esm --target-dir ${{ runner.temp }}/sample-fetch-esm
312+
node scripts/test-example.js --work-dir "${{ runner.temp }}/sample-fetch-esm"
313+
314+
# End samples
418315

419316
- name: Destroy certs dir
420317
if: always()
421318
shell: bash
422319
run: rm -rf ${{ runner.temp }}/certs
423320
continue-on-error: true
424321

322+
- name: Upload NPM logs
323+
uses: actions/upload-artifact@v4
324+
if: failure() || cancelled()
325+
with:
326+
name: integration-tests-${{ matrix.platform }}-node${{ matrix.node }}-${{ matrix.server }}-${{ matrix.reuse-v8-context && 'reuse' || 'noreuse' }}-logs
327+
path: ${{ startsWith(matrix.platform, 'windows') && 'C:\\npm\\_logs\\' || '~/.npm/_logs/' }}
328+
329+
- name: Upload Dev Server logs
330+
uses: actions/upload-artifact@v4
331+
if: failure() || cancelled()
332+
with:
333+
name: integration-tests-${{ matrix.platform }}-node${{ matrix.node }}-${{ matrix.server }}-${{ matrix.reuse-v8-context && 'reuse' || 'noreuse' }}-devserver-logs
334+
path: /tmp/devserver.log
335+
336+
conventions:
337+
name: Lint and Prune
338+
uses: ./.github/workflows/conventions.yml
339+
425340
# Runs the features repo tests with this repo's current SDK code
426341
# FIXME: Update this job to reuse native build artifacts from compile-native-binaries
427342
features-tests:

.github/workflows/conventions.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
name: Conventions
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- main
8-
- releases/*
4+
workflow_call:
95

106
env:
117
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ jobs:
336336
run: rm -rf ${{ runner.temp }}/certs
337337
continue-on-error: true
338338

339+
conventions:
340+
name: Lint and Prune
341+
uses: ./.github/workflows/conventions.yml
342+
339343
docs:
340344
name: Build Docs
341345
uses: ./.github/workflows/docs.yml
342346
with:
343-
# Can't publish from forks, as secrets won't be available
344347
publish_target: prod
345348
secrets:
346349
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}

0 commit comments

Comments
 (0)