Debian Codegraph @

.github/workflows/emscripten.yml

raw
1 name: CI emscripten
2
3 # Controls when the action will run.
4 on:
5 # Triggers the workflow on push or pull request events but only for the master branch
6 push:
7 branches: [ master ]
8 pull_request:
9 branches: [ master ]
10
11 # Allows you to run this workflow manually from the Actions tab
12 workflow_dispatch:
13
14
15 env:
16 PYODIDE_VERSION: 0.58.4
17 # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
18 # The appropriate versions can be found in the Pyodide repodata.json
19 # "info" field, or in Makefile.envs:
20 # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
21 PYTHON_VERSION: 3.12.7
22 EMSCRIPTEN_VERSION: 4.0.10
23 EM_CACHE_FOLDER: emsdk-cache
24
25 jobs:
26 setup-emsdk-cache:
27 runs-on: ubuntu-22.04
28 steps:
29 - name: Setup cache
30 uses: actions/cache@v4
31 with:
32 path: ${{ env.EM_CACHE_FOLDER }}
33 key: ${{ env.EMSCRIPTEN_VERSION }}
34
35 - name: Setup emsdk
36 uses: mymindstorm/setup-emsdk@v14
37 with:
38 version: ${{ env.EMSCRIPTEN_VERSION }}
39 actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
40
41 test-dejagnu:
42 strategy:
43 matrix:
44 target:
45 - name: wasm32
46 host: wasm32
47 configureflags:
48 testflags:
49 - name: wasm64
50 host: wasm64
51 configureflags:
52 testflags: -sMEMORY64=1
53 - name: wasm64-2
54 host: wasm64
55 configureflags: WASM64_MEMORY64=2
56 testflags: -sMEMORY64=2
57 runs-on: ubuntu-24.04
58 needs: [setup-emsdk-cache]
59 steps:
60 - name: Checkout
61 uses: actions/checkout@v4
62
63 - name: Setup Python
64 uses: actions/setup-python@v5
65 with:
66 python-version: ${{ env.PYTHON_VERSION }}
67
68 - name: Setup cache
69 uses: actions/cache@v4
70 with:
71 path: ${{ env.EM_CACHE_FOLDER }}
72 key: ${{ env.EMSCRIPTEN_VERSION }}
73
74 - name: Setup emsdk
75 uses: mymindstorm/setup-emsdk@v14
76 with:
77 version: ${{ env.EMSCRIPTEN_VERSION }}
78 actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
79
80 - name: Setup node.js
81 uses: actions/setup-node@v4
82 with:
83 node-version: 24
84
85 # This step updates emsdk's configuration file ".emscripten" to point to
86 # nodejs installed in the previous step.
87 - name: Configure emsdk to use the installed node.js
88 run: sed -i -E 's|NODE_JS = .*|NODE_JS = '"'$(which node)'"'|g' ${EMSDK}/.emscripten
89
90 - name: Install dependencies
91 run: sudo apt-get install dejagnu libltdl-dev
92
93 - name: Run tests
94 run: testsuite/emscripten/node-tests.sh
95 env:
96 TARGET_HOST: ${{ matrix.target.host }}
97 EXTRA_CONFIGURE_FLAGS: ${{ matrix.target.configureflags }}
98 EXTRA_CFLAGS: ${{ matrix.target.testflags }}
99 EXTRA_TEST_LDFLAGS: ${{ matrix.target.testflags }}
100
101 - name: Install rlgl and run
102 run: |
103 wget -qO - https://rl.gl/cli/rlgl-linux-amd64.tgz | \
104 tar --strip-components=2 -xvzf - ./rlgl/rlgl;
105 ./rlgl l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
106 ./rlgl e -l project=libffi -l sha=${GITHUB_SHA:0:7} -l CC='emcc' -l host=wasm32-unknown-linux --policy=https://github.com/libffi/rlgl-policy.git testsuite/libffi.log
107 exit $?
108
109 build:
110 strategy:
111 matrix:
112 target:
113 - name: wasm32
114 host: wasm32
115 configureflags:
116 testflags:
117 - name: wasm64
118 host: wasm64
119 configureflags:
120 testflags: -sMEMORY64=1
121 - name: wasm64-2
122 host: wasm64
123 configureflags: WASM64_MEMORY64=2
124 testflags: -sMEMORY64=2
125 runs-on: ubuntu-24.04
126 needs: [setup-emsdk-cache]
127 steps:
128 - name: Checkout
129 uses: actions/checkout@v4
130
131 - name: Setup cache
132 uses: actions/cache@v4
133 with:
134 path: ${{ env.EM_CACHE_FOLDER }}
135 key: ${{ env.EMSCRIPTEN_VERSION }}
136
137 - name: Setup emsdk
138 uses: mymindstorm/setup-emsdk@v12
139 with:
140 version: ${{ env.EMSCRIPTEN_VERSION }}
141 actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
142
143 - name: Install dependencies
144 run: sudo apt-get install libltdl-dev
145
146 - name: Build
147 run: ./testsuite/emscripten/build.sh
148 env:
149 TARGET_HOST: ${{ matrix.target.host }}
150 EXTRA_CONFIGURE_FLAGS: ${{ matrix.target.configureflags }}
151
152 - name: Build tests
153 run: |
154 cp -r testsuite/libffi.call testsuite/libffi.call.test
155 cp -r testsuite/libffi.closures testsuite/libffi.closures.test
156 ./testsuite/emscripten/build-tests.sh testsuite/libffi.call.test
157 ./testsuite/emscripten/build-tests.sh testsuite/libffi.closures.test
158 env:
159 EXTRA_CFLAGS: ${{ matrix.target.testflags }}
160 EXTRA_LD_FLAGS: ${{ matrix.target.testflags }}
161
162 - name: Store artifacts
163 uses: actions/upload-artifact@v4
164 with:
165 name: built-tests-${{ matrix.target.name }}
166 path: ./testsuite/libffi.c*/
167
168 test:
169 strategy:
170 matrix:
171 target:
172 - name: wasm32
173 - name: wasm64
174 - name: wasm64-2
175 browser: ["chrome"]
176 # FIXME: selenium can't find gecko driver for "firefox"
177 runs-on: ubuntu-24.04
178 needs: [build]
179 steps:
180 - name: Checkout
181 uses: actions/checkout@v4
182
183 - name: Download build artifact
184 uses: actions/download-artifact@v4
185 with:
186 name: built-tests-${{ matrix.target.name }}
187 path: ./testsuite/
188
189 - uses: conda-incubator/setup-miniconda@v3
190 with:
191 activate-environment: pyodide-env
192 python-version: ${{ env.PYTHON_VERSION }}
193 channels: conda-forge
194
195 - name: Install test dependencies
196 run: pip install pytest-pyodide==${{ env.PYODIDE_VERSION }}
197
198 - name: Run tests
199 run: |
200 cd testsuite/emscripten/
201 mkdir test-results
202 pytest \
203 --junitxml=test-results/junit.xml \
204 test_libffi.py \
205 -k ${{ matrix.browser }} \
206 -s
207
208 - name: Install rlgl and run
209 if: success() || failure()
210 run: |
211 wget -qO - https://rl.gl/cli/rlgl-linux-amd64.tgz | \
212 tar --strip-components=2 -xvzf - ./rlgl/rlgl;
213 ./rlgl l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
214 ./rlgl e -l project=libffi -l sha=${GITHUB_SHA:0:7} -l CC='emcc' -l host=${{ matrix.browser }} --policy=https://github.com/libffi/rlgl-policy.git testsuite/emscripten/test-results/junit.xml
215 exit $?