Skip to content

Commit 4f58680

Browse files
committed
ci(gui): add GUI release workflow and update related workflows
1 parent 4c74b0f commit 4f58680

File tree

5 files changed

+209
-6
lines changed

5 files changed

+209
-6
lines changed

.github/workflows/core_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- '!*v*'
7+
tags-ignore:
8+
- '**'
99
paths:
1010
- 'packages/core/**'
1111
- .github/workflows/core_test.yml

.github/workflows/gui_release.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: create-uni/gui CI
2+
env:
3+
DEBUG: napi:*
4+
APP_NAME: create-uni/gui
5+
MACOSX_DEPLOYMENT_TARGET: '10.13'
6+
CARGO_INCREMENTAL: '1'
7+
permissions:
8+
contents: write
9+
id-token: write
10+
on:
11+
push:
12+
branches:
13+
- main
14+
tags-ignore:
15+
- '**'
16+
paths-ignore:
17+
- '**/*.md'
18+
- LICENSE
19+
- '**/*.gitignore'
20+
- .editorconfig
21+
- docs/**
22+
paths:
23+
- 'packages/gui/**'
24+
- 'packages/ui/**'
25+
- .github/workflows/gui_release.yml
26+
pull_request: null
27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
jobs:
31+
build:
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
settings:
36+
- host: macos-latest
37+
target: x86_64-apple-darwin
38+
build: pnpm build --target x86_64-apple-darwin
39+
- host: macos-latest
40+
target: aarch64-apple-darwin
41+
build: pnpm build --target aarch64-apple-darwin
42+
- host: windows-latest
43+
build: pnpm build --target x86_64-pc-windows-msvc
44+
target: x86_64-pc-windows-msvc
45+
- host: windows-latest
46+
build: pnpm build --target i686-pc-windows-msvc
47+
target: i686-pc-windows-msvc
48+
- host: windows-latest
49+
target: aarch64-pc-windows-msvc
50+
build: pnpm build --target aarch64-pc-windows-msvc
51+
name: stable - ${{ matrix.settings.target }} - node@20
52+
runs-on: ${{ matrix.settings.host }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: setup pnpm
56+
uses: pnpm/action-setup@v4
57+
- name: Setup node
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 20
61+
cache: pnpm
62+
- name: Install
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
toolchain: stable
66+
targets: ${{ matrix.settings.target }}
67+
- name: Cache cargo
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
~/.cargo/registry/index/
72+
~/.cargo/registry/cache/
73+
~/.cargo/git/db/
74+
~/.napi-rs
75+
.cargo-cache
76+
target/
77+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
78+
79+
- name: build UI
80+
working-directory: packages/ui
81+
run: |
82+
pnpm install
83+
pnpm build
84+
85+
- name: Install dependencies
86+
working-directory: packages/gui
87+
run: pnpm install
88+
89+
- name: Setup node x86
90+
uses: actions/setup-node@v4
91+
if: matrix.settings.target == 'i686-pc-windows-msvc'
92+
with:
93+
node-version: 20
94+
cache: pnpm
95+
architecture: x86
96+
- name: Build
97+
working-directory: packages/gui
98+
run: ${{ matrix.settings.build }}
99+
shell: bash
100+
101+
- name: Upload artifact
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: bindings-${{ matrix.settings.target }}
105+
path: '*.node'
106+
if-no-files-found: error
107+
108+
test-macOS-windows-binding:
109+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
110+
needs:
111+
- build
112+
strategy:
113+
fail-fast: false
114+
matrix:
115+
settings:
116+
- host: windows-latest
117+
target: x86_64-pc-windows-msvc
118+
architecture: x64
119+
- host: macos-latest
120+
target: x86_64-apple-darwin
121+
architecture: x64
122+
- host: macos-latest
123+
target: aarch64-apple-darwin
124+
architecture: arm64
125+
node:
126+
- '18'
127+
- '20'
128+
runs-on: ${{ matrix.settings.host }}
129+
steps:
130+
- uses: actions/checkout@v4
131+
- name: setup pnpm
132+
uses: pnpm/action-setup@v4
133+
- name: Setup node
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: ${{ matrix.node }}
137+
cache: pnpm
138+
architecture: ${{ matrix.settings.architecture }}
139+
- name: Install dependencies
140+
run: pnpm install
141+
- name: Download artifacts
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: bindings-${{ matrix.settings.target }}
145+
path: .
146+
- name: List packages
147+
run: ls -R .
148+
shell: bash
149+
- name: Test bindings
150+
run: pnpm test
151+
152+
publish:
153+
name: Publish
154+
runs-on: ubuntu-latest
155+
needs:
156+
- test-macOS-windows-binding
157+
steps:
158+
- uses: actions/checkout@v4
159+
- name: setup pnpm
160+
uses: pnpm/action-setup@v4
161+
- name: Setup node
162+
uses: actions/setup-node@v4
163+
with:
164+
node-version: 20
165+
cache: pnpm
166+
- name: Install dependencies
167+
run: pnpm install
168+
- name: Download all artifacts
169+
uses: actions/download-artifact@v4
170+
with:
171+
path: artifacts
172+
- name: create npm dirs
173+
run: pnpm napi create-npm-dirs
174+
- name: Move artifacts
175+
run: pnpm artifacts
176+
- name: List packages
177+
run: ls -R ./npm
178+
shell: bash
179+
- name: Publish
180+
run: |
181+
npm config set provenance true
182+
if git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$";
183+
then
184+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
185+
npm publish --access public
186+
elif git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+";
187+
then
188+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
189+
npm publish --tag next --access public
190+
else
191+
echo "Not a release, skipping publish"
192+
fi
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/info_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- '!*v*'
7+
tags-ignore:
8+
- '**'
99
paths:
1010
- 'packages/info/**'
1111
- .github/workflows/info_test.yml

.github/workflows/lint.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags-ignore:
8+
- '**'
79
pull_request:
810
branches:
911
- main
@@ -29,5 +31,8 @@ jobs:
2931
- name: Install
3032
run: nci
3133

32-
- name: Lint
33-
run: nr lint
34+
- name: ESLint
35+
run: pnpm lint
36+
37+
- name: cargo fmt
38+
run: cargo fmt --all -- --check

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
"dev:info": "turbo dev --filter=./packages/info",
3030
"build:core": "cd ./packages/core && pnpm build",
3131
"build:info": "cd ./packages/info && pnpm build",
32+
"build:ui": "cd ./packages/ui && pnpm build",
33+
"build:gui": "pnpm build:ui && cd ./../packages/gui && pnpm build",
3234
"release:core": "cd ./packages/core && pnpm release",
3335
"release:info": "cd ./packages/info && pnpm release",
36+
"release:gui": "cd ./packages/gui && pnpm release",
3437
"dev": "turbo run dev",
3538
"build": "turbo build",
3639
"lint": "eslint .",

0 commit comments

Comments
 (0)