-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (141 loc) · 4.51 KB
/
ci_cd.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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Test and deploy
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install pnpm components
run: |
pnpm install
- name: Run pre-commit
uses: pre-commit/[email protected]
- name: Apply code modifications with pre-commit-ci-lite
uses: pre-commit-ci/lite-action@main
if: always()
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
packages:
- name: '@uatp/components'
directory: packages/components
run: |
pnpm build
pnpm test
- name: '@uatp/template'
directory: packages/create-web/template/web
run: |
# Template depends on component library, must build first
pnpm --filter=@uatp/components build
pnpm rust
pnpm python
pnpm build
pnpm test
- name: '@uatp/create-web Rust'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/rust --project-name rust --backend rust
cd /tmp/rust/web
pnpm install
pnpm rust
pnpm build
pnpm test
- name: '@uatp/create-web Python'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/python --project-name python --backend python
cd /tmp/python/web
pnpm install
pnpm python
pnpm build
pnpm test
- name: '@uatp/create-web no-backend'
directory: .
run: |
npm exec ./packages/create-web -- --directory /tmp/none --project-name none --backend none
cd /tmp/none/web
pnpm install
pnpm build
pnpm test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install wasm-pack
uses: jetli/[email protected]
- name: Generate Cargo.lock file (for @uatp/template test)
if: ${{ matrix.packages.name == '@uatp/template' }}
working-directory: ${{ matrix.packages.directory }}/rust_backend
run: cargo generate-lockfile
- name: Cache WASM build (for @uatp/template test)
if: ${{ matrix.packages.name == '@uatp/template' }}
uses: actions/cache@v3
with:
path: packages/create-web/template/rust_backend/target
key: rust_backend-${{ hashFiles('**/Cargo.lock') }}
restore-keys: rust_backend
- name: Install dependencies for all packages
run: pnpm install
- name: Test ${{ matrix.packages.name }}
working-directory: ${{ matrix.packages.directory }}
run: ${{ matrix.packages.run }}
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install wasm-pack
uses: jetli/[email protected]
- name: Cache WASM build
uses: actions/cache@v3
with:
path: packages/create-web/template/rust_backend/target
key: rust_backend-${{ hashFiles('**/Cargo.lock') }}
restore-keys: rust_backend
- name: Build template for publishing
working-directory: packages/create-web/template/web
run: |
pnpm install
pnpm rust
pnpm python
BASE_PATH=/web-app-template pnpm build
# Unclear why this is necessary
cp -Rv build/assets/ build/_app/immutable/workers/
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: packages/create-web/template/web/build