Skip to content

Commit edb11fa

Browse files
hhugovouillon
authored andcommitted
Github action to setup binaryen
1 parent ad0fee8 commit edb11fa

File tree

2 files changed

+11
-106
lines changed

2 files changed

+11
-106
lines changed

.github/workflows/build-wasm_of_ocaml.yml

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,6 @@ jobs:
4545
with:
4646
node-version: 23
4747

48-
- name: Restore cached binaryen
49-
id: cache-binaryen
50-
uses: actions/cache/restore@v4
51-
with:
52-
path: binaryen
53-
key: ${{ runner.os }}-binaryen-version_118
54-
55-
- name: Checkout binaryen
56-
if: steps.cache-binaryen.outputs.cache-hit != 'true'
57-
uses: actions/checkout@v4
58-
with:
59-
repository: WebAssembly/binaryen
60-
path: binaryen
61-
submodules: true
62-
ref: version_118
63-
64-
- name: Install ninja (Ubuntu)
65-
if: matrix.os == 'ubuntu-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
66-
run: sudo apt-get install ninja-build
67-
68-
- name: Install ninja (MacOS)
69-
if: matrix.os == 'macos-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
70-
run: brew install ninja
71-
72-
- name: Build binaryen
73-
if: steps.cache-binaryen.outputs.cache-hit != 'true'
74-
working-directory: ./binaryen
75-
run: |
76-
cmake -G Ninja .
77-
ninja
78-
79-
- name: Cache binaryen
80-
if: steps.cache-binaryen.outputs.cache-hit != 'true'
81-
uses: actions/cache/save@v4
82-
with:
83-
path: binaryen
84-
key: ${{ runner.os }}-binaryen-version_118
85-
86-
- name: Set binaryen's path
87-
run: |
88-
echo "$GITHUB_WORKSPACE/binaryen/bin" >> $GITHUB_PATH
89-
9048
- name: Install OCaml ${{ matrix.ocaml-compiler }}
9149
uses: ocaml/setup-ocaml@v3
9250
with:
@@ -97,6 +55,12 @@ jobs:
9755
with:
9856
path: wasm_of_ocaml
9957

58+
- name: Set-up Binaryen
59+
uses: Aandreba/[email protected]
60+
with:
61+
version: 118
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
10064
- name: Pin faked binaryen-bin package
10165
# It's faster to use a cached version
10266
run: opam install --fake binaryen-bin

.github/workflows/build.yml

Lines changed: 5 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -115,65 +115,11 @@ jobs:
115115
- run: opam install conf-pkg-config
116116
if: runner.os == 'Windows'
117117

118-
- name: Restore cached binaryen
119-
id: cache-binaryen
120-
uses: actions/cache/restore@v4
118+
- name: Set-up Binaryen
119+
uses: Aandreba/[email protected]
121120
with:
122-
path: binaryen
123-
key: ${{ runner.os }}-binaryen-version_118
124-
125-
- name: Checkout binaryen
126-
if: steps.cache-binaryen.outputs.cache-hit != 'true'
127-
uses: actions/checkout@v4
128-
with:
129-
repository: WebAssembly/binaryen
130-
path: binaryen
131-
submodules: true
132-
ref: version_118
133-
134-
- name: Install ninja (Ubuntu)
135-
if: matrix.os == 'ubuntu-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
136-
run: sudo apt-get install ninja-build
137-
138-
- name: Install ninja (MacOS)
139-
if: matrix.os == 'macos-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
140-
run: brew install ninja
141-
142-
- name: Build binaryen
143-
if: matrix.os != 'windows-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
144-
working-directory: ./binaryen
145-
run: |
146-
cmake -G Ninja .
147-
ninja
148-
149-
- name: Install binaryen build dependencies (Windows)
150-
if: matrix.os == 'windows-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
151-
working-directory: ./binaryen
152-
run: opam install conf-cmake conf-c++
153-
154-
- name: Build binaryen (Windows)
155-
if: matrix.os == 'windows-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
156-
working-directory: ./binaryen
157-
run: |
158-
opam exec -- cmake . -DBUILD_STATIC_LIB=ON -DBUILD_TESTS=off -DINSTALL_LIBS=off -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
159-
make -j 4
160-
161-
- name: Cache binaryen
162-
if: steps.cache-binaryen.outputs.cache-hit != 'true'
163-
uses: actions/cache/save@v4
164-
with:
165-
path: binaryen
166-
key: ${{ runner.os }}-binaryen-version_118
167-
168-
- name: Set binaryen's path
169-
shell: bash
170-
run: echo "$GITHUB_WORKSPACE/binaryen/bin" >> $GITHUB_PATH
171-
172-
- name: Copy binaryen's tools (Windows)
173-
if: matrix.os == 'windows-latest'
174-
shell: bash
175-
# Somehow, setting the path above does not work
176-
run: cp $GITHUB_WORKSPACE/binaryen/bin/wasm-{merge,opt}.exe _opam/bin
121+
version: 118
122+
token: ${{ secrets.GITHUB_TOKEN }}
177123

178124
- name: Install faked binaryen-bin package
179125
# It's faster to use a cached version
@@ -182,15 +128,10 @@ jobs:
182128
- run: opam install . --best-effort
183129
if: ${{ matrix.skip-test }}
184130

185-
- run: cat VERSION | xargs opam pin . -n --with-version
131+
- run: cat VERSION | xargs opam pin . -n --with-version
186132
if: ${{ !matrix.skip-test }}
187133
shell: bash
188134

189-
- run: opam install conf-c++
190-
# Otherwise, the next step fails reinstalling gcc while compiling
191-
# other packages
192-
if: ${{ !matrix.skip-test && runner.os == 'Windows' }}
193-
194135
- run: opam install . --with-test --deps-only
195136
# Install the test dependencies
196137
if: ${{ !matrix.skip-test }}

0 commit comments

Comments
 (0)