-
Notifications
You must be signed in to change notification settings - Fork 18
157 lines (139 loc) · 5.19 KB
/
node.yml
File metadata and controls
157 lines (139 loc) · 5.19 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
150
151
152
153
154
155
156
157
name: Node.js Bindings
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-test:
name: Node.js on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
flt-parse-method: FromChars
artifact-name: specutils-node_node20-linux-x86_64
platform-label: linux-x86_64
- os: macos-latest
flt-parse-method: FastFloat
artifact-name: specutils-node_node20-macos-arm64
platform-label: macos-arm64
- os: windows-latest
flt-parse-method: FromChars
artifact-name: specutils-node_node20-windows-x86_64
platform-label: windows-x86_64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2.0.2
with:
cmake-version: '3.25'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install zlib (Windows)
if: runner.os == 'Windows'
run: vcpkg install zlib:x64-windows-static
- name: Install cmake-js
run: npm install -g cmake-js
- name: Install node-addon-api
working-directory: bindings/node
run: npm install --save-dev node-addon-api
- name: Build (Linux)
if: runner.os == 'Linux'
working-directory: bindings/node
run: >
cmake-js build --out=build_dir --target install
--CDSpecUtils_FLT_PARSE_METHOD="${{ matrix.flt-parse-method }}"
--CDCMAKE_BUILD_TYPE="Release"
--CDSpecUtils_FETCH_FAST_FLOAT=ON
--CDSpecUtils_ENABLE_URI_SPECTRA=OFF
--CDSpecUtils_ENABLE_D3_CHART=ON
--CDSpecUtils_D3_SUPPORT_FILE_STATIC=ON
- name: Build (macOS)
if: runner.os == 'macOS'
working-directory: bindings/node
run: >
cmake-js build --out=build_dir --target install
--CDSpecUtils_FLT_PARSE_METHOD="${{ matrix.flt-parse-method }}"
--CDCMAKE_BUILD_TYPE="Release"
--CDSpecUtils_FETCH_FAST_FLOAT=ON
--CDSpecUtils_ENABLE_URI_SPECTRA=ON
--CDSpecUtils_ENABLE_D3_CHART=ON
--CDSpecUtils_D3_SUPPORT_FILE_STATIC=ON
- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: bindings/node
run: >
cmake-js build --out=build_dir --target install
--CDSpecUtils_FLT_PARSE_METHOD="${{ matrix.flt-parse-method }}"
--CDCMAKE_BUILD_TYPE="Release"
--CDSpecUtils_FETCH_FAST_FLOAT=ON
--CDSpecUtils_ENABLE_URI_SPECTRA=ON
--CDSpecUtils_ENABLE_D3_CHART=ON
--CDSpecUtils_D3_SUPPORT_FILE_STATIC=ON
--CDZLIB_USE_STATIC_LIBS=ON
--CDVCPKG_TARGET_TRIPLET=x64-windows-static
--CDCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Test example (Linux/macOS)
if: runner.os != 'Windows'
working-directory: bindings/node/build_dir/node_release
run: node example.js ../../../../unit_tests/test_data/spectra/Mn56_DetX_Shielded.n42
- name: Test example (Windows)
if: runner.os == 'Windows'
working-directory: bindings/node/build_dir/node_release
run: node example.js ..\..\..\..\unit_tests\test_data\spectra\Mn56_DetX_Shielded.n42
- name: Collect artifacts (Linux/macOS)
if: runner.os != 'Windows'
working-directory: bindings/node
run: |
mkdir -p artifacts
cp build_dir/node_release/SpecUtilsJS.node artifacts/
cp build_dir/node_release/example.js artifacts/
cp README.md artifacts/
cp ../../LICENSE.txt artifacts/
- name: Collect artifacts (Windows)
if: runner.os == 'Windows'
working-directory: bindings/node
shell: bash
run: |
mkdir -p artifacts
cp build_dir/node_release/SpecUtilsJS.node artifacts/ 2>/dev/null || cp build_dir/node_release/Release/SpecUtilsJS.node artifacts/
cp build_dir/node_release/example.js artifacts/
cp README.md artifacts/
cp ../../LICENSE.txt artifacts/
- name: Generate version.txt
working-directory: bindings/node
shell: bash
run: |
cat > artifacts/version.txt << EOF
CI/CD development build
Build date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
Commit: ${{ github.sha }}
Node.js: 20
Platform: ${{ matrix.platform-label }}
EOF
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: bindings/node/artifacts/
update-bleeding-edge:
needs: [build-and-test]
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: ./.github/workflows/update-bleeding-edge.yml
with:
artifacts: |
[
{"artifact-name": "specutils-node_node20-linux-x86_64", "release-asset-name": "specutils-node_node20-linux-x86_64.zip"},
{"artifact-name": "specutils-node_node20-macos-arm64", "release-asset-name": "specutils-node_node20-macos-arm64.zip"},
{"artifact-name": "specutils-node_node20-windows-x86_64", "release-asset-name": "specutils-node_node20-windows-x86_64.zip"}
]
permissions:
contents: write