-
Notifications
You must be signed in to change notification settings - Fork 0
252 lines (211 loc) · 8.05 KB
/
main.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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: Build and test the editor
on:
# Runs on pushes targeting the default branch
push:
branches: ["main", "rope-crdt"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "build"
cancel-in-progress: true
jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
strategy:
matrix:
container: ["ubuntu:22.04"]
container:
image: ${{ matrix.container }}
volumes:
- ${{ github.workspace }}:/app
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
- run: apt-get update
continue-on-error: true
- run: apt-get install gcc-mingw-w64 libx11-xcb-dev curl wget build-essential git musl-tools cmake -y
continue-on-error: true
- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@1.78
- run: rustup target add x86_64-unknown-linux-musl
- uses: iffy/install-nim@v5
with:
version: binary:2.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: add project dir as git safe.directory so nimble can install stuff
run: git config --global --add safe.directory /__w/Absytree/Absytree
continue-on-error: true
# not working because "source" doesn't exist?
#- run: echo "export PATH=/github/home/.nimble/bin:\$PATH" > ~/.profile
#- run: source ~/.profile
# continue-on-error: true
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules-5
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- name: nimble setup
continue-on-error: true
run: PATH=/github/home/.nimble/bin:$PATH nimble setup
# linux builds
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildRemoteWorkspaceHost
- run: PATH=/github/home/.nimble/bin:$PATH nimble buildLspWs
- run: nim c --out:ast -D:enableGui=false -D:enableTerminal=true --app:console -D:forceLogToFile --passC:-std=gnu11 -d:exposeScriptingApi -D:isCI -D:isCINimbleCached=${{steps.cache-nimble.outputs.cache-hit}} src/desktop_main.nim
- run: nim c --out:astg -D:enableGui=true -D:enableTerminal=false --app:gui -D:forceLogToFile --passC:-std=gnu11 -d:exposeScriptingApi -D:isCI -D:isCINimbleCached=${{steps.cache-nimble.outputs.cache-hit}} src/desktop_main.nim
- run: nim c --out:ast-musl -D:enableGui=false -D:enableTerminal=true --app:console -d:musl -d:nimWasmtimeBuildMusl -D:forceLogToFile --passC:-std=gnu11 -d:exposeScriptingApi -D:isCI -D:isCINimbleCached=${{steps.cache-nimble.outputs.cache-hit}} src/desktop_main.nim
# create release packages
- run: PATH=/github/home/.nimble/bin:$PATH nim ./tools/package_release.nims -l
- run: ls -la release_linux
# make zips
- name: Zip release_linux
uses: vimtor/action-zip@v1.2
with:
files: release_linux
dest: release_linux.zip
# upload artifacts
- name: Upload release_linux
uses: actions/upload-artifact@v4.3.3
with:
name: release_linux
path: release_linux.zip
build-windows:
name: Build Windows
runs-on: windows-2022
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
# If I want a specific rust version
#- name: Install latest nightly
# uses: actions-rs/toolchain@v1.0.6
# with:
# toolchain: stable
# override: true
- uses: iffy/install-nim@v5
with:
version: binary:2.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules-2
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- if: ${{ steps.cache-nimble.outputs.cache-hit != 'true' }}
name: nimble setup
continue-on-error: true
run: nimble setup
- name: nimble setup
continue-on-error: true
run: nimble setup
# windows builds
- run: nim c --out:ast.exe -D:enableGui=false -D:enableTerminal=true --app:console -D:forceLogToFile --passC:-std=gnu11 -d:exposeScriptingApi -D:isCI -D:isCINimbleCached=${{steps.cache-nimble.outputs.cache-hit}} src/desktop_main.nim
- run: nim c --out:astg.exe -D:enableGui=true -D:enableTerminal=false --app:gui -D:forceLogToFile --passC:-std=gnu11 -d:exposeScriptingApi -D:isCI -D:isCINimbleCached=${{steps.cache-nimble.outputs.cache-hit}} src/desktop_main.nim
- run: nimble buildRemoteWorkspaceHostWindows
- run: nimble buildLspWsWindows
# create release packages
- run: nim ./tools/package_release.nims -w
# make zips
- name: Zip release_windows
uses: vimtor/action-zip@v1.2
with:
files: release_windows
dest: release_windows.zip
# upload artifacts
- name: Upload release_windows
uses: actions/upload-artifact@v4.3.3
with:
name: release_windows
path: release_windows.zip
run-tests:
name: Run tests
runs-on: ubuntu-latest
container:
image: "ubuntu:22.04"
volumes:
- ${{ github.workspace }}:/app
steps:
- name: Checkout the repo
uses: actions/checkout@v4.1.7
- run: apt-get update
continue-on-error: true
- run: apt-get install gcc-mingw-w64 libx11-xcb-dev curl wget build-essential git musl-tools cmake -y
continue-on-error: true
- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@1.78
- uses: iffy/install-nim@v5
with:
version: binary:2.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: add project dir as git safe.directory so nimble can install stuff
run: git config --global --add safe.directory /__w/Absytree/Absytree
continue-on-error: true
- name: Cache nimble modules
id: cache-nimble
uses: actions/cache@v3
env:
cache-name: cache-nimble-modules-4
with:
path: ~/.nimble
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('nimble.lock') }}
- name: nimble setup
continue-on-error: true
run: PATH=/github/home/.nimble/bin:$PATH nimble setup
- run: "echo 'import nimwasmtime' > src/temp.nim && nim c -d:nimWasmtimeBuild src/temp.nim"
- name: Run tests
continue-on-error: true
run: testament --print category unit
- name: Build test report
run: testament html
- uses: actions/upload-artifact@v4.3.3
with:
name: testresults.html
path: testresults.html
# Build job
build-page:
runs-on: ubuntu-latest
needs: run-tests
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- uses: actions/download-artifact@v4.1.7
with:
name: testresults.html
continue-on-error: true
- name: Setup Pages
uses: actions/configure-pages@v5.0.0
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1.0.12
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3.0.1
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-page
if: always()
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4.0.5