-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (76 loc) · 2.59 KB
/
Copy pathci.yml
File metadata and controls
90 lines (76 loc) · 2.59 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
79
80
81
82
83
84
85
86
87
88
89
90
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
name: Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
# 24.15.0 is the `engines.node` floor — the release where node:sqlite
# stopped emitting an ExperimentalWarning. Bare `24` resolves to the
# latest 24.x, so without the pin the declared floor is never exercised.
node-version: ['24.15.0', '24']
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
# Ahead of lint: reformatting can move an eslint-disable directive off the
# line it suppresses, so drift should be reported as formatting rather
# than as the lint failures it goes on to cause.
- run: npm run format:check
- run: npm run lint
- run: npm run type-check
- run: npm run check-deps
- run: npm run build
- run: npm run test:coverage
# The suites run from the working tree, so nothing above proves the published
# artifact works. `bin` and the package entry have separate module graphs — a
# broken entry point ships while the CLI still passes every test.
package:
name: Packaged artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
cache: npm
- run: npm ci
- run: npm run build
- name: Pack
id: pack
run: echo "tarball=$(npm pack --silent)" >> "$GITHUB_OUTPUT"
- name: Install globally and run the CLI
env:
TARBALL: ${{ steps.pack.outputs.tarball }}
run: |
npm install -g "./$TARBALL"
deepl --version
# From a throwaway consumer package, because Node does not resolve
# bare specifiers out of the global prefix.
- name: Import the package entry as a dependency
env:
TARBALL: ${{ steps.pack.outputs.tarball }}
run: |
tarball_path="$PWD/$TARBALL"
consumer="$(mktemp -d)"
cd "$consumer"
npm init -y >/dev/null
npm install "$tarball_path"
node --input-type=module -e "
const m = await import('@deepl/cli');
const keys = Object.keys(m);
if (keys.length === 0) {
throw new Error('package entry resolved but exported nothing');
}
console.log('package entry exports:', keys.join(', '));
"