Skip to content

Commit c2a3987

Browse files
committed
test new workflow with dockerfile
1 parent de5baef commit c2a3987

File tree

4 files changed

+124
-72
lines changed

4 files changed

+124
-72
lines changed

Diff for: .github/workflows/build.yml

+90-71
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,101 @@ on:
77
pull_request:
88
branches: ["main"]
99
jobs:
10-
start-server:
11-
name: Start server
12-
runs-on: ubuntu-latest
13-
# outputs:
14-
# server-url: ${{ steps.server-output.outputs.server-url }}
15-
steps:
16-
- uses: actions/checkout@v4
17-
with:
18-
submodules: true
19-
- uses: actions/setup-node@v4
20-
- uses: leanprover/lean-action@v1
21-
with:
22-
lake-package-directory: "demo/server/LeanProject"
23-
use-mathlib-cache: false
24-
auto-config: false
25-
build: true
26-
test: false
27-
lint: false
28-
- name: Install dependencies
29-
run: npm install
30-
- name: Install demo
31-
run: npm run setup_demo
32-
# - name: Build lean4monaco
33-
# run: npm run build
34-
# - name: Build demo server
35-
# run: |
36-
# cd demo
37-
# npm run build
38-
- name: Start server
39-
id: start-server
40-
run: |
41-
nohup npm start > nohup.out 2> nohup.err < /dev/null &
42-
echo "server is running..."
43-
# cd demo
44-
# echo "Starting server..."
45-
# npm run start
46-
# # nohup npm run start > nohup.out 2> nohup.err < /dev/null &
47-
# echo "server is running."
4810
test:
49-
strategy:
50-
fail-fast: false
51-
matrix:
52-
include:
53-
- name: Linux
54-
os: ubuntu-latest
55-
# - name: macOS
56-
# os: macos-latest
57-
- name: Windows
58-
os: windows-latest
59-
name: ${{ matrix.name }}
60-
runs-on: ${{ matrix.os }}
61-
needs: start-server
11+
runs-on: ubuntu-latest
6212
steps:
6313
- uses: actions/checkout@v4
6414
with:
6515
submodules: true
66-
- uses: actions/setup-node@v4
67-
- name: Install dependencies
68-
run: npm install
69-
# - name: Wait for server
70-
# run: |
71-
# echo "Pinging the server to check if it's up..."
72-
# for i in {1..30}; do
73-
# curl -sSf http://localhost:5173 && break
74-
# echo "Waiting for server..."
75-
# sleep 5
76-
# done
77-
# - name: Run Cypress tests
78-
# run: |
79-
# # wait-on http://localhost:5173
80-
# cypress run
81-
82-
# # # Install npm dependencies, cache them correctly
83-
# and run all Cypress tests
16+
- name: build docker image
17+
run: docker build -t hhu-adam/lean4monaco .
18+
- name: start server
19+
run: docker run -dit -p 5173:5173 -p 8080:8080 hhu-adam/lean4monaco
8420
- name: Run tests
8521
uses: cypress-io/github-action@v6
86-
# with:
22+
with:
23+
browser: chrome
8724
# start: npm start
88-
# wait-on: 'http://localhost:5173'
25+
wait-on: 'http://localhost:5173'
26+
27+
28+
# start-server:
29+
# name: Start server
30+
# runs-on: ubuntu-latest
31+
# # outputs:
32+
# # server-url: ${{ steps.server-output.outputs.server-url }}
33+
# steps:
34+
# - uses: actions/checkout@v4
35+
# with:
36+
# submodules: true
37+
# - uses: actions/setup-node@v4
38+
# - uses: leanprover/lean-action@v1
39+
# with:
40+
# lake-package-directory: "demo/server/LeanProject"
41+
# use-mathlib-cache: false
42+
# auto-config: false
43+
# build: true
44+
# test: false
45+
# lint: false
46+
# - name: Install dependencies
47+
# run: npm install
48+
# - name: Build and setup demo
49+
# run: npm run setup_demo
50+
# # - name: Build lean4monaco
51+
# # run: npm run build
52+
# # - name: Build demo server
53+
# # run: |
54+
# # cd demo
55+
# # npm run build
56+
# - name: Start server
57+
# id: start-server
58+
# run: |
59+
# nohup npm start > nohup.out 2> nohup.err < /dev/null &
60+
# echo "server is running..."
61+
# # cd demo
62+
# # echo "Starting server..."
63+
# # npm run start
64+
# # # nohup npm run start > nohup.out 2> nohup.err < /dev/null &
65+
# # echo "server is running."
66+
# test:
67+
# strategy:
68+
# fail-fast: false
69+
# matrix:
70+
# include:
71+
# - name: Linux
72+
# os: ubuntu-latest
73+
# # - name: macOS
74+
# # os: macos-latest
75+
# - name: Windows
76+
# os: windows-latest
77+
# name: ${{ matrix.name }}
78+
# runs-on: ${{ matrix.os }}
79+
# needs: start-server
80+
# steps:
81+
# - uses: actions/checkout@v4
82+
# with:
83+
# submodules: true
84+
# - uses: actions/setup-node@v4
85+
# - name: Install dependencies
86+
# run: npm install
87+
# # - name: Wait for server
88+
# # run: |
89+
# # echo "Pinging the server to check if it's up..."
90+
# # for i in {1..30}; do
91+
# # curl -sSf http://localhost:5173 && break
92+
# # echo "Waiting for server..."
93+
# # sleep 5
94+
# # done
95+
# # - name: Run Cypress tests
96+
# # run: |
97+
# # # wait-on http://localhost:5173
98+
# # cypress run
99+
100+
# # # # Install npm dependencies, cache them correctly
101+
# # and run all Cypress tests
102+
# - name: Run tests
103+
# uses: cypress-io/github-action@v6
104+
# with:
105+
# browser: chrome
106+
# # start: npm start
107+
# # wait-on: 'http://localhost:5173'

Diff for: Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:20
2+
3+
USER root
4+
5+
RUN mkdir project
6+
WORKDIR /project
7+
8+
COPY . /project
9+
10+
## TODO: Are these necessary to avoid local artifacts copied inside the container?
11+
RUN rm -rf node_modules
12+
RUN rm -rf demo/node_modules
13+
RUN rm -rf demo/server/node_modules
14+
RUN rm -rf dist
15+
RUN rm -rf demo/dist
16+
17+
# Install Lean/elan
18+
ENV ELAN_HOME=/usr/local/elan \
19+
PATH=/usr/local/elan/bin:$PATH
20+
RUN export LEAN_VERSION="$(cat /project/demo/server/LeanProject/lean-toolchain)" && \
21+
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --no-modify-path --default-toolchain $LEAN_VERSION; \
22+
chmod -R a+w $ELAN_HOME; \
23+
elan --version; \
24+
lean --version; \
25+
leanc --version; \
26+
lake --version;
27+
28+
# Install the demo project
29+
RUN npm install
30+
RUN npm run setup_demo
31+
32+
CMD ["npm", "start"]

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Afterwards, you can run the demo with
174174
```
175175
cd lean4monaco
176176
npm install
177+
npm setup_demo # this builds lean4monaco and calls `npm install` in `demo/`
177178
npm start
178179
```
179180

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"scripts": {
3636
"setup_demo": "concurrently \"(cd demo && npm install)\" \"npm run build\" -n install,build -c \"bgCyan.bold,bgBlue.bold\"",
37-
"start": "npm run setup_demo && concurrently \"tsc -w --preserveWatchOutput\" \"webpack --watch\" \"npm run watch:copyfiles\" \"cd demo && npm run start_client\" \"cd demo && npm run start_server\" -n tsc,webpack,copyfiles,vite,server -c \"bgGreen.bold,bgBlue.bold,bgCyan.bold,bgYellow.bold,bgMagenta.bold\"",
37+
"start": "concurrently \"tsc -w --preserveWatchOutput\" \"webpack --watch\" \"npm run watch:copyfiles\" \"cd demo && npm run start_client\" \"cd demo && npm run start_server\" -n tsc,webpack,copyfiles,vite,server -c \"bgGreen.bold,bgBlue.bold,bgCyan.bold,bgYellow.bold,bgMagenta.bold\"",
3838
"watch:copyfiles": "nodemon --watch ./src --exec \"npm run build:copyfiles\"",
3939
"build:copyfiles": "cd src && copyfiles \"**/*.json\" \"**/*.css\" \"**/*.ttf\" \"**/*.otf\" \"**/*.svg\" ../dist/",
4040
"build": "tsc && webpack && npm run build:copyfiles",

0 commit comments

Comments
 (0)