-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (67 loc) · 2.37 KB
/
Copy pathci.yml
File metadata and controls
78 lines (67 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
uses: ./.github/workflows/_build.yml
smoke:
name: Smoke (Node ${{ matrix.node }})
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Download built dist
uses: actions/download-artifact@v4
with:
name: dist
path: packages
- name: Pack and install in a clean directory
run: |
set -euo pipefail
# Simulate what `npm publish` would emit: it rewrites `workspace:*`
# to a concrete version range in the published tarball, but
# `npm pack` alone does NOT do that rewrite. We do the equivalent
# rewrite to `file:../core` locally so the packed cli tarball has
# an installable dependency reference. This file edit lives only
# on the throwaway runner.
node -e "
const fs = require('fs');
const p = 'packages/cli/package.json';
const j = JSON.parse(fs.readFileSync(p, 'utf8'));
if (j.dependencies['@mulerouter/core'] === 'workspace:*') {
j.dependencies['@mulerouter/core'] = 'file:../core';
}
fs.writeFileSync(p, JSON.stringify(j, null, 2));
"
core_tgz=$(cd packages/core && npm pack --silent)
cli_tgz=$(cd packages/cli && npm pack --silent)
mkdir -p /tmp/smoke
cd /tmp/smoke
npm init -y > /dev/null
npm install --no-audit --no-fund --no-save \
"$GITHUB_WORKSPACE/packages/core/$core_tgz" \
"$GITHUB_WORKSPACE/packages/cli/$cli_tgz"
- name: CLI --version
working-directory: /tmp/smoke
run: npx --no-install mulerouter --version
- name: CLI list --json (exercises core import path)
working-directory: /tmp/smoke
run: npx --no-install mulerouter list --json > /dev/null
- name: Core loads via package name
working-directory: /tmp/smoke
run: node -e "import('@mulerouter/core').then(m => { if (!m.loadConfig) process.exit(1); })"