Repository navigation
149 lines (144 loc) · 5.46 KB
/
Copy pathnpm-cli.yml
File metadata and controls
149 lines (144 loc) · 5.46 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: npm CLI
on:
pull_request:
paths:
- 'bindings/node/**'
- 'bindings/c/**'
- 'bindings/cmd/build-native/**'
- 'bindings/rust/sys/targets.json'
- '.github/workflows/npm-cli.yml'
- '.github/workflows/release.yml'
- '.goreleaser.yml'
workflow_dispatch:
workflow_call:
inputs:
binaries:
description: Artifact ID of the six GoReleaser binaries and their metadata
required: true
type: string
outputs:
tarballs:
description: Artifact ID of the tested npm packages
value: ${{ jobs.pack.outputs.tarballs }}
permissions:
contents: read
jobs:
addons:
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- { key: darwin_arm64, runner: macos-15 }
- { key: darwin_x64, runner: macos-15-intel }
- { key: linux_arm64, runner: ubuntu-22.04-arm }
- { key: linux_x64, runner: ubuntu-22.04 }
outputs:
darwin_arm64: ${{ steps.artifact.outputs.darwin_arm64 }}
darwin_x64: ${{ steps.artifact.outputs.darwin_x64 }}
linux_arm64: ${{ steps.artifact.outputs.linux_arm64 }}
linux_x64: ${{ steps.artifact.outputs.linux_x64 }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
with:
go-version: '1.26.x'
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: '24.22.3'
package-manager-cache: false
- run: npm --prefix bindings/node run build:addon
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
id: upload
with:
name: npm-addon-${{ matrix.key }}-${{ github.run_attempt }}
path: dist/node-addons/*.node
if-no-files-found: error
compression-level: 0
- id: artifact
env:
TARGET: ${{ matrix.key }}
ARTIFACT_ID: ${{ steps.upload.outputs.artifact-id }}
run: echo "$TARGET=$ARTIFACT_ID" >> "$GITHUB_OUTPUT"
pack:
needs: addons
runs-on: ubuntu-latest
outputs:
tarballs: ${{ steps.upload.outputs.artifact-id }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
if: inputs.binaries == ''
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89
if: inputs.binaries == ''
with:
version: '~> v2'
args: build --snapshot --clean
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
if: inputs.binaries != ''
with:
artifact-ids: ${{ inputs.binaries }}
path: dist
merge-multiple: true
- name: Download the four native addons
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ needs.addons.outputs.darwin_arm64 }},${{ needs.addons.outputs.darwin_x64 }},${{ needs.addons.outputs.linux_arm64 }},${{ needs.addons.outputs.linux_x64 }}
path: dist/node-addons
merge-multiple: true
- run: npm --prefix bindings/node run pack:cli
- name: Verify snapshot tarballs against the local build
if: inputs.binaries == ''
run: python3 bindings/node/scripts/verify-pack.py
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
id: upload
with:
name: npm-candidate-${{ github.run_attempt }}
path: |
dist/npm/*/*.tgz
dist/metadata.json
if-no-files-found: error
compression-level: 0
install:
needs: [addons, pack]
strategy:
fail-fast: false
matrix:
runner: [ubuntu-22.04, ubuntu-22.04-arm, macos-15, macos-15-intel, windows-latest]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ needs.pack.outputs.tarballs }}
path: dist
merge-multiple: true
- name: Download original release binaries for comparison
if: inputs.binaries != '' && matrix.runner == 'ubuntu-22.04'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ inputs.binaries }}
path: dist
merge-multiple: true
- name: Download original addons for comparison
if: inputs.binaries != '' && matrix.runner == 'ubuntu-22.04'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ needs.addons.outputs.darwin_arm64 }},${{ needs.addons.outputs.darwin_x64 }},${{ needs.addons.outputs.linux_arm64 }},${{ needs.addons.outputs.linux_x64 }}
path: dist/node-addons
merge-multiple: true
- name: Verify release tarballs
if: inputs.binaries != '' && matrix.runner == 'ubuntu-22.04'
run: python3 bindings/node/scripts/verify-pack.py --tag "$GITHUB_REF_NAME"
- run: npm --prefix bindings/node run test:pack