Skip to content

Commit 3356dbd

Browse files
authored
feat: init package of css module hash rule (#2)
* feat: init package of css module hash rule * chore: remove ci
1 parent dc41a01 commit 3356dbd

File tree

31 files changed

+2279
-0
lines changed

31 files changed

+2279
-0
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[target.aarch64-unknown-linux-musl]
2+
linker = "aarch64-linux-musl-gcc"
3+
rustflags = ["-C", "target-feature=-crt-static"]

.github/workflows/CI.yml

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
name: CI
2+
env:
3+
DEBUG: napi:*
4+
APP_NAME: css-modules-hash
5+
MACOSX_DEPLOYMENT_TARGET: '10.13'
6+
permissions:
7+
contents: write
8+
id-token: write
9+
'on':
10+
push:
11+
branches:
12+
- main
13+
tags-ignore:
14+
- '**'
15+
paths-ignore:
16+
- '**/*.md'
17+
- LICENSE
18+
- '**/*.gitignore'
19+
- .editorconfig
20+
- docs/**
21+
pull_request: null
22+
jobs:
23+
build:
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
settings:
28+
- host: macos-latest
29+
target: x86_64-apple-darwin
30+
build: |
31+
yarn build
32+
strip -x *.node
33+
- host: windows-latest
34+
build: yarn build
35+
target: x86_64-pc-windows-msvc
36+
- host: ubuntu-latest
37+
target: x86_64-unknown-linux-gnu
38+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
39+
build: |-
40+
set -e &&
41+
yarn build --target x86_64-unknown-linux-gnu &&
42+
strip *.node
43+
- host: ubuntu-latest
44+
target: x86_64-unknown-linux-musl
45+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
46+
build: set -e && yarn build && strip *.node
47+
- host: macos-latest
48+
target: aarch64-apple-darwin
49+
build: |
50+
yarn build --target aarch64-apple-darwin
51+
strip -x *.node
52+
- host: windows-latest
53+
target: aarch64-pc-windows-msvc
54+
build: yarn build --target aarch64-pc-windows-msvc
55+
name: stable - ${{ matrix.settings.target }} - node@18
56+
runs-on: ${{ matrix.settings.host }}
57+
steps:
58+
- uses: actions/checkout@v3
59+
- name: Setup node
60+
uses: actions/setup-node@v3
61+
if: ${{ !matrix.settings.docker }}
62+
with:
63+
node-version: 18
64+
check-latest: true
65+
cache: yarn
66+
- name: Install
67+
uses: dtolnay/rust-toolchain@stable
68+
if: ${{ !matrix.settings.docker }}
69+
with:
70+
toolchain: stable
71+
targets: ${{ matrix.settings.target }}
72+
- name: Cache cargo
73+
uses: actions/cache@v3
74+
with:
75+
path: |
76+
~/.cargo/registry/index/
77+
~/.cargo/registry/cache/
78+
~/.cargo/git/db/
79+
.cargo-cache
80+
target/
81+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
82+
- uses: goto-bus-stop/setup-zig@v2
83+
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
84+
with:
85+
version: 0.10.1
86+
- name: Setup toolchain
87+
run: ${{ matrix.settings.setup }}
88+
if: ${{ matrix.settings.setup }}
89+
shell: bash
90+
- name: Install dependencies
91+
run: yarn install
92+
- name: Build in docker
93+
uses: addnab/docker-run-action@v3
94+
if: ${{ matrix.settings.docker }}
95+
with:
96+
image: ${{ matrix.settings.docker }}
97+
options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build'
98+
run: ${{ matrix.settings.build }}
99+
- name: Build
100+
run: ${{ matrix.settings.build }}
101+
if: ${{ !matrix.settings.docker }}
102+
shell: bash
103+
- name: Upload artifact
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: bindings-${{ matrix.settings.target }}
107+
path: ${{ env.APP_NAME }}.*.node
108+
if-no-files-found: error
109+
test-macOS-windows-binding:
110+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
111+
needs:
112+
- build
113+
strategy:
114+
fail-fast: false
115+
matrix:
116+
settings:
117+
- host: macos-latest
118+
target: x86_64-apple-darwin
119+
- host: windows-latest
120+
target: x86_64-pc-windows-msvc
121+
node:
122+
- '14'
123+
- '16'
124+
- '18'
125+
runs-on: ${{ matrix.settings.host }}
126+
steps:
127+
- uses: actions/checkout@v3
128+
- name: Setup node
129+
uses: actions/setup-node@v3
130+
with:
131+
node-version: ${{ matrix.node }}
132+
check-latest: true
133+
cache: yarn
134+
- name: Install dependencies
135+
run: yarn install
136+
- name: Download artifacts
137+
uses: actions/download-artifact@v3
138+
with:
139+
name: bindings-${{ matrix.settings.target }}
140+
path: .
141+
- name: List packages
142+
run: ls -R .
143+
shell: bash
144+
- name: Test bindings
145+
run: yarn test
146+
test-linux-x64-gnu-binding:
147+
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
148+
needs:
149+
- build
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
node:
154+
- '14'
155+
- '16'
156+
- '18'
157+
runs-on: ubuntu-latest
158+
steps:
159+
- uses: actions/checkout@v3
160+
- name: Setup node
161+
uses: actions/setup-node@v3
162+
with:
163+
node-version: ${{ matrix.node }}
164+
check-latest: true
165+
cache: yarn
166+
- name: Install dependencies
167+
run: yarn install
168+
- name: Download artifacts
169+
uses: actions/download-artifact@v3
170+
with:
171+
name: bindings-x86_64-unknown-linux-gnu
172+
path: .
173+
- name: List packages
174+
run: ls -R .
175+
shell: bash
176+
- name: Test bindings
177+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
178+
test-linux-x64-musl-binding:
179+
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
180+
needs:
181+
- build
182+
strategy:
183+
fail-fast: false
184+
matrix:
185+
node:
186+
- '14'
187+
- '16'
188+
- '18'
189+
runs-on: ubuntu-latest
190+
steps:
191+
- uses: actions/checkout@v3
192+
- name: Setup node
193+
uses: actions/setup-node@v3
194+
with:
195+
node-version: ${{ matrix.node }}
196+
check-latest: true
197+
cache: yarn
198+
- name: Install dependencies
199+
run: |
200+
yarn config set supportedArchitectures.libc "musl"
201+
yarn install
202+
- name: Download artifacts
203+
uses: actions/download-artifact@v3
204+
with:
205+
name: bindings-x86_64-unknown-linux-musl
206+
path: .
207+
- name: List packages
208+
run: ls -R .
209+
shell: bash
210+
- name: Test bindings
211+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
212+
universal-macOS:
213+
name: Build universal macOS binary
214+
needs:
215+
- build
216+
runs-on: macos-latest
217+
steps:
218+
- uses: actions/checkout@v3
219+
- name: Setup node
220+
uses: actions/setup-node@v3
221+
with:
222+
node-version: 18
223+
check-latest: true
224+
cache: yarn
225+
- name: Install dependencies
226+
run: yarn install
227+
- name: Download macOS x64 artifact
228+
uses: actions/download-artifact@v3
229+
with:
230+
name: bindings-x86_64-apple-darwin
231+
path: artifacts
232+
- name: Download macOS arm64 artifact
233+
uses: actions/download-artifact@v3
234+
with:
235+
name: bindings-aarch64-apple-darwin
236+
path: artifacts
237+
- name: Combine binaries
238+
run: yarn universal
239+
- name: Upload artifact
240+
uses: actions/upload-artifact@v3
241+
with:
242+
name: bindings-universal-apple-darwin
243+
path: ${{ env.APP_NAME }}.*.node
244+
if-no-files-found: error
245+
publish:
246+
name: Publish
247+
runs-on: ubuntu-latest
248+
needs:
249+
- test-macOS-windows-binding
250+
- test-linux-x64-gnu-binding
251+
- test-linux-x64-musl-binding
252+
- universal-macOS
253+
steps:
254+
- uses: actions/checkout@v3
255+
- name: Setup node
256+
uses: actions/setup-node@v3
257+
with:
258+
node-version: 18
259+
check-latest: true
260+
cache: yarn
261+
- name: Install dependencies
262+
run: yarn install
263+
- name: Download all artifacts
264+
uses: actions/download-artifact@v3
265+
with:
266+
path: artifacts
267+
- name: Move artifacts
268+
run: yarn artifacts
269+
- name: List packages
270+
run: ls -R ./npm
271+
shell: bash
272+
- name: Publish
273+
run: |
274+
npm config set provenance true
275+
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
276+
then
277+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
278+
npm publish --access public
279+
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
280+
then
281+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
282+
npm publish --tag next --access public
283+
else
284+
echo "Not a release, skipping publish"
285+
fi
286+
env:
287+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)