5050 run : ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make all
5151 - name : Restore wasm
5252 # As we want to analyse files in git not files we just build
53- run : git restore src/js/ newtonraphsonwasm.js src/js /newtonraphsonwasm.wasm
53+ run : git restore webassembly/ newtonraphsonwasm.js webassembly /newtonraphsonwasm.wasm
5454 - name : Relativize bw-output
5555 # Build wrapper runs on CI server while sonar-scanner runs in Docker container need to adjust paths
5656 run : perl -pi -e 's@/home/runner/work/cpp2wasm/cpp2wasm@/github/workspace@g' bw-output/build-wrapper-dump.json
5959 env :
6060 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6161 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
62- cpp :
62+ cli :
6363 # The type of runner that the job will run on
6464 runs-on : ubuntu-latest
6565
@@ -68,11 +68,64 @@ jobs:
6868 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6969 - uses : actions/checkout@v2
7070
71- - name : Run C++ examples
72- run : make test-cli test-cgi
73- python :
71+ - name : Run C++ test for CLI
72+ run : make test-cli
73+ cgi :
7474 # The type of runner that the job will run on
75- name : Python ${{ matrix.python-version }}
75+ runs-on : ubuntu-latest
76+
77+ # Steps represent a sequence of tasks that will be executed as part of the job
78+ steps :
79+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
80+ - uses : actions/checkout@v2
81+
82+ - name : Run C++ test for CGI
83+ run : make test-cgi
84+ openapi :
85+ # The type of runner that the job will run on
86+ name : openapi / python-${{ matrix.python-version }}
87+ runs-on : ubuntu-latest
88+ strategy :
89+ matrix :
90+ python-version : [3.6, 3.7, 3.8]
91+ fail-fast : true
92+ steps :
93+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
94+ - uses : actions/checkout@v2
95+
96+ - name : Set up Python ${{ matrix.python-version }}
97+ uses : actions/setup-python@v1
98+ with :
99+ python-version : ${{ matrix.python-version }}
100+ architecture : " x64"
101+
102+ - name : Which Python
103+ run : which python
104+
105+ - name : Install Python dependencies
106+ run : make openapi-deps
107+
108+ - name : Run Python example
109+ run : make test-py
110+
111+ - name : Start web service in background
112+ run : |
113+ make run-webservice 2>&1 | tee ./run-webservice.log &
114+ # Wait for web service to spin up
115+ sleep 1
116+
117+ - name : Test web service
118+ run : make test-webservice
119+
120+ - name : Upload log of services
121+ if : ${{ always() }}
122+ uses : actions/upload-artifact@v2
123+ with :
124+ name : openapi-service-logs
125+ path : ./run-*.log
126+ flask :
127+ # The type of runner that the job will run on
128+ name : flask / python-${{ matrix.python-version }}
76129 runs-on : ubuntu-latest
77130 strategy :
78131 matrix :
@@ -98,34 +151,35 @@ jobs:
98151 run : which python
99152
100153 - name : Install Python dependencies
101- run : make py -deps && pip install httpie
154+ run : make flask -deps && pip install httpie
102155
103- - name : Run Python example
104- run : make test-py
156+ - name : Build shared library and link to it
157+ run : |
158+ make flask/newtonraphsonpy.*.so
105159
106160 - name : Start web application in background
107- run : make run-webapp 2>&1 | tee ./run-webapp.log &
161+ run : |
162+ make run-webapp 2>&1 | tee ./run-webapp.log &
163+ # Wait for web application to spin up
164+ sleep 1
108165
109166 - name : Test web application
110167 run : http --ignore-stdin -f localhost:5001 epsilon=0.001 guess=-20
111168
112- - name : Start web service in background
113- run : make run-webservice 2>&1 | tee ./run-webservice.log &
114-
115- - name : Test web service
116- run : make test-webservice
117-
118169 - name : Start Celery web app in background
119- run : make run-celery-webapp 2>&1 | tee ./run-celery-webapp.log &
170+ run : |
171+ make run-celery-webapp 2>&1 | tee ./run-celery-webapp.log &
120172
121173 - name : Start Celery worker in background
122174 run : |
123- cd src/py
175+ cd flask
124176 PYTHONPATH=$PWD/../.. celery -A tasks worker 2>&1 | tee ./run-celery-worker.log &
125177 cd ../..
126178
127179 - name : Test Celery web app
128180 run : |
181+ # Wait for web celery app and worker to spin up
182+ sleep 1
129183 http --ignore-stdin -hf localhost:5000 epsilon=0.001 guess=-20 | tee response.txt
130184 # Parse result url from response
131185 RESULT_URL=$(cat response.txt |grep Location |awk '{print $2}')
@@ -136,9 +190,9 @@ jobs:
136190 if : ${{ always() }}
137191 uses : actions/upload-artifact@v2
138192 with :
139- name : service-logs
193+ name : flask- service-logs
140194 path : ./run-*.log
141- wasm :
195+ webassembly :
142196 runs-on : ubuntu-latest
143197 steps :
144198 - uses : actions/checkout@v2
@@ -153,14 +207,37 @@ jobs:
153207 run : make build-wasm
154208
155209 - name : Start web server for hosting files in background
156- run : make host-files 2>&1 | tee ./web-server.log &
210+ run : make host-webassembly-files 2>&1 | tee ./web-server.log &
211+
212+ - name : Run tests
213+ run : make test-webassembly
214+
215+ - name : Upload log of web server
216+ if : ${{ always() }}
217+ uses : actions/upload-artifact@v2
218+ with :
219+ name : webassembly-service-log
220+ path : ./web-server.log
221+ react :
222+ runs-on : ubuntu-latest
223+ steps :
224+ - uses : actions/checkout@v2
225+
226+ - name : Install emscripten
227+ uses : mymindstorm/setup-emsdk@v4
228+
229+ - name : Build WebAssembly module and link to it from react/
230+ run : make react/newtonraphsonwasm.js react/newtonraphsonwasm.wasm
231+
232+ - name : Start web server for hosting files in background
233+ run : make host-react-files 2>&1 | tee ./web-server.log &
157234
158235 - name : Run tests
159- run : make test-wasm
236+ run : make test-react
160237
161238 - name : Upload log of web server
162239 if : ${{ always() }}
163240 uses : actions/upload-artifact@v2
164241 with :
165- name : web-server -log
242+ name : react-service -log
166243 path : ./web-server.log
0 commit comments