-
-
Notifications
You must be signed in to change notification settings - Fork 3
201 lines (196 loc) · 6.36 KB
/
Copy pathci.yml
File metadata and controls
201 lines (196 loc) · 6.36 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: CI/CD
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Setup WASI SDK
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
echo "WASI_SDK_PATH=$PWD/wasi-sdk-20.0" >> $GITHUB_ENV
- name: Install Dependencies
run: npm ci
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-lint-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-lint-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Run Lint
run: npx nx affected -t lint --parallel=3
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Setup WASI SDK
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
echo "WASI_SDK_PATH=$PWD/wasi-sdk-20.0" >> $GITHUB_ENV
- name: Install Dependencies
run: npm ci
env:
CXXFLAGS: "-std=c++20"
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-test-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-test-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Cache MSL
id: cache-msl
uses: actions/cache@v4
with:
path: scripts/ModelicaStandardLibrary_v4.1.0.zip
key: ${{ runner.os }}-msl-v4.1.0
- name: Download MSL
run: node scripts/download-msl.cjs
- name: Cache FMI Simulator
id: cache-fmusim
uses: actions/cache@v4
with:
path: packages/fmi/validation/reference_fmus
key: ${{ runner.os }}-fmusim-v0.0.39
- name: Fetch FMI Simulator
if: steps.cache-fmusim.outputs.cache-hit != 'true'
run: npm run fetch:fmusim --workspace=@modelscript/fmi
- name: Run Tests
run: npx nx affected -t test --parallel=3
- name: Validate FMI
run: |
npm run validate --workspace=@modelscript/fmi
npm run test:fmusim --workspace=@modelscript/fmi
if: always()
- name: Publish Test Report
uses: ctrf-io/github-test-reporter@v1
with:
report-path: "**/ctrf/*.json"
if: always()
build_and_deploy:
needs: lint
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Setup WASI SDK
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
echo "WASI_SDK_PATH=$PWD/wasi-sdk-20.0" >> $GITHUB_ENV
- name: Install Dependencies
run: npm ci
env:
CXXFLAGS: "-std=c++20"
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Calculate Affected Bounds
uses: nrwl/nx-set-shas@v4
- name: Run Build
run: npx nx affected -t build --exclude=@modelscript/morsel --parallel=3
- name: Package VS Code Extension
run: npx @vscode/vsce package --no-dependencies
working-directory: extensions/vscode
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: modelscript-vsix
path: extensions/vscode/*.vsix
- name: SPA fallback for GitHub Pages
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
run: |
cp apps/site/build/client/index.html apps/site/build/client/404.html
- name: Deploy Site
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
with:
personal_token: ${{ secrets.MODELSCRIPT_SITE_DEPLOY_PAT }}
external_repository: modelscript/modelscript.github.io
publish_dir: ./apps/site/build/client
docker_build:
needs: build_and_deploy
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
env:
CXXFLAGS: "-std=c++20"
- name: Cache Nx
uses: actions/cache@v4
with:
path: .nx/cache
key: ${{ runner.os }}-nx-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nx-docker-
${{ runner.os }}-nx-build-
${{ runner.os }}-nx-
- name: Fast Rebuild from Cache
run: npx nx run-many -t build --exclude=@modelscript/morsel --parallel=3
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/bake-action@v6
with:
source: .
files: docker-compose.yml
push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.PREBUILT=true