-
Notifications
You must be signed in to change notification settings - Fork 2
178 lines (146 loc) · 5.51 KB
/
node.js.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
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
tags: '*'
pull_request:
branches: [ master ]
release:
types: [ published ]
# see https://github.community/t/treating-warnings-as-errors-because-process-env-ci-true/18032
env:
CI: false
jobs:
build:
runs-on: ubuntu-latest
needs: [webasm_package]
strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v3
with:
name: wasm files
path: src
- name: Display structure of downloaded files
run: ls -R
working-directory: src
- uses: actions/download-artifact@v3
with:
name: wasm files
path: src/static/js
- name: Display structure of downloaded files
run: ls -R
working-directory: src/static/js
- run: npm ci
- run: npm run build --if-present
# - run: npm test
webasm_package:
runs-on: ubuntu-latest
# needs: [build]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Test submodule checkout
run: |
ls -al
ls -al library
- uses: mymindstorm/setup-emsdk@v12
- name: Cache compiled GSL
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: $HOME/usr
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/main.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Compile GSL
run: |
wget -q "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz"
mkdir $HOME/gsl-latest
tar -xzf gsl-latest.tar.gz -C $HOME/gsl-latest
mv $HOME/gsl-latest/** $HOME/gsl-latest/gsl
mkdir $HOME/usr
cd $HOME/gsl-latest/gsl/ && emconfigure ./configure --prefix=$HOME/usr --disable-shared && emmake make -j2 && emmake make install
ls -al $HOME/usr/lib/
- name: Compile libamtrack webassembly package
run: |
cp $HOME/usr/lib/libgsl.a library/distributions/JavaScript/
cp $HOME/usr/lib/libgslcblas.a library/distributions/JavaScript/
cd library/distributions/JavaScript && GSL_INCLUDE_DIRS=$HOME/usr/include GSL_LIBRARY=$HOME/usr/lib/libgsl.a GSL_CBLAS_LIBRARY=$HOME/usr/lib/libgslcblas.a ./compile_to_js.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: wasm files
path: |
library/distributions/JavaScript/output/libat.wasm
library/distributions/JavaScript/output/libat.js
if-no-files-found: error
retention-days: 5
test_and_deploy:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install 🔧
run: npm install
- uses: actions/download-artifact@v3
with:
name: wasm files
path: src
- name: Display structure of downloaded files
run: ls -R
working-directory: src
- uses: actions/download-artifact@v3
with:
name: wasm files
path: src/static/js
- name: Display structure of downloaded files
run: ls -R
working-directory: src/static/js
- name: Adjust build info
run: |
sed -i '6s/web/web_dev/' package.json
TZ=Europe/Warsaw
current_date_time="`date`"
sed -i 's/NO_DEPLOY_DATE/'"$current_date_time"'/' ./src/static/json/GlobalConfig.json
sed -i 's~NO_DEPLOY_BRANCH~'"${{ github.ref }}"'~' ./src/static/json/GlobalConfig.json
sed -i 's/NO_DEPLOY_COMMIT/'"${{ github.sha }}"'/' ./src/static/json/GlobalConfig.json
- name: webfactory/ssh-agent
if: github.ref == 'refs/heads/master'
uses: webfactory/ssh-agent@v0.8.0
with:
# Private SSH key to register in the SSH agent
ssh-private-key: ${{ secrets.WEBDEV }}
- name: Deploy to development server
if: github.ref == 'refs/heads/master'
run: |
git remote set-url origin git@github.com:libamtrack/web_dev.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>" -r "git@github.com:libamtrack/web_dev.git"
- name: Prepare production version to deploy
run: |
npm run build
- name: Deploy to production server 🚀
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist