Skip to content

Commit 4b478a0

Browse files
committed
Merge remote-tracking branch 'origin/master' into 40-citable
2 parents bd6ca58 + 94011bc commit 4b478a0

34 files changed

+1058
-252
lines changed

.githooks/pre-commit

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
# this shell script is stored as .githooks/pre-commit
3+
4+
UID=$(id -u)
5+
6+
echo 'Check entangled files are up to date'
7+
8+
# Entangle Markdown to source code and store the output
9+
LOG=$(docker run --rm --user ${UID} -v ${PWD}:/data nlesc/pandoc-tangle:0.5.0 --preserve-tabs *.md 2>&1 > /dev/null)
10+
# Parse which filenames have been written from output
11+
FILES=$(echo $LOG | perl -ne 'print $1,"\n" if /^Writing \`(.*)\`./')
12+
[ -z "$FILES" ] && exit 0
13+
echo $FILES
14+
15+
echo 'Adding written files to commit'
16+
echo $FILES | xargs git add

.github/workflows/main.yml

Lines changed: 77 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,100 +8,111 @@ on: [push, pull_request]
88

99
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1010
jobs:
11+
entangle:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Check all entangled files are in sync with Markdown
16+
run: make check
1117
cpp:
1218
# The type of runner that the job will run on
1319
runs-on: ubuntu-latest
1420

1521
# Steps represent a sequence of tasks that will be executed as part of the job
1622
steps:
17-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
18-
- uses: actions/checkout@v2
19-
20-
# Should not be needed anymore when https://github.com/NLESC-JCER/cpp2wasm/issues/1 is fixed
21-
- name: Generate source code
22-
uses: docker://nlesc/pandoc-tangle:0.5.0
23-
with:
24-
args: --preserve-tabs README.md INSTALL.md
23+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24+
- uses: actions/checkout@v2
2525

26-
- name: Run C++ examples
27-
run: make test-cli test-cgi
26+
- name: Run C++ examples
27+
run: make test-cli test-cgi
2828
python:
29-
# The type of runner that the job will run on
29+
# The type of runner that the job will run on
30+
name: Python ${{ matrix.python-version }}
3031
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
python-version: [3.6, 3.7, 3.8]
35+
fail-fast: true
3136
# Redis is needed for Celery
3237
services:
3338
redis:
3439
image: redis
3540
ports:
3641
- 6379:6379
3742
steps:
38-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
39-
- uses: actions/checkout@v2
40-
41-
# Should not be needed anymore when https://github.com/NLESC-JCER/cpp2wasm/issues/1 is fixed
42-
- name: Generate source code
43-
uses: docker://nlesc/pandoc-tangle
44-
with:
45-
args: --preserve-tabs README.md INSTALL.md
46-
47-
- uses: actions/setup-python@v1
48-
with:
49-
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
50-
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
51-
52-
- name: Install Python dependencies
53-
run: make py-deps && pip install httpie
54-
55-
- name: Run Python example
56-
run: make test-py
57-
58-
- name: Start web application in background
59-
run: make run-webapp &
60-
61-
- name: Test web application
62-
run: http --ignore-stdin -f localhost:5001 epsilon=0.001 guess=-20
63-
64-
- name: Start web service in background
65-
run: make run-webservice &
66-
67-
- name: Test web service
68-
run: make test-webservice
69-
70-
- name: Start Celery web app in background
71-
run: make run-celery-webapp &
72-
73-
- name: Start Celery worker in background
74-
run: |
75-
cd src/py
76-
PYTHONPATH=$PWD/../.. celery -A tasks worker &
77-
cd ../..
78-
79-
- name: Test Celery web app
80-
run: |
81-
http --ignore-stdin -hf localhost:5000 epsilon=0.001 guess=-20 | tee response.txt
82-
# Parse result url from response
83-
RESULT_URL=$(cat response.txt |grep Location |awk '{print $2}')
84-
sleep 2
85-
http --ignore-stdin $RESULT_URL
43+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
44+
- uses: actions/checkout@v2
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v1
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
architecture: "x64"
51+
52+
- name: Which Python
53+
run: which python
54+
55+
- name: Install Python dependencies
56+
run: make py-deps && pip install httpie
57+
58+
- name: Run Python example
59+
run: make test-py
60+
61+
- name: Start web application in background
62+
run: make run-webapp 2>&1 | tee ./run-webapp.log &
63+
64+
- name: Test web application
65+
run: http --ignore-stdin -f localhost:5001 epsilon=0.001 guess=-20
66+
67+
- name: Start web service in background
68+
run: make run-webservice 2>&1 | tee ./run-webservice.log &
69+
70+
- name: Test web service
71+
run: make test-webservice
72+
73+
- name: Start Celery web app in background
74+
run: make run-celery-webapp 2>&1 | tee ./run-celery-webapp.log &
75+
76+
- name: Start Celery worker in background
77+
run: |
78+
cd src/py
79+
PYTHONPATH=$PWD/../.. celery -A tasks worker 2>&1 | tee ./run-celery-worker.log &
80+
cd ../..
81+
82+
- name: Test Celery web app
83+
run: |
84+
http --ignore-stdin -hf localhost:5000 epsilon=0.001 guess=-20 | tee response.txt
85+
# Parse result url from response
86+
RESULT_URL=$(cat response.txt |grep Location |awk '{print $2}')
87+
sleep 2
88+
http --ignore-stdin $RESULT_URL
89+
90+
- name: Upload log of services
91+
if: ${{ always() }}
92+
uses: actions/upload-artifact@v2
93+
with:
94+
name: service-logs
95+
path: ./run-*.log
8696
wasm:
8797
runs-on: ubuntu-latest
8898
steps:
8999
- uses: actions/checkout@v2
90100

91-
# Should not be needed anymore when https://github.com/NLESC-JCER/cpp2wasm/issues/1 is fixed
92-
- name: Generate source code
93-
uses: docker://nlesc/pandoc-tangle
94-
with:
95-
args: --preserve-tabs README.md INSTALL.md
96-
97101
- name: Install emscripten
98102
uses: mymindstorm/setup-emsdk@v4
99103

100104
- name: Build WebAssembly module
101105
run: make build-wasm
102106

103107
- name: Start web server for hosting files in background
104-
run: make host-files &
108+
run: make host-files 2>&1 | tee ./web-server.log &
105109

106110
- name: Run tests
107111
run: make test-wasm
112+
113+
- name: Upload log of web server
114+
if: ${{ always() }}
115+
uses: actions/upload-artifact@v2
116+
with:
117+
name: web-server-log
118+
path: ./web-server.log

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ __pycache__/
44
cypress/plugins
55
cypress/support
66
cypress/videos
7+
8+
# Ignore compiled files
9+
bin/newtonraphson.exe
10+
src/py/newtonraphsonpy.*.so
11+
apache2/cgi-bin/newtonraphson
12+
src/js/newtonraphsonwasm.js
13+
src/js/newtonraphsonwasm.wasm
14+
15+
# Ignore entangled db
16+
.entangled/db.sqlite

.zenodo.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
22
"creators": [
33
{
4-
"affiliation": "Netherlands eScience Center",
5-
"name": "Verhoeven, Stefan",
4+
"affiliation": "Netherlands eScience Center",
5+
"name": "Verhoeven, Stefan",
66
"orcid": "0000-0002-5821-2060"
7-
},
7+
},
88
{
9-
"affiliation": "Netherlands eScience Center",
10-
"name": "Spaaks, Jurriaan H.",
9+
"affiliation": "Netherlands eScience Center",
10+
"name": "Spaaks, Jurriaan H.",
1111
"orcid": "0000-0002-7064-4069"
12-
},
12+
},
1313
{
14-
"affiliation": "Netherlands eScience Center",
15-
"name": "Diblen, Faruk",
14+
"affiliation": "Netherlands eScience Center",
15+
"name": "Diblen, Faruk",
1616
"orcid": "0000-0002-0989-929X"
1717
}
18-
],
19-
"description": "Guide to make C++ available as a web application",
18+
],
19+
"description": "Guide to make C++ available as a web application",
2020
"keywords": [
21-
"C++",
22-
"Web Assembly",
23-
"guide",
21+
"C++",
22+
"Web Assembly",
23+
"guide",
2424
"web application"
25-
],
25+
],
2626
"license": {
2727
"id": "Apache-2.0"
28-
},
28+
},
2929
"title": "cpp2wasm"
3030
}

0 commit comments

Comments
 (0)