Skip to content

Commit 9f2c5b7

Browse files
committed
Improve github actions
1 parent 0f5aad8 commit 9f2c5b7

4 files changed

Lines changed: 87 additions & 109 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/ci.yml

Lines changed: 33 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
uses: ocaml/setup-ocaml@v2
1111
with:
1212
ocaml-compiler: 4.14.x
13+
dune-cache: true
1314
- name: Install dependencies
1415
run: |
1516
sudo apt-get update
@@ -20,7 +21,7 @@ jobs:
2021
# needs `opam exec --` as `dune` is not in the shell PATH
2122
opam exec -- dune fmt --preview
2223
23-
install-ubuntu:
24+
cli-and-doc:
2425
runs-on: ubuntu-22.04
2526
strategy:
2627
fail-fast: false
@@ -38,6 +39,7 @@ jobs:
3839
uses: ocaml/setup-ocaml@v2
3940
with:
4041
ocaml-compiler: ${{ matrix.ocaml-compiler }}
42+
dune-cache: true
4143
- name: Install dependencies
4244
run: |
4345
sudo apt-get update
@@ -72,6 +74,7 @@ jobs:
7274
uses: ocaml/setup-ocaml@v2
7375
with:
7476
ocaml-compiler: 4.13.x
77+
dune-cache: true
7578
- name: Install dependencies
7679
run: |
7780
sudo apt-get update
@@ -91,7 +94,7 @@ jobs:
9194
- name: Nose tests
9295
run: opam exec -- nosetests -v tests/kappy
9396

94-
js:
97+
webapp-ubuntu:
9598
runs-on: ubuntu-22.04
9699
steps:
97100
- name: Checkout
@@ -100,15 +103,15 @@ jobs:
100103
uses: ocaml/setup-ocaml@v2
101104
with:
102105
ocaml-compiler: 4.13.x
106+
dune-cache: true
103107
- name: Install system dependencies
104108
run: |
105109
sudo apt-get update
106110
sudo apt-get install --yes gnuplot-nox \
107111
poppler-utils graphviz texlive-latex-recommended \
108112
texlive-fonts-recommended texlive-pictures tex4ht
109113
- name: Install OPAM dependencies
110-
run: |
111-
opam install --yes . --deps-only
114+
run: opam install --yes . --deps-only
112115
- name: Make Kappa
113116
run: opam exec -- make all
114117
- name: Make Javascript app
@@ -126,7 +129,7 @@ jobs:
126129
viz
127130
Kappapp.tar.gz
128131
129-
macos:
132+
webapp-macos:
130133
runs-on: macos-13
131134
steps:
132135
- name: Checkout
@@ -135,9 +138,9 @@ jobs:
135138
uses: ocaml/setup-ocaml@v2
136139
with:
137140
ocaml-compiler: 4.13.x
141+
dune-cache: true
138142
- name: Install OPAM dependencies
139-
run: |
140-
opam install --yes . --deps-only
143+
run: opam install --yes . --deps-only
141144
- name: Make Kappa
142145
run: opam exec -- make all
143146
- name: Make MacOS app
@@ -154,10 +157,9 @@ jobs:
154157
uses: actions/upload-artifact@v4
155158
with:
156159
name: macos
157-
path: |
158-
Kappapp.app.zip
160+
path: Kappapp.app.zip
159161

160-
windows:
162+
webapp-windows:
161163
runs-on: windows-2022
162164
steps:
163165
- name: Checkout
@@ -166,29 +168,31 @@ jobs:
166168
uses: ocaml/setup-ocaml@v3
167169
with:
168170
ocaml-compiler: 4.14.x
171+
dune-cache: true
169172
- name: Install OPAM dependencies
170-
run: |
171-
opam install --yes . --deps-only
173+
run: opam install --yes . --deps-only
172174
- name: Make Kappa
173175
run: opam exec -- make all
174176
- name: Make Windows app
175177
run: |
176-
opam exec -- make KappaBin
178+
opam exec -- make KappappWin
177179
# Note: This runs powershell thus the different path syntax
178-
mv .\build\KappaBin .
180+
mv .\build\KappappWin .
179181
# Note: Windows VMs on GitHub Action do not have zip command but provide 7z
180-
7z a -tzip KappaBin.zip KappaBin
182+
7z a -tzip KappappWin.zip KappappWin
181183
- name: Archive Windows app
182184
uses: actions/upload-artifact@v4
183185
with:
184186
name: windows
185-
path: |
186-
KappaBin.zip
187+
path: KappappWin.zip
187188

188-
deploy-docs:
189-
needs: install-ubuntu
190-
runs-on: ubuntu-22.04
189+
deploy:
190+
needs: [cli-and-doc, webapp-ubuntu, webapp-macos, webapp-windows]
191191
if: github.ref == 'refs/heads/master'
192+
runs-on: ubuntu-22.04
193+
strategy:
194+
matrix:
195+
deploy-name: [doc, online-ui, linux, macos, windows]
192196
steps:
193197
- name: Checkout
194198
uses: actions/checkout@v4
@@ -201,58 +205,13 @@ jobs:
201205
with:
202206
key: ${{ secrets.DEPLOY_KEY }}
203207
known_hosts: api.kappalanguage.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJooIEJd6sgRL5JUKGqh9zB3Xla1MchqR8IWl7Nh9ahm9Ji6IwV9QSKG9YQEIHdJWxBk4UzbfRWGkDK9q1GggyM=
204-
- run: dev/update-web.sh native
205-
206-
deploy-js:
207-
needs: js
208-
runs-on: ubuntu-22.04
209-
if: github.ref == 'refs/heads/master'
210-
steps:
211-
- name: Checkout
212-
uses: actions/checkout@v4
213-
- name: Download js artifact
214-
uses: actions/download-artifact@v4
215-
with:
216-
name: js
217-
- name: Install SSH Key
218-
uses: shimataro/ssh-key-action@v2
219-
with:
220-
key: ${{ secrets.DEPLOY_KEY }}
221-
known_hosts: api.kappalanguage.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJooIEJd6sgRL5JUKGqh9zB3Xla1MchqR8IWl7Nh9ahm9Ji6IwV9QSKG9YQEIHdJWxBk4UzbfRWGkDK9q1GggyM=
222-
- run: dev/update-web.sh js
223-
224-
deploy-macos:
225-
needs: macos
226-
runs-on: ubuntu-22.04
227-
if: github.ref == 'refs/heads/master'
228-
steps:
229-
- name: Checkout
230-
uses: actions/checkout@v4
231-
- name: Download MacOS artifact
232-
uses: actions/download-artifact@v4
233-
with:
234-
name: macos
235-
- name: Install SSH Key
236-
uses: shimataro/ssh-key-action@v2
237-
with:
238-
key: ${{ secrets.DEPLOY_KEY }}
239-
known_hosts: api.kappalanguage.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJooIEJd6sgRL5JUKGqh9zB3Xla1MchqR8IWl7Nh9ahm9Ji6IwV9QSKG9YQEIHdJWxBk4UzbfRWGkDK9q1GggyM=
240-
- run: dev/update-web.sh MacOS
208+
- run: dev/upload-website.sh ${{matrix.deploy-name}}
241209

242-
deploy-windows:
243-
needs: windows
244-
runs-on: ubuntu-22.04
245-
if: github.ref == 'refs/heads/master'
246-
steps:
247-
- name: Checkout
248-
uses: actions/checkout@v4
249-
- name: Download Windows artifact
250-
uses: actions/download-artifact@v4
251-
with:
252-
name: windows
253-
- name: Install SSH Key
254-
uses: shimataro/ssh-key-action@v2
255-
with:
256-
key: ${{ secrets.DEPLOY_KEY }}
257-
known_hosts: api.kappalanguage.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJooIEJd6sgRL5JUKGqh9zB3Xla1MchqR8IWl7Nh9ahm9Ji6IwV9QSKG9YQEIHdJWxBk4UzbfRWGkDK9q1GggyM=
258-
- run: dev/update-web.sh windows
210+
# TODO: see if add cache
211+
# # from https://github.com/hazelgrove/hazel/blob/868f673119827a35ec67fad5e7e0d5135ce91d4c/.github/workflows/deploy_branches.yml#L19-L29
212+
# - name: Retrieve the switch environment if cached
213+
# id: opam-cache-switch
214+
# uses: actions/cache@v4
215+
# with:
216+
# path: '_opam'
217+
# key: ${{ runner.os }}-opam-${{ env.cache-name }}-${{ matrix.ocaml-compiler }}-${{ matrix.additional-packages}}-${{ hashFiles('*.opam') }}

Makefile

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ endif
3232
.PHONY: all agents clean check build-tests doc clean_doc debug
3333
.PHONY: temp-clean-for-ignorant-that-clean-must-be-done-before-fetch
3434
.PHONY: profiling kappalib install-lib
35-
.PHONY: Kappapp Kappapp.tar.gz KappaBin KappaBin.zip Kappapp.app
35+
.PHONY: Kappapp Kappapp.tar.gz KappappWin KappappWin.zip Kappapp.app
3636

3737
.PRECIOUS: $(SCRIPTSWITNESS)
3838

@@ -171,6 +171,7 @@ build/Kappapp:
171171
mkdir build/Kappapp/resources/bin
172172
cp _build/install/default/bin/* build/Kappapp/resources/bin/
173173

174+
## Electron build for linux
174175
Kappapp:
175176
# make clean before to be sure things are rebuilt TODO improve?
176177
+$(MAKE) clean
@@ -182,35 +183,36 @@ build/Kappapp.tar.gz: build/Kappapp
182183

183184
Kappapp.tar.gz: build/Kappapp.tar.gz
184185

185-
build/KappaBin:
186-
mkdir -p build/KappaBin
186+
build/KappappWin:
187+
mkdir -p build/KappappWin
187188
+$(MAKE) APP_EXT=local build/site/index.html
188189
dune build --only-packages kappa-library,kappa-binaries,kappa-agents
189190
FILE=$$(mktemp -t electronXXXX); \
190191
curl -LsS -o $$FILE https://github.com/electron/electron/releases/download/v$(ELECTRON_VERSION)/electron-v$(ELECTRON_VERSION)-win32-x64.zip && \
191-
unzip $$FILE -d build/KappaBin
192-
mv build/site build/KappaBin/resources/app
193-
mv build/KappaBin/electron.exe build/KappaBin/Kappapp.exe
194-
mkdir build/KappaBin/resources/bin
195-
cp _build/default/core/main/KaSim.exe build/KappaBin/resources/bin/
196-
cp _build/default/core/KaSa_rep/main/KaSa.exe build/KappaBin/resources/bin/
197-
cp _build/default/core/agents/KaStor.exe build/KappaBin/resources/bin/
198-
cp _build/default/core/odes/KaDE.exe build/KappaBin/resources/bin/
199-
cp _build/default/core/agents/KappaSwitchman.exe build/KappaBin/resources/bin/
200-
cp _build/default/core/agents/KaMoHa.exe build/KappaBin/resources/bin/
201-
cp _build/default/core/agents/KaSimAgent.exe build/KappaBin/resources/bin/
202-
cp _build/default/core/agents/KaSaAgent.exe build/KappaBin/resources/bin/
203-
204-
KappaBin:
192+
unzip $$FILE -d build/KappappWin
193+
mv build/site build/KappappWin/resources/app
194+
mv build/KappappWin/electron.exe build/KappappWin/Kappapp.exe
195+
mkdir build/KappappWin/resources/bin
196+
cp _build/default/core/main/KaSim.exe build/KappappWin/resources/bin/
197+
cp _build/default/core/KaSa_rep/main/KaSa.exe build/KappappWin/resources/bin/
198+
cp _build/default/core/agents/KaStor.exe build/KappappWin/resources/bin/
199+
cp _build/default/core/odes/KaDE.exe build/KappappWin/resources/bin/
200+
cp _build/default/core/agents/KappaSwitchman.exe build/KappappWin/resources/bin/
201+
cp _build/default/core/agents/KaMoHa.exe build/KappappWin/resources/bin/
202+
cp _build/default/core/agents/KaSimAgent.exe build/KappappWin/resources/bin/
203+
cp _build/default/core/agents/KaSaAgent.exe build/KappappWin/resources/bin/
204+
205+
## Electron build for windows
206+
KappappWin:
205207
# make clean before to be sure things are rebuilt TODO improve?
206208
+$(MAKE) clean
207-
+$(MAKE) build/KappaBin
209+
+$(MAKE) build/KappappWin
208210

209-
build/KappaBin.zip: build/KappaBin
210-
zip -y -r $@ build/KappaBin
211-
rm -rf build/KappaBin
211+
build/KappappWin.zip: build/KappappWin
212+
zip -y -r $@ build/KappappWin
213+
rm -rf build/KappappWin
212214

213-
KappaBin.zip: build/KappaBin.zip
215+
KappappWin.zip: build/KappappWin.zip
214216

215217
build/Kappapp.app: build/Info.plist build/Kappa.icns
216218
# do not call make clean here or deps will be erased
@@ -227,6 +229,7 @@ build/Kappapp.app: build/Info.plist build/Kappa.icns
227229
mv build/Kappa.icns $@/Contents/Resources/
228230
mv build/Info.plist $@/Contents/
229231

232+
# Electron build for MacOS 10.15
230233
Kappapp.app:
231234
# make clean before to be sure things are rebuilt TODO improve?
232235
+$(MAKE) clean
@@ -254,3 +257,11 @@ build/Kappa.iconset: gui/resources/Kappa-Logo.png
254257
build/Kappa.icns: build/Kappa.iconset
255258
mkdir -p build
256259
iconutil -c icns $<
260+
261+
.PHONY: Kappapp_for_linux Kappapp_for_macos10.15 Kappapp_for_windows
262+
263+
Kappapp_for_linux: Kappapp
264+
265+
Kappapp_for_macos10.15: Kappapp.app
266+
267+
Kappapp_for_windows: KappappWin
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ empty_or_create ()
1212
PLAYGROUND=$(mktemp -d -t kappaXXXX)
1313
git clone --depth 10 --quiet -b master git@github.com:Kappa-Dev/Kappa-Dev.github.io.git ${PLAYGROUND}
1414
case $1 in
15-
native )
15+
doc )
1616
empty_or_create ${PLAYGROUND}/docs/KaSim-manual-${TRAVIS_BRANCH}
1717
cp man/*.htm man/*.css ${PLAYGROUND}/docs/KaSim-manual-${TRAVIS_BRANCH}/
1818
cp man/KaSim_manual.pdf ${PLAYGROUND}/docs/KaSim-manual-${TRAVIS_BRANCH}.pdf
@@ -29,7 +29,7 @@ case $1 in
2929
scp -r \
3030
${PLAYGROUND}/docs travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/
3131
;;
32-
js )
32+
online-ui )
3333
empty_or_create ${PLAYGROUND}/try
3434
cp site/* ${PLAYGROUND}/try/
3535
sed '/<\/head>/i \
@@ -51,31 +51,33 @@ case $1 in
5151
' site/index.html > ${PLAYGROUND}/try/index.html
5252
scp -o UserKnownHostsFile=dev/deploy_hosts -i dev/travis-deploy -r \
5353
${PLAYGROUND}/try travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/
54+
55+
# Upload /viz interface alongside /try
5456
empty_or_create ${PLAYGROUND}/viz
5557
cp viz/* ${PLAYGROUND}/viz/
5658
scp -o UserKnownHostsFile=dev/deploy_hosts -i dev/travis-deploy -r \
5759
${PLAYGROUND}/viz travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/
60+
;;
61+
linux )
5862
[ -d ${PLAYGROUND}/binaries ] || mkdir ${PLAYGROUND}/binaries
59-
cp Kappapp.tar.gz ${PLAYGROUND}/binaries/
60-
scp ${PLAYGROUND}/binaries/Kappapp.tar.gz \
63+
cp Kappapp.tar.gz ${PLAYGROUND}/binaries/Kappapp_linux.tar.gz
64+
scp ${PLAYGROUND}/binaries/Kappapp_linux.tar.gz \
6165
travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/nightly-builds/
6266
;;
63-
python )
64-
;;
65-
'' )
66-
;;
6767
windows )
6868
[ -d ${PLAYGROUND}/binaries ] || mkdir ${PLAYGROUND}/binaries
69-
cp KappaBin.zip ${PLAYGROUND}/binaries/
70-
scp ${PLAYGROUND}/binaries/KappaBin.zip \
69+
cp KappappWin.zip ${PLAYGROUND}/binaries/Kappapp_windows.zip
70+
scp ${PLAYGROUND}/binaries/Kappapp_windows.zip \
7171
travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/nightly-builds/
7272
;;
73-
MacOS )
73+
macos )
7474
[ -d ${PLAYGROUND}/binaries ] || mkdir ${PLAYGROUND}/binaries
75-
cp Kappapp.app.zip ${PLAYGROUND}/binaries/
76-
scp ${PLAYGROUND}/binaries/Kappapp.app.zip \
75+
cp Kappapp.app.zip ${PLAYGROUND}/binaries/Kappapp_macos10.15.app.zip
76+
scp ${PLAYGROUND}/binaries/Kappapp_macos10.15.app.zip \
7777
travis@api.kappalanguage.org:/var/www/tools.kappalanguage.org/nightly-builds/
7878
;;
79+
'' )
80+
;;
7981
esac
8082
COMMITNAME=$(git show --pretty=oneline -s --no-color)
8183
cd ${PLAYGROUND}

0 commit comments

Comments
 (0)