1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: add windows and macos jobs for checking the wasm backend too (#17451)

This commit is contained in:
Delyan Angelov 2023-03-01 21:53:03 +02:00 committed by GitHub
parent cdc0159c6e
commit e2daa84a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 30 deletions

View File

@ -72,24 +72,48 @@ jobs:
- name: Build examples
run: VTEST_ONLY=wasm ./v build-examples
## wasm-backend-macos:
## runs-on: macOS-12
## if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
## timeout-minutes: 121
## steps:
## - uses: actions/checkout@v3
##
## - name: Build V
## run: make -j4 && ./v symlink -githubci
##
## - name: Install binaryen as build dependency for the V WASM backend
## run: ./v cmd/tools/install_binaryen.vsh
##
## - name: Build the V WASM backend
## run: ./v -cc clang -showcc -v cmd/tools/builders/wasm_builder.v
##
## - name: Test the WASM backend
## run: ./v test vlib/v/gen/wasm/tests/
##
## - name: Build examples
## run: VTEST_ONLY=wasm ./v build-examples
wasm-backend-macos:
runs-on: macOS-12
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
steps:
- uses: actions/checkout@v3
- name: Build V
run: make -j4 && ./v symlink -githubci
- name: Install binaryen as build dependency for the V WASM backend
run: ./v cmd/tools/install_binaryen.vsh
- name: Build the V WASM backend
run: ./v -cc clang -showcc -v cmd/tools/builders/wasm_builder.v
- name: Test the WASM backend
run: ./v test vlib/v/gen/wasm/tests/
- name: Build examples
run: VTEST_ONLY=wasm ./v build-examples
wasm-backend-windows:
runs-on: windows-2022
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
steps:
- uses: actions/checkout@v3
- name: Build V
run: .\make.bat -msvc
- name: Symlink V
run: .\v.exe symlink -githubci
- name: Install binaryen as build dependency for the V WASM backend
run: v cmd/tools/install_binaryen.vsh
- name: Build the V WASM backend
run: v -cc msvc -showcc -v cmd/tools/builders/wasm_builder.v
- name: Test the WASM backend
run: v -stats test vlib/v/gen/wasm/tests/
- name: Build examples
run: $env:VTEST_ONLY='wasm'; v build-examples

View File

@ -1,8 +1,9 @@
#!/usr/bin/env -S v -raw-vsh-tmp-prefix tmp
import net.http
import json
import os
import net.http
const github_job = os.getenv('GITHUB_JOB')
struct JQ {
tag_name string
@ -21,8 +22,16 @@ fn main() {
exit(1)
}
/*
// TODO: add retries here, github requests can fail
jq := http.get_text('https://api.github.com/repos/WebAssembly/binaryen/releases/latest')
tag := json.decode(JQ, jq)!.tag_name
if github_job != '' {
dump(jq)
dump(tag)
}
*/
tag := 'version_112'
name := $if windows {
'x86_64-windows'
@ -50,9 +59,6 @@ fn main() {
// defer { os.rm(saveloc) or {}! }
}
mkdir_all(loc)!
println(loc)
println('Extracting `${tloc}/${fname}` to `${tloc}/binaryen` ...')
cmd := 'tar -xvf ${saveloc} --directory ${tloc}'
if os.system(cmd) != 0 {

View File

@ -1,10 +1,19 @@
[translated]
module binaryen
#flag -I@VEXEROOT/thirdparty/binaryen/include
#flag -L@VEXEROOT/thirdparty/binaryen/lib
#flag -lbinaryen -lstdc++
#flag darwin -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,@VEXEROOT/thirdparty/binaryen/lib
$if dynamic_binaryen ? {
#flag -lbinaryen
} $else {
#flag -lbinaryen
#flag -I@VEXEROOT/thirdparty/binaryen/include
#flag -L@VEXEROOT/thirdparty/binaryen/lib
#flag darwin -lc++ -Wl,-rpath,"@executable_path/../../../thirdparty/binaryen/lib"
// the following, allows linking to the binaryen package from `brew install binaryen`, without having to run cmd/tools/install_binaryen.vsh first
#flag darwin -I/opt/homebrew/include -L/opt/homebrew/lib -Wl,-rpath,"/opt/homebrew/lib"
#flag linux -lstdc++
}
type Index = u32
type Type = u64