-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (77 loc) · 2.35 KB
/
ci.yml
File metadata and controls
88 lines (77 loc) · 2.35 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
name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
permissions:
contents: read
pull-requests: read
jobs:
changes:
name: Detect Changes
runs-on: arc-runner-set
outputs:
code: ${{ steps.filter.outputs.code }}
npm: ${{ steps.filter.outputs.npm }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: 0
- name: Filter paths
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
code:
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
npm:
- 'npm/**'
lint:
name: Lint
needs: changes
if: ${{ needs.changes.outputs.code == 'true' || github.event_name == 'push' }}
uses: ./.github/workflows/lint.yml
rust:
name: Rust
needs: changes
if: ${{ needs.changes.outputs.code == 'true' || github.event_name == 'push' }}
uses: ./.github/workflows/rust.yml
npm-validate:
name: Validate npm Package
needs: changes
if: ${{ needs.changes.outputs.npm == 'true' || github.event_name == 'push' }}
runs-on: arc-runner-set
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
persist-credentials: false
- name: Validate package structure
run: |
cd npm
node --input-type=module -e "
import { readFileSync } from 'node:fs';
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
const checks = [
[pkg.bin, 'missing bin entry'],
[pkg.optionalDependencies, 'missing optionalDependencies'],
[Object.keys(pkg.optionalDependencies || {}).length === 4, 'expected 4 platform packages'],
];
for (const [ok, msg] of checks) { if (!ok) throw new Error(msg); }
console.log('Package:', pkg.name, '| platforms:', Object.keys(pkg.optionalDependencies).join(', '));
"
- name: Check npm pack (dry run)
run: |
cd npm
npm pack --dry-run