-
Notifications
You must be signed in to change notification settings - Fork 3
117 lines (105 loc) · 3.2 KB
/
node.js.yml
File metadata and controls
117 lines (105 loc) · 3.2 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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: CI
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.settings.host }}
permissions:
contents: write
packages: write
strategy:
matrix:
settings:
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
runtests: true
- host: ubuntu-22.04
target: aarch64-unknown-linux-gnu
runtests: false
- host: macos-latest
target: aarch64-apple-darwin
runtests: true
- host: macos-latest
target: x86_64-apple-darwin
runtests: false
steps:
- name: macos deps
if: runner.os == 'macOS'
shell: bash
run: |
brew install samba
- name: linux deps
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update && sudo apt-get -y install samba \
libc6-dev-amd64-cross libc6-dev-arm64-cross \
crossbuild-essential-arm64 crossbuild-essential-amd64 \
gcc-aarch64-linux-gnu \
binfmt-support binutils binutils-aarch64-linux-gnu
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'
scope: '@netapplabs'
- name: Prepare yarn
run: yarn install
- name: Build
run: yarn build --target ${{ matrix.settings.target }}
- name: Test
if: ${{ matrix.settings.runtests }}
run: yarn test
- name: Upload node module
uses: actions/upload-artifact@v4
with:
name: smb-js-node-${{ matrix.settings.host }}-${{ matrix.settings.target }}
path: |
smb-js.*.node
lib
publish:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
packages: write
needs: build
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
registry-url: 'https://npm.pkg.github.com'
scope: '@netapplabs'
- name: Download Artifact
uses: actions/download-artifact@v4
with:
pattern: smb-js-node-*
merge-multiple: true
- name: Setup git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Bump version
run: npx standard-version
- name: Publish Artifacts
run: npm publish --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit and push version bump
run: |
git push --follow-tags