-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (121 loc) · 3.88 KB
/
unittest.yml
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
name: build/test
on:
pull_request:
branches: [main]
workflow_call:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
checks:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
name: 'health checks'
steps:
- name: check gclib version
run: ldd --version
- name: Check out code
uses: actions/checkout@v4
- name: cargo fmt --check
run: cargo fmt --check
- name: install dependencies
run: yarn install
- name: Check changefile
run: yarn check-changefile
- uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: -- --all-targets -Dwarnings
- name: Run cargo-udeps
uses: aig787/cargo-udeps-action@v1
with:
version: 'latest'
args: '--all-targets'
build:
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
test: true
js-files: true
- host: ubuntu-20.04
target: aarch64-unknown-linux-gnu
packages: gcc-aarch64-linux-gnu
test: false
# This is the latest macos that github provides a non-enterprise-tier x86
# runner for
# See: https://github.com/actions/runner-images?tab=readme-ov-file#available-images
- host: macos-13
target: x86_64-apple-darwin
test: false
- host: macos-latest
target: aarch64-apple-darwin
test: false
- host: windows-latest
target: x86_64-pc-windows-msvc
test: true
- host: windows-latest
target: aarch64-pc-windows-msvc
test: false
name: build${{ matrix.settings.test && '+test' || ''}} ${{ matrix.settings.target }} on ${{ matrix.settings.host }}
runs-on: ${{ matrix.settings.host }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-10-25
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: run package install script
shell: bash
run: |
if [ -n "${{ matrix.settings.packages }}" ]; then
sudo apt-get update
sudo apt-get install -y ${{ matrix.settings.packages }}
fi
- name: napi build
run: yarn install && yarn build --target ${{ matrix.settings.target }}
- name: debug print machine info
run: |
find . -name "*.node";
uname -a;
- name: run napi tests
if: ${{ matrix.settings.test }}
run: yarn test
- name: cargo test
if: ${{ matrix.settings.test }}
run: cargo test --release --tests
- name: upload-artifacts
uses: actions/upload-artifact@v4
# only run when this subworkflow is called from CI (e.g. not a PR)
if: needs.pr-check.outputs.number != 'null'
with:
name: bindings-${{ matrix.settings.target }}
path: ./*.node
if-no-files-found: error
- name: upload js files
# only run when this subworkflow is called from CI (e.g. not a PR)
if: ${{ matrix.settings.js-files }}
uses: actions/upload-artifact@v4
with:
name: js-files
if-no-files-found: error
path: |
index.js
index.d.ts