From bc0678ad46bc79ef1a121424d9768f3be87a4154 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Fri, 25 Oct 2024 18:07:07 +0200 Subject: [PATCH 01/23] feat(llvm): Implement the missing relocations on aarch64 --- lib/compiler-llvm/src/config.rs | 2 + lib/compiler-llvm/src/object_file.rs | 25 +++++++++++++ .../src/translator/intrinsics.rs | 4 -- lib/compiler/src/engine/link.rs | 26 +++++++++++++ lib/types/src/compilation/relocation.rs | 37 ++++++++++++++++++- 5 files changed, 88 insertions(+), 6 deletions(-) diff --git a/lib/compiler-llvm/src/config.rs b/lib/compiler-llvm/src/config.rs index 5d76872ec46..c30776406f9 100644 --- a/lib/compiler-llvm/src/config.rs +++ b/lib/compiler-llvm/src/config.rs @@ -119,11 +119,13 @@ impl LLVM { // but not in the case of Aarch64, there the ABI is slightly different #[allow(clippy::match_single_binding)] match target.triple().architecture { + Architecture::Aarch64(_) => wasmer_types::OperatingSystem::Darwin, _ => wasmer_types::OperatingSystem::Linux, } } else { target.triple().operating_system }; + let binary_format = if self.is_pic { target.triple().binary_format } else { diff --git a/lib/compiler-llvm/src/object_file.rs b/lib/compiler-llvm/src/object_file.rs index 06b196326ed..ab0c8c8a936 100644 --- a/lib/compiler-llvm/src/object_file.rs +++ b/lib/compiler-llvm/src/object_file.rs @@ -251,6 +251,31 @@ where object::RelocationKind::Elf(object::elf::R_LARCH_ABS64_LO20), 0, ) => RelocationKind::LArchAbs64Lo20, + object::Architecture::Aarch64, + object::RelocationKind::Elf(object::elf::R_AARCH64_ADR_PREL_LO21), + 0, + ) => RelocationKind::Aarch64AdrPrelLo21, + ( + object::Architecture::Aarch64, + object::RelocationKind::Elf(object::elf::R_AARCH64_ADR_PREL_PG_HI21), + 0, + ) => RelocationKind::Aarch64AdrPrelPgHi21, + ( + object::Architecture::Aarch64, + object::RelocationKind::Elf(object::elf::R_AARCH64_LDST128_ABS_LO12_NC), + 0, + ) => RelocationKind::Aarch64Ldst128AbsLo12Nc, + ( + object::Architecture::Aarch64, + object::RelocationKind::Elf(object::elf::R_AARCH64_ADD_ABS_LO12_NC), + 0, + ) => RelocationKind::Aarch64AddAbsLo12Nc, + ( + object::Architecture::Aarch64, + object::RelocationKind::Elf(object::elf::R_AARCH64_LDST64_ABS_LO12_NC), + 0, + ) => RelocationKind::Aarch64Ldst64AbsLo12Nc, + _ => { return Err(CompileError::Codegen(format!( "unknown relocation {:?}", diff --git a/lib/compiler-llvm/src/translator/intrinsics.rs b/lib/compiler-llvm/src/translator/intrinsics.rs index ca48b07e533..3585af37399 100644 --- a/lib/compiler-llvm/src/translator/intrinsics.rs +++ b/lib/compiler-llvm/src/translator/intrinsics.rs @@ -1104,10 +1104,6 @@ impl<'ctx> Intrinsics<'ctx> { intrinsics .throw_trap .add_attribute(AttributeLoc::Function, noreturn); - //intrinsics - // .func_ref - // .add_attribute(AttributeLoc::Function, intrinsics.readonly); - intrinsics } } diff --git a/lib/compiler/src/engine/link.rs b/lib/compiler/src/engine/link.rs index a3fc64dd2da..1db5f7fed81 100644 --- a/lib/compiler/src/engine/link.rs +++ b/lib/compiler/src/engine/link.rs @@ -146,6 +146,32 @@ fn apply_relocation( | read_unaligned(reloc_address as *mut u32); write_unaligned(reloc_address as *mut u32, reloc_abs); }, + RelocationKind::Aarch64AdrPrelPgHi21 | RelocationKind::Aarch64AdrPrelLo21 => unsafe { + let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); + let reloc_delta = ((((reloc_delta >> 62) & 0xff) as u32) << 29) + | ((((reloc_delta >> 5) & 0b11111) as u32) << 5) + | read_unaligned(reloc_address as *mut u32); + write_unaligned(reloc_address as *mut u32, reloc_delta); + }, + + RelocationKind::Aarch64AddAbsLo12Nc => unsafe { + let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); + let reloc_delta = (reloc_delta as u32 & 0xfff) + | (read_unaligned(reloc_address as *mut u32) & 0xFFC003FF); + write_unaligned(reloc_address as *mut u32, reloc_delta); + }, + RelocationKind::Aarch64Ldst128AbsLo12Nc => unsafe { + let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); + let reloc_delta = ((reloc_delta as u32 & 0xfff) >> 4) << 10 + | (read_unaligned(reloc_address as *mut u32) & 0xFFC003FF); + write_unaligned(reloc_address as *mut u32, reloc_delta); + }, + RelocationKind::Aarch64Ldst64AbsLo12Nc => unsafe { + let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); + let reloc_delta = ((reloc_delta as u32 & 0xfff) >> 3) << 10 + | (read_unaligned(reloc_address as *mut u32) & 0xFFC003FF); + write_unaligned(reloc_address as *mut u32, reloc_delta); + }, kind => panic!( "Relocation kind unsupported in the current architecture {}", kind diff --git a/lib/types/src/compilation/relocation.rs b/lib/types/src/compilation/relocation.rs index 54060c9f6f2..f714542b2bf 100644 --- a/lib/types/src/compilation/relocation.rs +++ b/lib/types/src/compilation/relocation.rs @@ -46,6 +46,22 @@ pub enum RelocationKind { X86CallPLTRel4, /// x86 GOT PC-relative 4-byte X86GOTPCRel4, + + /// R_AARCH64_ADR_PREL_LO21 + Aarch64AdrPrelLo21, + + /// R_AARCH64_ADR_PREL_PG_HI21 + Aarch64AdrPrelPgHi21, + + /// R_AARCH64_ADD_ABS_LO12_NC + Aarch64AddAbsLo12Nc, + + /// R_AARCH64_LDST128_ABS_LO12_NC + Aarch64Ldst128AbsLo12Nc, + + /// R_AARCH64_LDST64_ABS_LO12_NC + Aarch64Ldst64AbsLo12Nc, + /// Arm32 call target Arm32Call, /// Arm64 call target @@ -102,6 +118,11 @@ impl fmt::Display for RelocationKind { Self::LArchAbsLo12 => write!(f, "LArchAbsLo12"), Self::LArchAbs64Hi12 => write!(f, "LArchAbs64Hi12"), Self::LArchAbs64Lo20 => write!(f, "LArchAbs64Lo20"), + Self::Aarch64AdrPrelLo21 => write!(f, "Aarch64AdrPrelLo21"), + Self::Aarch64AdrPrelPgHi21 => write!(f, "Aarch64AdrPrelPgHi21"), + Self::Aarch64AddAbsLo12Nc => write!(f, "Aarch64AddAbsLo12Nc"), + Self::Aarch64Ldst128AbsLo12Nc => write!(f, "Aarch64Ldst128AbsLo12Nc"), + Self::Aarch64Ldst64AbsLo12Nc => write!(f, "Aarch64Ldst64AbsLo12Nc"), // Self::MachOX86_64Tlv => write!(f, "MachOX86_64Tlv"), } } @@ -142,7 +163,10 @@ pub trait RelocationLike { | RelocationKind::Arm64Movw1 | RelocationKind::Arm64Movw2 | RelocationKind::Arm64Movw3 - | RelocationKind::RiscvPCRelLo12I => { + | RelocationKind::RiscvPCRelLo12I + | RelocationKind::Aarch64AddAbsLo12Nc + | RelocationKind::Aarch64Ldst128AbsLo12Nc + | RelocationKind::Aarch64Ldst64AbsLo12Nc => { let reloc_address = start + self.offset() as usize; let reloc_addend = self.addend() as isize; let reloc_abs = target_func_address @@ -178,7 +202,8 @@ pub trait RelocationLike { } RelocationKind::Arm64Call | RelocationKind::RiscvCall - | RelocationKind::RiscvPCRelHi20 => { + | RelocationKind::RiscvPCRelHi20 + | RelocationKind::Aarch64AdrPrelLo21 => { let reloc_address = start + self.offset() as usize; let reloc_addend = self.addend() as isize; let reloc_delta_u32 = target_func_address @@ -186,6 +211,14 @@ pub trait RelocationLike { .wrapping_add(reloc_addend as u64); (reloc_address, reloc_delta_u32) } + RelocationKind::Aarch64AdrPrelPgHi21 => { + let reloc_address = start + self.offset() as usize; + let reloc_addend = self.addend() as isize; + let target_page = + (target_func_address.wrapping_add(reloc_addend as u64) & !(0xFFF)) as usize; + let pc_page = reloc_address & !(0xFFF); + (reloc_address, target_page.wrapping_sub(pc_page) as u64) + } _ => panic!("Relocation kind unsupported"), } } From 39ccfdbf158cc6e9335f793ad87f70003605392b Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Wed, 30 Oct 2024 17:41:32 +0100 Subject: [PATCH 02/23] feat(ci): Use LLVM with aarch64 --- .github/workflows/build.yml | 2 +- .github/workflows/test.yaml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fdedd59560f..7459cd99758 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,7 +119,7 @@ jobs: target: aarch64-apple-darwin artifact_name: 'wasmer-darwin-arm64' use_sccache: false - use_llvm: false + use_llvm: true build_wasm: false # [todo] xdoardo: Reinstate when the code we generate for aarch64 is working correctly. llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8b1545862e6..b12ecc4355a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -511,8 +511,7 @@ jobs: os: macos-14, target: aarch64-apple-darwin, exe: '', - # [todo] xdoardo: Reinstate when the code we generate for aarch64 is working correctly. - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' }, { build: windows-x64, @@ -765,8 +764,7 @@ jobs: os: macos-14, target: aarch64-apple-darwin, exe: '', - # [todo] xdoardo: Reinstate when the code we generate for aarch64 is working correctly. - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' }, { build: windows-x64, From 5eac95c4062cb80c22b5ac9d1b8bd02decdb7976 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Wed, 30 Oct 2024 17:42:11 +0100 Subject: [PATCH 03/23] feat(build): Reinstate riscv build --- .github/workflows/build.yml | 128 ++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7459cd99758..8a8655b9228 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -573,70 +573,70 @@ jobs: if-no-files-found: error retention-days: 2 - # linux_riscv64: - # name: Linux riscv64 - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: dtolnay/rust-toolchain@stable - # with: - # target: riscv64gc-unknown-linux-gnu - # - name: Build cross image - # run: | - # docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ - # env: - # CROSS_DOCKER_IN_DOCKER: true - # - name: Build Wasmer binary - # run: | - # make build-wasmer - # env: - # CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo - # CROSS_DOCKER_IN_DOCKER: true - # CARGO_TARGET: riscv64gc-unknown-linux-gnu - # PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig - # PKG_CONFIG_ALLOW_CROSS: true - # ENABLE_LLVM: 0 - # - name: Build C API headless - # shell: bash - # run: | - # make package-capi-headless - # env: - # CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo - # CROSS_DOCKER_IN_DOCKER: true - # CARGO_TARGET: riscv64gc-unknown-linux-gnu - # PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig - # PKG_CONFIG_ALLOW_CROSS: true - # ENABLE_LLVM: 0 - # TARGET: riscv64gc-unknown-linux-gnu - # TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release - # - name: Build C API - # run: | - # make build-capi - # env: - # CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo - # CROSS_DOCKER_IN_DOCKER: true - # CARGO_TARGET: riscv64gc-unknown-linux-gnu - # PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig - # PKG_CONFIG_ALLOW_CROSS: true - # ENABLE_LLVM: 0 - # - name: Dist - # run: | - # make distribution - # env: - # CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo - # CROSS_DOCKER_IN_DOCKER: true - # CARGO_TARGET: riscv64gc-unknown-linux-gnu - # PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig - # PKG_CONFIG_ALLOW_CROSS: true - # TARGET: riscv64gc-unknown-linux-gnu - # TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release - # - name: Upload Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: wasmer-linux-riscv64 - # path: dist - # if-no-files-found: error - # retention-days: 2 + linux_riscv64: + name: Linux riscv64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + target: riscv64gc-unknown-linux-gnu + - name: Build cross image + run: | + docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Build Wasmer binary + run: | + make build-wasmer + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + ENABLE_LLVM: 0 + - name: Build C API headless + shell: bash + run: | + make package-capi-headless + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + ENABLE_LLVM: 0 + TARGET: riscv64gc-unknown-linux-gnu + TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release + - name: Build C API + run: | + make build-capi + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + ENABLE_LLVM: 0 + - name: Dist + run: | + make distribution + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64:latest cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + TARGET: riscv64gc-unknown-linux-gnu + TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: wasmer-linux-riscv64 + path: dist + if-no-files-found: error + retention-days: 2 release: # needs: [setup, build, linux_aarch64, windows_gnu, linux_riscv64] From e45d8a9761d4e3a3a03ea3e56b2520c8cd160d97 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Wed, 30 Oct 2024 17:43:34 +0100 Subject: [PATCH 04/23] fix(llvm): Add missing parenthesis --- lib/compiler-llvm/src/object_file.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compiler-llvm/src/object_file.rs b/lib/compiler-llvm/src/object_file.rs index ab0c8c8a936..df1641d2706 100644 --- a/lib/compiler-llvm/src/object_file.rs +++ b/lib/compiler-llvm/src/object_file.rs @@ -251,6 +251,7 @@ where object::RelocationKind::Elf(object::elf::R_LARCH_ABS64_LO20), 0, ) => RelocationKind::LArchAbs64Lo20, + ( object::Architecture::Aarch64, object::RelocationKind::Elf(object::elf::R_AARCH64_ADR_PREL_LO21), 0, From c0b69c1cf87ee1fcff43933a0958cde3b5d60596 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Wed, 30 Oct 2024 18:00:43 +0100 Subject: [PATCH 05/23] chore: Make linter happy --- examples/memory.rs | 4 ++-- examples/table.rs | 1 - tests/compilers/artifact.rs | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/memory.rs b/examples/memory.rs index 2ea623bda39..26446387084 100644 --- a/examples/memory.rs +++ b/examples/memory.rs @@ -108,8 +108,8 @@ fn main() -> anyhow::Result<()> { // see how we can do that: println!("Growing memory..."); - // 'wasm-c-api' does not support direct calls to memory.grow() - #[cfg(not(feature = "wasm-c-api"))] + // 'wamr' does not support direct calls to memory.grow() + #[cfg(not(feature = "wamr"))] { // Here we are requesting two more pages for our memory. memory.grow(&mut store, 2)?; diff --git a/examples/table.rs b/examples/table.rs index cd74083694e..52e5b9f4589 100644 --- a/examples/table.rs +++ b/examples/table.rs @@ -154,7 +154,6 @@ fn main() -> anyhow::Result<()> { // This test is currently failing with: // not implemented: Native function definitions can't be directly called from the host yet -#[cfg(FALSE)] #[test] fn test_table() -> anyhow::Result<()> { main() diff --git a/tests/compilers/artifact.rs b/tests/compilers/artifact.rs index 334ec9d2af3..74881d10ed9 100644 --- a/tests/compilers/artifact.rs +++ b/tests/compilers/artifact.rs @@ -1,6 +1,5 @@ use std::{fs, path::PathBuf}; -use cfg_if::cfg_if; use wasmer::{Engine, Module}; #[test] From 7f7faae6a4ad981054b36b6129eaa6db96be7a5d Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Thu, 31 Oct 2024 17:37:39 +0100 Subject: [PATCH 06/23] fix(llvm/aarch64): Fix the `R_AARCH64_ADR_PREL_PG_HI21` relocation --- lib/compiler/src/engine/link.rs | 39 ++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/compiler/src/engine/link.rs b/lib/compiler/src/engine/link.rs index 1db5f7fed81..8cad61c0b57 100644 --- a/lib/compiler/src/engine/link.rs +++ b/lib/compiler/src/engine/link.rs @@ -146,14 +146,41 @@ fn apply_relocation( | read_unaligned(reloc_address as *mut u32); write_unaligned(reloc_address as *mut u32, reloc_abs); }, - RelocationKind::Aarch64AdrPrelPgHi21 | RelocationKind::Aarch64AdrPrelLo21 => unsafe { - let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); - let reloc_delta = ((((reloc_delta >> 62) & 0xff) as u32) << 29) - | ((((reloc_delta >> 5) & 0b11111) as u32) << 5) - | read_unaligned(reloc_address as *mut u32); - write_unaligned(reloc_address as *mut u32, reloc_delta); + RelocationKind::Aarch64AdrPrelPgHi21 => unsafe { + let (reloc_address, delta) = r.for_address(body, target_func_address as u64); + + let delta = delta as isize; + assert!( + (-1 << 32) <= delta && delta < (1 << 32), + "can't generate page-relative relocation with ±4GB `adrp` instruction" + ); + + let op = read_unaligned(reloc_address as *mut u32); + let delta = delta >> 12; + let immlo = ((delta as u32) & 0b11) << 29; + let immhi = (((delta as u32) >> 2) & 0x7ffff) << 5; + let mask = !((0x7ffff << 5) | (0b11 << 29)); + let op = (op & mask) | immlo | immhi; + + write_unaligned(reloc_address as *mut u32, op); }, + RelocationKind::Aarch64AdrPrelLo21 => unsafe { + let (reloc_address, delta) = r.for_address(body, target_func_address as u64); + + let delta = delta as isize; + assert!( + (-1 << 20) <= delta && delta < (1 << 20), + "can't generate an ADR_PREL_LO21 relocation with an immediate larger than 20 bits" + ); + let op = read_unaligned(reloc_address as *mut u32); + let immlo = ((delta as u32) & 0b11) << 29; + let immhi = (((delta as u32) >> 2) & 0x7ffff) << 5; + let mask = !((0x7ffff << 5) | (0b11 << 29)); + let op = (op & mask) | immlo | immhi; + + write_unaligned(reloc_address as *mut u32, op); + }, RelocationKind::Aarch64AddAbsLo12Nc => unsafe { let (reloc_address, reloc_delta) = r.for_address(body, target_func_address as u64); let reloc_delta = (reloc_delta as u32 & 0xfff) From ee40c61bf754ed017e80b667e174afa971f61952 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Thu, 31 Oct 2024 17:41:10 +0100 Subject: [PATCH 07/23] chore: Make linter happy --- lib/compiler/src/engine/link.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/compiler/src/engine/link.rs b/lib/compiler/src/engine/link.rs index 8cad61c0b57..2ceea692e19 100644 --- a/lib/compiler/src/engine/link.rs +++ b/lib/compiler/src/engine/link.rs @@ -2,6 +2,7 @@ use crate::get_libcall_trampoline; use crate::FunctionExtent; +use core::ops::RangeBounds; use std::collections::HashMap; use std::ptr::{read_unaligned, write_unaligned}; use wasmer_types::entity::PrimaryMap; @@ -151,7 +152,7 @@ fn apply_relocation( let delta = delta as isize; assert!( - (-1 << 32) <= delta && delta < (1 << 32), + ((-1 << 32)..(1 << 32)).contains(&delta), "can't generate page-relative relocation with ±4GB `adrp` instruction" ); @@ -169,7 +170,7 @@ fn apply_relocation( let delta = delta as isize; assert!( - (-1 << 20) <= delta && delta < (1 << 20), + ((-1 << 20)..(1 << 20)).contains(&delta) "can't generate an ADR_PREL_LO21 relocation with an immediate larger than 20 bits" ); From 8b9cc2316d5b936ba03b7db338435973cf07e403 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Thu, 31 Oct 2024 17:52:55 +0100 Subject: [PATCH 08/23] fix: missing comma --- lib/compiler/src/engine/link.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/compiler/src/engine/link.rs b/lib/compiler/src/engine/link.rs index 2ceea692e19..7aafeb82de9 100644 --- a/lib/compiler/src/engine/link.rs +++ b/lib/compiler/src/engine/link.rs @@ -2,7 +2,6 @@ use crate::get_libcall_trampoline; use crate::FunctionExtent; -use core::ops::RangeBounds; use std::collections::HashMap; use std::ptr::{read_unaligned, write_unaligned}; use wasmer_types::entity::PrimaryMap; @@ -170,7 +169,7 @@ fn apply_relocation( let delta = delta as isize; assert!( - ((-1 << 20)..(1 << 20)).contains(&delta) + ((-1 << 20)..(1 << 20)).contains(&delta), "can't generate an ADR_PREL_LO21 relocation with an immediate larger than 20 bits" ); From 1c49720550c075f465d58d1f3791822251214a80 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Thu, 31 Oct 2024 18:00:26 +0100 Subject: [PATCH 09/23] fix: add use of `cfg_if` --- tests/compilers/artifact.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compilers/artifact.rs b/tests/compilers/artifact.rs index 74881d10ed9..53eca021058 100644 --- a/tests/compilers/artifact.rs +++ b/tests/compilers/artifact.rs @@ -1,5 +1,4 @@ use std::{fs, path::PathBuf}; - use wasmer::{Engine, Module}; #[test] @@ -56,6 +55,7 @@ fn artifact_serialization_build() { #[test] #[cfg(target_arch = "x86_64")] fn artifact_deserialization_roundtrip() { + use cfg_if::cfg_if; // This test is included to make sure we don't break the serialized format // by mistake. Otherwise, everything in this test is already tested in // `artifact_serialization_roundtrip`. From c0354e42841b5291176ed8c73bf63802ef78807f Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Mon, 4 Nov 2024 12:30:35 +0100 Subject: [PATCH 10/23] fix: Use macos-15 in CI --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b12ecc4355a..7b9bac4d562 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -508,7 +508,7 @@ jobs: }, { build: macos-arm, - os: macos-14, + os: macos-15, target: aarch64-apple-darwin, exe: '', llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' From 7376a10372bfc5755cb25679f2a33f8b08738340 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Mon, 4 Nov 2024 13:08:21 +0100 Subject: [PATCH 11/23] fix: Use macos-13 in CI --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7b9bac4d562..cfdeb6e1714 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -508,7 +508,7 @@ jobs: }, { build: macos-arm, - os: macos-15, + os: macos-13, target: aarch64-apple-darwin, exe: '', llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' From 9b4b84382da24c4a6bbd74fc7df8ebf5d2fb3cd6 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Mon, 4 Nov 2024 13:17:42 +0100 Subject: [PATCH 12/23] fix: Restore use of macos-14 in CI --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cfdeb6e1714..b12ecc4355a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -508,7 +508,7 @@ jobs: }, { build: macos-arm, - os: macos-13, + os: macos-14, target: aarch64-apple-darwin, exe: '', llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' From fd9ed164208a6d8fb21b82be46044419287e2f44 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 12:07:42 +0100 Subject: [PATCH 13/23] fix: Exclude `wasmer-swift` from `build-docs` --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e527f883c0e..4f625e9499b 100644 --- a/Makefile +++ b/Makefile @@ -437,7 +437,7 @@ else endif build-docs: - $(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --release $(compiler_features) --document-private-items --no-deps --workspace --exclude wasmer-c-api --locked + $(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --release $(compiler_features) --document-private-items --no-deps --workspace --exclude wasmer-c-api --exclude wasmer-swift --locked # The tokio crate was excluded from the docs build because the code (which is not under our control) # does not currently compile its docs successfully From c22a73daef546b1516d6085de4e1aa263253ca18 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 12:20:59 +0100 Subject: [PATCH 14/23] Try not using the cached version of packages in tests --- lib/wasix/tests/runners.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/wasix/tests/runners.rs b/lib/wasix/tests/runners.rs index ae46aa2c61e..df7a22843b4 100644 --- a/lib/wasix/tests/runners.rs +++ b/lib/wasix/tests/runners.rs @@ -202,9 +202,9 @@ async fn download_cached(url: &str) -> bytes::Bytes { let cache_dir = tmp_dir().join("downloads"); let cached_path = cache_dir.join(file_name); - if cached_path.exists() { - return std::fs::read(&cached_path).unwrap().into(); - } + //if cached_path.exists() { + // return std::fs::read(&cached_path).unwrap().into(); + //} let response = client() .get(url) From 3072bddd199a7186132064be05cd8aabe7489707 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 12:55:47 +0100 Subject: [PATCH 15/23] Print stdout and stderr --- lib/wasix/tests/runners.rs | 40 ++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/wasix/tests/runners.rs b/lib/wasix/tests/runners.rs index df7a22843b4..19654854cb2 100644 --- a/lib/wasix/tests/runners.rs +++ b/lib/wasix/tests/runners.rs @@ -45,15 +45,17 @@ mod wasi { let (rt, tasks) = runtime(); let pkg = BinaryPackage::from_webc(&container, &rt).await.unwrap(); let mut stdout = virtual_fs::ArcFile::new(Box::::default()); + let mut stderr = virtual_fs::ArcFile::new(Box::::default()); let stdout_2 = stdout.clone(); + let stderr_2 = stderr.clone(); let handle = std::thread::spawn(move || { let _guard = tasks.runtime_handle().enter(); WasiRunner::new() .with_args(["--version"]) .with_stdin(Box::::default()) .with_stdout(Box::new(stdout_2) as Box<_>) - .with_stderr(Box::::default()) + .with_stderr(Box::::default()) .run_command("wat2wasm", &pkg, Arc::new(rt)) }); @@ -63,9 +65,18 @@ mod wasi { .expect("The runner encountered an error"); stdout.rewind().await.unwrap(); - let mut output = Vec::new(); - stdout.read_to_end(&mut output).await.unwrap(); - assert_eq!(String::from_utf8(output).unwrap(), "1.0.37 (git~v1.0.37)\n"); + stderr.rewind().await.unwrap(); + let mut stdout_buf = Vec::new(); + let mut stderr_buf = Vec::new(); + stdout.read_to_end(&mut stdout_buf).await.unwrap(); + stderr.read_to_end(&mut stderr_buf).await.unwrap(); + let stdout = String::from_utf8(stdout_buf).unwrap(); + let stderr = String::from_utf8(stderr_buf).unwrap(); + + eprintln!("{stdout}"); + eprintln!("{stderr}"); + + assert_eq!(stdout, "1.0.37 (git~v1.0.37)\n"); } #[tokio::test(flavor = "multi_thread")] @@ -74,17 +85,34 @@ mod wasi { let (rt, tasks) = runtime(); let container = from_bytes(webc).unwrap(); let pkg = BinaryPackage::from_webc(&container, &rt).await.unwrap(); + let mut stdout = virtual_fs::ArcFile::new(Box::::default()); + let mut stderr = virtual_fs::ArcFile::new(Box::::default()); + + let stdout_2 = stdout.clone(); + let stderr_2 = stderr.clone(); let handle = std::thread::spawn(move || { let _guard = tasks.runtime_handle().enter(); WasiRunner::new() .with_args(["-c", "import sys; sys.exit(42)"]) .with_stdin(Box::::default()) - .with_stdout(Box::::default()) - .with_stderr(Box::::default()) + .with_stdout(Box::new(stdout_2) as Box<_>) + .with_stderr(Box::::default()) .run_command("python", &pkg, Arc::new(rt)) }); + stdout.rewind().await.unwrap(); + stderr.rewind().await.unwrap(); + let mut stdout_buf = Vec::new(); + let mut stderr_buf = Vec::new(); + stdout.read_to_end(&mut stdout_buf).await.unwrap(); + stderr.read_to_end(&mut stderr_buf).await.unwrap(); + let stdout = String::from_utf8(stdout_buf).unwrap(); + let stderr = String::from_utf8(stderr_buf).unwrap(); + + eprintln!("{stdout}"); + eprintln!("{stderr}"); + let err = handle.join().unwrap().unwrap_err(); let runtime_error = err.chain().find_map(|e| e.downcast_ref::()); let exit_code = match runtime_error { From 9246c684cfb923d9249a8e8d12f4d85b95f3beef Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 13:02:33 +0100 Subject: [PATCH 16/23] fix: Correct `box` --- lib/wasix/tests/runners.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/wasix/tests/runners.rs b/lib/wasix/tests/runners.rs index 19654854cb2..e21807f29c6 100644 --- a/lib/wasix/tests/runners.rs +++ b/lib/wasix/tests/runners.rs @@ -55,7 +55,7 @@ mod wasi { .with_args(["--version"]) .with_stdin(Box::::default()) .with_stdout(Box::new(stdout_2) as Box<_>) - .with_stderr(Box::::default()) + .with_stderr(Box::new(stderr_2) as Box<_>) .run_command("wat2wasm", &pkg, Arc::new(rt)) }); @@ -97,7 +97,7 @@ mod wasi { .with_args(["-c", "import sys; sys.exit(42)"]) .with_stdin(Box::::default()) .with_stdout(Box::new(stdout_2) as Box<_>) - .with_stderr(Box::::default()) + .with_stderr(Box::new(stderr_2) as Box<_>) .run_command("python", &pkg, Arc::new(rt)) }); From fcd53261dd9fa55cf562bc3f9734e8befda7a4a3 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 13:52:34 +0100 Subject: [PATCH 17/23] fix: Init logging in tests --- Cargo.lock | 27 ++++++++++++++++++++++++++- lib/wasix/Cargo.toml | 2 ++ lib/wasix/tests/runners.rs | 13 +++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7c6adcb591b..af23f37d64a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -369,7 +369,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.12.1", "log", "prettyplease", "proc-macro2", @@ -1681,6 +1681,29 @@ dependencies = [ "syn 2.0.85", ] +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -6931,6 +6954,7 @@ dependencies = [ "cooked-waker", "dashmap 6.1.0", "derivative", + "env_logger", "futures", "getrandom", "heapless", @@ -6943,6 +6967,7 @@ dependencies = [ "lazy_static", "libc", "linked_hash_set", + "log", "lz4_flex", "num_enum", "once_cell", diff --git a/lib/wasix/Cargo.toml b/lib/wasix/Cargo.toml index 2e8417b49d5..99b77f54ac1 100644 --- a/lib/wasix/Cargo.toml +++ b/lib/wasix/Cargo.toml @@ -164,6 +164,8 @@ tokio = { workspace = true, features = [ pretty_assertions.workspace = true tracing-test = "0.2.4" wasm-bindgen-test = "0.3.0" +env_logger = "0.11.5" +log = "0.4.22" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3.0" diff --git a/lib/wasix/tests/runners.rs b/lib/wasix/tests/runners.rs index e21807f29c6..3c54b500647 100644 --- a/lib/wasix/tests/runners.rs +++ b/lib/wasix/tests/runners.rs @@ -2,12 +2,15 @@ // there. #![cfg(not(target_family = "wasm"))] +use std::sync::Once; use std::{ path::{Path, PathBuf}, sync::Arc, time::Duration, }; +static INIT: Once = Once::new(); + use reqwest::Client; use tokio::runtime::Handle; use wasmer::Engine; @@ -29,6 +32,13 @@ mod wasi { use super::*; + fn setup() { + INIT.call_once(|| { + env_logger::builder() + .filter_level(log::LevelFilter::max()) + .init(); + }); + } #[tokio::test] async fn can_run_wat2wasm() { let webc = download_cached("https://wasmer.io/wasmer/wabt@1.0.37").await; @@ -40,6 +50,7 @@ mod wasi { #[tokio::test(flavor = "multi_thread")] async fn wat2wasm() { + setup(); let webc = download_cached("https://wasmer.io/wasmer/wabt@1.0.37").await; let container = from_bytes(webc).unwrap(); let (rt, tasks) = runtime(); @@ -81,6 +92,8 @@ mod wasi { #[tokio::test(flavor = "multi_thread")] async fn python() { + setup(); + let webc = download_cached("https://wasmer.io/python/python@0.1.0").await; let (rt, tasks) = runtime(); let container = from_bytes(webc).unwrap(); From a2a27464f6781c6728710c55d2825e47abd867e8 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 14:04:18 +0100 Subject: [PATCH 18/23] ci: Disable all jobs other than aarch64 --- .github/workflows/test.yaml | 1941 +++++++++++++++++------------------ 1 file changed, 970 insertions(+), 971 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b12ecc4355a..143f752b683 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -48,666 +48,666 @@ jobs: echo $VERSION echo $DOING_RELEASE - lint: - name: Code lint - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - components: rustfmt, clippy - - name: Install libtinfo - shell: bash - run: | - sudo apt install -y libtinfo5 - - name: Install LLVM (Linux) - run: | - curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o /opt/llvm.tar.xz - mkdir -p /opt/llvm-18 - tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-18 - echo '/opt/llvm-18/bin' >> $GITHUB_PATH - echo 'LLVM_SYS_180_PREFIX=/opt/llvm-18' >> $GITHUB_ENV - - name: Cache - uses: whywaita/actions-cache-s3@v2 - with: - path: | - ~/.cargo/* - ./target/* - key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-lint-linux-x64 - aws-s3-bucket: wasmer-rust-artifacts-cache - aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} - aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} - aws-region: auto - aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com - aws-s3-bucket-endpoint: false - aws-s3-force-path-style: true - - run: make lint - env: - ENABLE_CRANELIFT: "1" - ENABLE_LLVM: "1" - ENABLE_SINGLEPASS: "1" - - name: Assert no files have changed - run: | - git status - ! [[ $(git status -s) ]] - - cargo_deny: - name: cargo-deny - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: EmbarkStudios/cargo-deny-action@v1 - with: - log-level: error - - test_nodejs: - name: Test on NodeJS - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - - name: Install NodeJS - uses: actions/setup-node@v2 - with: - node-version: 16 - - name: Install wasm-pack - run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: make test-js - run: | - make test-js - - test_wasi_fyi: - name: Test wasi-fyi - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: nightly - targets: "wasm32-wasi" - - name: Install wasm-pack - run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: Install LLVM 18 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz - LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} - mkdir ${LLVM_DIR} - tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} - echo "ENABLE_LLVM=1" >> $GITHUB_ENV - echo "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH - echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - name: make test-wasi-fyi - run: | - make test-wasi-fyi - - # The no_std functionality doesn't work at the moment - no point in testing it. - # - name: make test-js-core - # run: | - # make test-js-core - - test_wasix: - name: Test WASIX - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - - name: Install Tools - run: | - sudo apt-get update - sudo apt-get install -y git llvm clang make lld curl - - name: Build wasix sysroot - run: | - cd ~ - git clone --recurse-submodules https://github.com/wasix-org/wasix-libc - cd wasix-libc - ./build32.sh - rm -rf /opt/wasix-sysroot - cp -r sysroot32 ~/wasix-sysroot - - name: Install wasi-sdk Tools - run: | - cd ~ - curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz" -o wasi-sdk.tar.gz - tar -xzf wasi-sdk.tar.gz - cp -r wasi-sdk-${{ env.WASI_SDK_VERSION }}.0 ~/wasi-sdk - - name: Install LLVM 18 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz - LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} - mkdir ${LLVM_DIR} - tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} - echo "ENABLE_LLVM=1" >> $GITHUB_ENV - echo "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH - echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - name: Install wasm-opt - run: | - sudo apt-get install -y binaryen - - name: make test-wasix - run: | - WASI_SDK=~/wasi-sdk WASIX_SYSROOT=~/wasix-sysroot make test-wasix - - test_wasm_build: - name: Test wasm build - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: rustup target add wasm32-wasi - run: rustup target add wasm32-wasi - - name: make build-wasmer-wasm - run: make build-wasmer-wasm - - test_build_jsc: - name: Test JSC build - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - target: x86_64-unknown-linux-gnu - - name: Install NodeJS - uses: actions/setup-node@v2 - with: - node-version: 16 - - name: Install libjavascriptcoregtk-4.0-dev - run: sudo apt update && sudo apt install -y libjavascriptcoregtk-4.0-dev - - name: make build-wasmer-jsc - run: make build-wasmer-jsc - - test_interpreter_api: - name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} - runs-on: ${{ matrix.metadata.os }} - strategy: - fail-fast: false - matrix: - build-what: [ - { - key: wamr, - build-cmd: 'make test-wamr-api', - name: 'Test API for wamr feature' - }, - { - key: wasmi, - build-cmd: 'make test-wasmi-api', - name: 'Test API for wasmi feature' - }, - { - key: v8, - build-cmd: 'make test-v8-api', - name: 'Test API for v8 feature' - } - - ] - metadata: [ - { - build: linux-x64, - os: ubuntu-22.04, - }, - { - build: macos-arm, - os: macos-14, - }, - { - build: windows-x64, - os: windows-2022, - } - ] - container: ${{ matrix.metadata.container }} - steps: - - uses: actions/checkout@v3 - - - name: Setup MSVC (Windows) - uses: ilammy/msvc-dev-cmd@v1 - if: matrix.metadata.build == 'windows-x64' - - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - - - name: Install Nextest - uses: taiki-e/install-action@nextest - - - name: Install `ninja`, clang` and `mold` on Ubuntu - if: startsWith(matrix.metadata.build, 'linux-') - shell: bash - run: | - sudo apt-get update -y && sudo apt-get install ninja-build clang mold -y - - - name: Install `ninja` on macOS - if: startsWith(matrix.metadata.build, 'macos-') - shell: bash - run: | - brew install ninja - - - name: Install `ninja` on Windows - if: startsWith(matrix.metadata.build, 'windows-') - shell: bash - run: | - choco install ninja - - - name: Delete unwanted link to stop it from interfering (Windows) - shell: bash - run: rm /usr/bin/link.exe - if: startsWith(matrix.metadata.build, 'windows-') - - - name: Test WAMR API - if: ${{ matrix.build-what.key == 'wamr' }} - run: ${{ matrix.build-what.build-cmd }} - - - name: Test wasmi API - if: ${{ matrix.build-what.key == 'wasmi' }} - run: ${{ matrix.build-what.build-cmd }} - - - name: Test v8 API (Linux + mold) - if: ${{ matrix.build-what.key == 'v8' && startsWith(matrix.metadata.build, 'linux-')}} - run: RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" CARGO_TERM_VERBOSE=true cargo nextest run --package=wasmer --release --features=v8 --no-default-features - - - name: Test v8 API - if: ${{ matrix.build-what.key == 'v8' && !startsWith(matrix.metadata.build, 'linux-')}} - run: ${{ matrix.build-what.build-cmd }} - - test_build_docs_rs: - name: Test build docs rs - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: "nightly-2024-08-21" - target: x86_64-unknown-linux-gnu - - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` - - - name: Install `ninja` on Ubuntu - shell: bash - run: | - sudo apt-get install ninja-build -y - - - name: Install LLVM 18 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz - LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} - mkdir ${LLVM_DIR} - tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} - echo "ENABLE_LLVM=1" >> $GITHUB_ENV - echo "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH - echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - name: make test-build-docs-rs-ci - run: make test-build-docs-rs-ci - - build_linux_aarch64: - name: ${{ matrix.build-what.name }} on linux-aarch64 - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - build-what: [ - { - key: capi, - build-cmd: 'make build-capi && make package-capi', - name: 'Build C-API' - }, - { - key: wasmer, - build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', - name: 'Build wasmer-cli' - } - ] - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - target: aarch64-unknown-linux-gnu - - name: Build cross image - run: | - docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ - env: - CROSS_DOCKER_IN_DOCKER: true - - name: Build ${{ matrix.build-what.key }} - run: | - ${{ matrix.build-what.build-cmd }} - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: aarch64-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - ENABLE_LLVM: 0 - - name: Dist - if: ${{ matrix.build-what.key == 'capi' }} - run: | - make distribution - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: aarch64-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - TARGET: aarch64-unknown-linux-gnu - TARGET_DIR: target/aarch64-unknown-linux-gnu/release - - name: Upload Artifacts - if: ${{ matrix.build-what.key == 'capi' }} - uses: actions/upload-artifact@v4 - with: - name: capi-linux-aarch64 - path: dist - if-no-files-found: error - retention-days: 2 - - build_linux_riscv64: - name: ${{ matrix.build-what.name }} on linux-riscv64 - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - build-what: [ - { - key: capi, - build-cmd: 'make build-capi && make package-capi', - name: 'Build C-API' - }, - { - key: wasmer, - build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', - name: 'Build wasmer-cli' - } - ] - steps: - - uses: actions/checkout@v3 - #- uses: dtolnay/rust-toolchain@stable - # with: - # toolchain: ${{ env.MSRV }} - # target: riscv64gc-unknown-linux-gnu - - name: Build cross image - run: | - docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ - env: - CROSS_DOCKER_IN_DOCKER: true - - name: Build ${{ matrix.build-what.key }} - run: | - ${{ matrix.build-what.build-cmd }} - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: riscv64gc-unknown-linux-gnu - ENABLE_LLVM: 0 - - name: Dist - if: ${{ matrix.build-what.key == 'capi' }} - run: | - make distribution - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: riscv64gc-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - TARGET: riscv64gc-unknown-linux-gnu - TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release - - name: Upload Artifacts - if: ${{ matrix.build-what.key == 'capi' }} - uses: actions/upload-artifact@v4 - with: - name: capi-linux-riscv64 - path: dist - if-no-files-found: error - retention-days: 2 - - build: - name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} - runs-on: ${{ matrix.metadata.os }} - needs: setup - strategy: - fail-fast: false - matrix: - build-what: [ - { - key: capi, - build-cmd: 'make build-capi && make build-capi-headless && make package-capi && make tar-capi', - name: 'Build and test C-API' - }, - { - key: wasmer, - build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', - name: 'Build wasmer-cli' - } - ] - metadata: [ - { - build: linux-x64, - os: ubuntu-22.04, - target: x86_64-unknown-linux-gnu, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' - }, - { - build: macos-x64, - os: macos-12, - target: x86_64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' - - }, - { - build: macos-arm, - os: macos-14, - target: aarch64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' - }, - { - build: windows-x64, - os: windows-2022, - target: x86_64-pc-windows-msvc, - exe: '.exe', - # For now, disable LLVM in `windows-x64.` - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' - }, - { - build: windows-gnu, - target: x86_64-pc-windows-gnu, - os: ubuntu-22.04, - }, - { - build: linux-musl, - target: x86_64-unknown-linux-musl, - os: ubuntu-22.04, - exe: '', - container: 'alpine:latest' - } - - ] - container: ${{ matrix.metadata.container }} - env: - SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob - SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} - steps: - - uses: actions/checkout@v3 - - name: Set up libstdc++ on Linux - if: matrix.metadata.build == 'linux-x64' - run: | - sudo apt-get update -y - sudo apt-get install -y --allow-downgrades libstdc++6 libtinfo5 - sudo apt-get install --reinstall g++ - - name: Set up base deps on musl - if: matrix.metadata.build == 'linux-musl' - run: | - ./scripts/alpine-linux-install-deps.sh - echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV - - name: Set up dependencies for Mac OS - run: | - brew install automake - # using gnu-tar is a workaround for https://github.com/actions/cache/issues/403 - brew install gnu-tar - echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV - if: matrix.metadata.os == 'macos-12' - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - target: ${{ matrix.metadata.target }} - - name: Install Nextest - uses: taiki-e/install-action@nextest - - name: Install MSVC dev-cmd (Windows) - uses: ilammy/msvc-dev-cmd@v1 - if: ${{ matrix.metadata.build == 'windows-x64' }} - - name: Delete unwanted link to stop it from interfering (Windows) - shell: bash - run: rm /usr/bin/link.exe - if: ${{ matrix.metadata.build == 'windows-x64' }} - - name: Install Windows-GNU linker - if: ${{ matrix.metadata.build == 'windows-gnu' }} - shell: bash - run: | - sudo apt install -y mingw-w64 - - name: Install Windows-GNU target - if: ${{ matrix.metadata.build == 'windows-gnu' }} - shell: bash - run: | - rustup target add x86_64-pc-windows-gnu - - name: Install Windows 10 SDK with xwin - if: ${{ matrix.metadata.build == 'windows-gnu' }} - shell: bash - run: | - mkdir -p /tmp/xwin - mkdir -p /tmp/xwindownload - mkdir -p /tmp/xwincache - git clone https://github.com/wasmerio/xwin --depth=1 /tmp/xwin - cargo build --release --manifest-path=/tmp/xwin/Cargo.toml - /tmp/xwin/target/release/xwin --accept-license --cache-dir /tmp/xwincache splat --output /tmp/xwindownload - mkdir -p /tmp/winsdk - cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/WS2_32.lib /tmp/winsdk/ - cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/KERNEL32.lib /tmp/winsdk/ - cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/BCRYPT.lib /tmp/winsdk/ - cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/ADVAPI32.lib /tmp/winsdk/ - cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/USERENV.lib /tmp/winsdk/ - echo "WinSDK files:" - ls -laH /tmp/winsdk - echo "" - mkdir -p package - mkdir -p package/winsdk - cp -r /tmp/winsdk/* package/winsdk - - name: Install LLVM (macOS Apple Silicon) - if: matrix.metadata.os == 'macos-12' && !matrix.metadata.llvm_url - run: | - brew install llvm - - name: Install LLVM - shell: bash - if: matrix.metadata.llvm_url - run: | - curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.metadata.llvm_url }} -L -o llvm.tar.xz - LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} - mkdir ${LLVM_DIR} - tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} - echo "ENABLE_LLVM=1" >> $GITHUB_ENV - echo "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH - echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - name: Add `brew` libs to `RUSTFLAGS` - if: matrix.metadata.os == 'macos-14' - shell: bash - run: | - echo "RUSTFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV - - name: Setup Rust target - shell: bash - run: | - mkdir -p .cargo - cat << EOF > .cargo/config.toml - [build] - target = "${{ matrix.metadata.target }}" - EOF - if: matrix.metadata.target - - name: which cargo - if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} - run: which cargo - - name: Set cargo env - run: echo "CARGO_ROOT_DIR=$(dirname $(dirname $( which cargo )))" >> $GITHUB_ENV - - name: List root dir - shell: bash - if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} - run: ls -R $CARGO_ROOT_DIR - - name: Cache - uses: whywaita/actions-cache-s3@v2 - with: - path: | - ~/.cargo/* - ./target/* - $CARGO_ROOT_DIR/* - key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-build-wasmer-${{ matrix.build-what.key }}-${{ matrix.metadata.build }} - aws-s3-bucket: wasmer-rust-artifacts-cache - aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} - aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} - aws-region: auto - aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com - aws-s3-bucket-endpoint: false - aws-s3-force-path-style: true - - name: Build C-API - shell: bash - run: ${{ matrix.build-what.build-cmd }} - if: ${{ matrix.build-what.key == 'capi' }} - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} - - name: Build Wasmer - shell: bash - if: ${{ matrix.build-what.key == 'wasmer' && matrix.metadata.build != 'windows-gnu' }} - run: ${{ matrix.build-what.build-cmd }} - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} - - name: Test C-API - shell: bash - if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} - run: make test-capi-ci - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} - # C-API tests were disabled for linux-musl and macos-arm (we can't run them) - - name: Test C-API integration - shell: bash - if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} - run: export WASMER_DIR=`pwd`/package && make test-stage-7-capi-integration-tests - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} - - name: Archive production artifacts - uses: actions/upload-artifact@v4 - with: - name: wasmer-cli-${{ matrix.metadata.build }} - path: build-wasmer.tar.gz - if-no-files-found: ignore - retention-days: 2 - - name: Archive production artifacts - uses: actions/upload-artifact@v4 - with: - name: capi-${{ matrix.metadata.build }} - path: build-capi.tar.gz - if-no-files-found: ignore - retention-days: 2 +# lint: +# name: Code lint +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# components: rustfmt, clippy +# - name: Install libtinfo +# shell: bash +# run: | +# sudo apt install -y libtinfo5 +# - name: Install LLVM (Linux) +# run: | +# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o /opt/llvm.tar.xz +# mkdir -p /opt/llvm-18 +# tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-18 +# echo '/opt/llvm-18/bin' >> $GITHUB_PATH +# echo 'LLVM_SYS_180_PREFIX=/opt/llvm-18' >> $GITHUB_ENV +# - name: Cache +# uses: whywaita/actions-cache-s3@v2 +# with: +# path: | +# ~/.cargo/* +# ./target/* +# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-lint-linux-x64 +# aws-s3-bucket: wasmer-rust-artifacts-cache +# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} +# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} +# aws-region: auto +# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com +# aws-s3-bucket-endpoint: false +# aws-s3-force-path-style: true +# - run: make lint +# env: +# ENABLE_CRANELIFT: "1" +# ENABLE_LLVM: "1" +# ENABLE_SINGLEPASS: "1" +# - name: Assert no files have changed +# run: | +# git status +# ! [[ $(git status -s) ]] +# +# cargo_deny: +# name: cargo-deny +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - uses: EmbarkStudios/cargo-deny-action@v1 +# with: +# log-level: error +# +# test_nodejs: +# name: Test on NodeJS +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# - name: Install NodeJS +# uses: actions/setup-node@v2 +# with: +# node-version: 16 +# - name: Install wasm-pack +# run: | +# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +# - name: make test-js +# run: | +# make test-js +# +# test_wasi_fyi: +# name: Test wasi-fyi +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: nightly +# targets: "wasm32-wasi" +# - name: Install wasm-pack +# run: | +# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +# - name: Install LLVM 18 +# run: | +# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz +# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} +# mkdir ${LLVM_DIR} +# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} +# echo "ENABLE_LLVM=1" >> $GITHUB_ENV +# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH +# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH +# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV +# env: +# LLVM_DIR: .llvm +# - name: make test-wasi-fyi +# run: | +# make test-wasi-fyi +# +# # The no_std functionality doesn't work at the moment - no point in testing it. +# # - name: make test-js-core +# # run: | +# # make test-js-core +# +# test_wasix: +# name: Test WASIX +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# - name: Install Tools +# run: | +# sudo apt-get update +# sudo apt-get install -y git llvm clang make lld curl +# - name: Build wasix sysroot +# run: | +# cd ~ +# git clone --recurse-submodules https://github.com/wasix-org/wasix-libc +# cd wasix-libc +# ./build32.sh +# rm -rf /opt/wasix-sysroot +# cp -r sysroot32 ~/wasix-sysroot +# - name: Install wasi-sdk Tools +# run: | +# cd ~ +# curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz" -o wasi-sdk.tar.gz +# tar -xzf wasi-sdk.tar.gz +# cp -r wasi-sdk-${{ env.WASI_SDK_VERSION }}.0 ~/wasi-sdk +# - name: Install LLVM 18 +# run: | +# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz +# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} +# mkdir ${LLVM_DIR} +# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} +# echo "ENABLE_LLVM=1" >> $GITHUB_ENV +# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH +# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH +# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV +# env: +# LLVM_DIR: .llvm +# - name: Install wasm-opt +# run: | +# sudo apt-get install -y binaryen +# - name: make test-wasix +# run: | +# WASI_SDK=~/wasi-sdk WASIX_SYSROOT=~/wasix-sysroot make test-wasix +# +# test_wasm_build: +# name: Test wasm build +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - name: rustup target add wasm32-wasi +# run: rustup target add wasm32-wasi +# - name: make build-wasmer-wasm +# run: make build-wasmer-wasm +# +# test_build_jsc: +# name: Test JSC build +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# target: x86_64-unknown-linux-gnu +# - name: Install NodeJS +# uses: actions/setup-node@v2 +# with: +# node-version: 16 +# - name: Install libjavascriptcoregtk-4.0-dev +# run: sudo apt update && sudo apt install -y libjavascriptcoregtk-4.0-dev +# - name: make build-wasmer-jsc +# run: make build-wasmer-jsc +# +# test_interpreter_api: +# name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} +# runs-on: ${{ matrix.metadata.os }} +# strategy: +# fail-fast: false +# matrix: +# build-what: [ +# { +# key: wamr, +# build-cmd: 'make test-wamr-api', +# name: 'Test API for wamr feature' +# }, +# { +# key: wasmi, +# build-cmd: 'make test-wasmi-api', +# name: 'Test API for wasmi feature' +# }, +# { +# key: v8, +# build-cmd: 'make test-v8-api', +# name: 'Test API for v8 feature' +# } +# +# ] +# metadata: [ +# { +# build: linux-x64, +# os: ubuntu-22.04, +# }, +# { +# build: macos-arm, +# os: macos-14, +# }, +# { +# build: windows-x64, +# os: windows-2022, +# } +# ] +# container: ${{ matrix.metadata.container }} +# steps: +# - uses: actions/checkout@v3 +# +# - name: Setup MSVC (Windows) +# uses: ilammy/msvc-dev-cmd@v1 +# if: matrix.metadata.build == 'windows-x64' +# +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# +# - name: Install Nextest +# uses: taiki-e/install-action@nextest +# +# - name: Install `ninja`, clang` and `mold` on Ubuntu +# if: startsWith(matrix.metadata.build, 'linux-') +# shell: bash +# run: | +# sudo apt-get update -y && sudo apt-get install ninja-build clang mold -y +# +# - name: Install `ninja` on macOS +# if: startsWith(matrix.metadata.build, 'macos-') +# shell: bash +# run: | +# brew install ninja +# +# - name: Install `ninja` on Windows +# if: startsWith(matrix.metadata.build, 'windows-') +# shell: bash +# run: | +# choco install ninja +# +# - name: Delete unwanted link to stop it from interfering (Windows) +# shell: bash +# run: rm /usr/bin/link.exe +# if: startsWith(matrix.metadata.build, 'windows-') +# +# - name: Test WAMR API +# if: ${{ matrix.build-what.key == 'wamr' }} +# run: ${{ matrix.build-what.build-cmd }} +# +# - name: Test wasmi API +# if: ${{ matrix.build-what.key == 'wasmi' }} +# run: ${{ matrix.build-what.build-cmd }} +# +# - name: Test v8 API (Linux + mold) +# if: ${{ matrix.build-what.key == 'v8' && startsWith(matrix.metadata.build, 'linux-')}} +# run: RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" CARGO_TERM_VERBOSE=true cargo nextest run --package=wasmer --release --features=v8 --no-default-features +# +# - name: Test v8 API +# if: ${{ matrix.build-what.key == 'v8' && !startsWith(matrix.metadata.build, 'linux-')}} +# run: ${{ matrix.build-what.build-cmd }} +# +# test_build_docs_rs: +# name: Test build docs rs +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# - uses: dtolnay/rust-toolchain@master +# with: +# toolchain: "nightly-2024-08-21" +# target: x86_64-unknown-linux-gnu +# - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` +# +# - name: Install `ninja` on Ubuntu +# shell: bash +# run: | +# sudo apt-get install ninja-build -y +# +# - name: Install LLVM 18 +# run: | +# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz +# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} +# mkdir ${LLVM_DIR} +# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} +# echo "ENABLE_LLVM=1" >> $GITHUB_ENV +# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH +# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH +# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV +# env: +# LLVM_DIR: .llvm +# - name: make test-build-docs-rs-ci +# run: make test-build-docs-rs-ci +# +# build_linux_aarch64: +# name: ${{ matrix.build-what.name }} on linux-aarch64 +# runs-on: ubuntu-22.04 +# strategy: +# fail-fast: false +# matrix: +# build-what: [ +# { +# key: capi, +# build-cmd: 'make build-capi && make package-capi', +# name: 'Build C-API' +# }, +# { +# key: wasmer, +# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', +# name: 'Build wasmer-cli' +# } +# ] +# steps: +# - uses: actions/checkout@v3 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# target: aarch64-unknown-linux-gnu +# - name: Build cross image +# run: | +# docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ +# env: +# CROSS_DOCKER_IN_DOCKER: true +# - name: Build ${{ matrix.build-what.key }} +# run: | +# ${{ matrix.build-what.build-cmd }} +# env: +# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross +# CROSS_DOCKER_IN_DOCKER: true +# CARGO_TARGET: aarch64-unknown-linux-gnu +# PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig +# PKG_CONFIG_ALLOW_CROSS: true +# ENABLE_LLVM: 0 +# - name: Dist +# if: ${{ matrix.build-what.key == 'capi' }} +# run: | +# make distribution +# env: +# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross +# CROSS_DOCKER_IN_DOCKER: true +# CARGO_TARGET: aarch64-unknown-linux-gnu +# PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig +# PKG_CONFIG_ALLOW_CROSS: true +# TARGET: aarch64-unknown-linux-gnu +# TARGET_DIR: target/aarch64-unknown-linux-gnu/release +# - name: Upload Artifacts +# if: ${{ matrix.build-what.key == 'capi' }} +# uses: actions/upload-artifact@v4 +# with: +# name: capi-linux-aarch64 +# path: dist +# if-no-files-found: error +# retention-days: 2 +# +# build_linux_riscv64: +# name: ${{ matrix.build-what.name }} on linux-riscv64 +# runs-on: ubuntu-22.04 +# strategy: +# fail-fast: false +# matrix: +# build-what: [ +# { +# key: capi, +# build-cmd: 'make build-capi && make package-capi', +# name: 'Build C-API' +# }, +# { +# key: wasmer, +# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', +# name: 'Build wasmer-cli' +# } +# ] +# steps: +# - uses: actions/checkout@v3 +# #- uses: dtolnay/rust-toolchain@stable +# # with: +# # toolchain: ${{ env.MSRV }} +# # target: riscv64gc-unknown-linux-gnu +# - name: Build cross image +# run: | +# docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ +# env: +# CROSS_DOCKER_IN_DOCKER: true +# - name: Build ${{ matrix.build-what.key }} +# run: | +# ${{ matrix.build-what.build-cmd }} +# env: +# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo +# CROSS_DOCKER_IN_DOCKER: true +# CARGO_TARGET: riscv64gc-unknown-linux-gnu +# ENABLE_LLVM: 0 +# - name: Dist +# if: ${{ matrix.build-what.key == 'capi' }} +# run: | +# make distribution +# env: +# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo +# CROSS_DOCKER_IN_DOCKER: true +# CARGO_TARGET: riscv64gc-unknown-linux-gnu +# PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig +# PKG_CONFIG_ALLOW_CROSS: true +# TARGET: riscv64gc-unknown-linux-gnu +# TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release +# - name: Upload Artifacts +# if: ${{ matrix.build-what.key == 'capi' }} +# uses: actions/upload-artifact@v4 +# with: +# name: capi-linux-riscv64 +# path: dist +# if-no-files-found: error +# retention-days: 2 +# +# build: +# name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} +# runs-on: ${{ matrix.metadata.os }} +# needs: setup +# strategy: +# fail-fast: false +# matrix: +# build-what: [ +# { +# key: capi, +# build-cmd: 'make build-capi && make build-capi-headless && make package-capi && make tar-capi', +# name: 'Build and test C-API' +# }, +# { +# key: wasmer, +# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', +# name: 'Build wasmer-cli' +# } +# ] +# metadata: [ +# { +# build: linux-x64, +# os: ubuntu-22.04, +# target: x86_64-unknown-linux-gnu, +# exe: '', +# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' +# }, +# { +# build: macos-x64, +# os: macos-12, +# target: x86_64-apple-darwin, +# exe: '', +# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' +# +# }, +# { +# build: macos-arm, +# os: macos-14, +# target: aarch64-apple-darwin, +# exe: '', +# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' +# }, +# { +# build: windows-x64, +# os: windows-2022, +# target: x86_64-pc-windows-msvc, +# exe: '.exe', +# # For now, disable LLVM in `windows-x64.` +# # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' +# }, +# { +# build: windows-gnu, +# target: x86_64-pc-windows-gnu, +# os: ubuntu-22.04, +# }, +# { +# build: linux-musl, +# target: x86_64-unknown-linux-musl, +# os: ubuntu-22.04, +# exe: '', +# container: 'alpine:latest' +# } +# +# ] +# container: ${{ matrix.metadata.container }} +# env: +# SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob +# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} +# steps: +# - uses: actions/checkout@v3 +# - name: Set up libstdc++ on Linux +# if: matrix.metadata.build == 'linux-x64' +# run: | +# sudo apt-get update -y +# sudo apt-get install -y --allow-downgrades libstdc++6 libtinfo5 +# sudo apt-get install --reinstall g++ +# - name: Set up base deps on musl +# if: matrix.metadata.build == 'linux-musl' +# run: | +# ./scripts/alpine-linux-install-deps.sh +# echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV +# - name: Set up dependencies for Mac OS +# run: | +# brew install automake +# # using gnu-tar is a workaround for https://github.com/actions/cache/issues/403 +# brew install gnu-tar +# echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV +# if: matrix.metadata.os == 'macos-12' +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# target: ${{ matrix.metadata.target }} +# - name: Install Nextest +# uses: taiki-e/install-action@nextest +# - name: Install MSVC dev-cmd (Windows) +# uses: ilammy/msvc-dev-cmd@v1 +# if: ${{ matrix.metadata.build == 'windows-x64' }} +# - name: Delete unwanted link to stop it from interfering (Windows) +# shell: bash +# run: rm /usr/bin/link.exe +# if: ${{ matrix.metadata.build == 'windows-x64' }} +# - name: Install Windows-GNU linker +# if: ${{ matrix.metadata.build == 'windows-gnu' }} +# shell: bash +# run: | +# sudo apt install -y mingw-w64 +# - name: Install Windows-GNU target +# if: ${{ matrix.metadata.build == 'windows-gnu' }} +# shell: bash +# run: | +# rustup target add x86_64-pc-windows-gnu +# - name: Install Windows 10 SDK with xwin +# if: ${{ matrix.metadata.build == 'windows-gnu' }} +# shell: bash +# run: | +# mkdir -p /tmp/xwin +# mkdir -p /tmp/xwindownload +# mkdir -p /tmp/xwincache +# git clone https://github.com/wasmerio/xwin --depth=1 /tmp/xwin +# cargo build --release --manifest-path=/tmp/xwin/Cargo.toml +# /tmp/xwin/target/release/xwin --accept-license --cache-dir /tmp/xwincache splat --output /tmp/xwindownload +# mkdir -p /tmp/winsdk +# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/WS2_32.lib /tmp/winsdk/ +# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/KERNEL32.lib /tmp/winsdk/ +# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/BCRYPT.lib /tmp/winsdk/ +# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/ADVAPI32.lib /tmp/winsdk/ +# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/USERENV.lib /tmp/winsdk/ +# echo "WinSDK files:" +# ls -laH /tmp/winsdk +# echo "" +# mkdir -p package +# mkdir -p package/winsdk +# cp -r /tmp/winsdk/* package/winsdk +# - name: Install LLVM (macOS Apple Silicon) +# if: matrix.metadata.os == 'macos-12' && !matrix.metadata.llvm_url +# run: | +# brew install llvm +# - name: Install LLVM +# shell: bash +# if: matrix.metadata.llvm_url +# run: | +# curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.metadata.llvm_url }} -L -o llvm.tar.xz +# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} +# mkdir ${LLVM_DIR} +# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} +# echo "ENABLE_LLVM=1" >> $GITHUB_ENV +# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH +# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH +# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV +# env: +# LLVM_DIR: .llvm +# - name: Add `brew` libs to `RUSTFLAGS` +# if: matrix.metadata.os == 'macos-14' +# shell: bash +# run: | +# echo "RUSTFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV +# - name: Setup Rust target +# shell: bash +# run: | +# mkdir -p .cargo +# cat << EOF > .cargo/config.toml +# [build] +# target = "${{ matrix.metadata.target }}" +# EOF +# if: matrix.metadata.target +# - name: which cargo +# if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} +# run: which cargo +# - name: Set cargo env +# run: echo "CARGO_ROOT_DIR=$(dirname $(dirname $( which cargo )))" >> $GITHUB_ENV +# - name: List root dir +# shell: bash +# if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} +# run: ls -R $CARGO_ROOT_DIR +# - name: Cache +# uses: whywaita/actions-cache-s3@v2 +# with: +# path: | +# ~/.cargo/* +# ./target/* +# $CARGO_ROOT_DIR/* +# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-build-wasmer-${{ matrix.build-what.key }}-${{ matrix.metadata.build }} +# aws-s3-bucket: wasmer-rust-artifacts-cache +# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} +# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} +# aws-region: auto +# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com +# aws-s3-bucket-endpoint: false +# aws-s3-force-path-style: true +# - name: Build C-API +# shell: bash +# run: ${{ matrix.build-what.build-cmd }} +# if: ${{ matrix.build-what.key == 'capi' }} +# env: +# TARGET: ${{ matrix.metadata.target }} +# TARGET_DIR: target/${{ matrix.metadata.target }}/release +# CARGO_TARGET: ${{ matrix.metadata.target }} +# - name: Build Wasmer +# shell: bash +# if: ${{ matrix.build-what.key == 'wasmer' && matrix.metadata.build != 'windows-gnu' }} +# run: ${{ matrix.build-what.build-cmd }} +# env: +# TARGET: ${{ matrix.metadata.target }} +# TARGET_DIR: target/${{ matrix.metadata.target }}/release +# CARGO_TARGET: ${{ matrix.metadata.target }} +# - name: Test C-API +# shell: bash +# if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} +# run: make test-capi-ci +# env: +# TARGET: ${{ matrix.metadata.target }} +# TARGET_DIR: target/${{ matrix.metadata.target }}/release +# CARGO_TARGET: ${{ matrix.metadata.target }} +# # C-API tests were disabled for linux-musl and macos-arm (we can't run them) +# - name: Test C-API integration +# shell: bash +# if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} +# run: export WASMER_DIR=`pwd`/package && make test-stage-7-capi-integration-tests +# env: +# TARGET: ${{ matrix.metadata.target }} +# TARGET_DIR: target/${{ matrix.metadata.target }}/release +# CARGO_TARGET: ${{ matrix.metadata.target }} +# - name: Archive production artifacts +# uses: actions/upload-artifact@v4 +# with: +# name: wasmer-cli-${{ matrix.metadata.build }} +# path: build-wasmer.tar.gz +# if-no-files-found: ignore +# retention-days: 2 +# - name: Archive production artifacts +# uses: actions/upload-artifact@v4 +# with: +# name: capi-${{ matrix.metadata.build }} +# path: build-capi.tar.gz +# if-no-files-found: ignore +# retention-days: 2 test: name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} @@ -717,40 +717,39 @@ jobs: fail-fast: false matrix: stage: [ - { - description: 'Run wast test suite for all compilers', - make: 'test-stage-0-wast', - }, + #{ + # description: 'Run wast test suite for all compilers', + # make: 'test-stage-0-wast', + #}, { description: 'Unit-test packages on std', make: 'test-stage-1-test-all', }, - { - description: 'Unit-test cranelift on no-std', - make: 'test-stage-2-test-compiler-cranelift-nostd', - }, - { - description: 'Unit-test singlepass on no-std', - make: 'test-stage-3-test-compiler-singlepass-nostd', - }, - { - description: 'Unit-test wasmer-cli', - make: 'test-stage-4-wasmer-cli', - }, - { - description: 'Unit-test examples', - make: 'test-stage-5-test-examples', - } + #{ + # description: 'Unit-test cranelift on no-std', + # make: 'test-stage-2-test-compiler-cranelift-nostd', + #}, + #{ + # description: 'Unit-test singlepass on no-std', + # make: 'test-stage-3-test-compiler-singlepass-nostd', + #}, + #{ + # description: 'Unit-test wasmer-cli', + # make: 'test-stage-4-wasmer-cli', + #}, + #{ + # description: 'Unit-test examples', + # make: 'test-stage-5-test-examples', + #} ] metadata: [ - # We cannot test on macos-arm since we don't have ARM runners - { - build: linux-x64, - os: ubuntu-22.04, - target: x86_64-unknown-linux-gnu, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' - }, + #{ + # build: linux-x64, + # os: ubuntu-22.04, + # target: x86_64-unknown-linux-gnu, + # exe: '', + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' + #}, { build: macos-x64, os: macos-12, @@ -759,28 +758,28 @@ jobs: llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' }, - { - build: macos-arm, - os: macos-14, - target: aarch64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' - }, - { - build: windows-x64, - os: windows-2022, - target: x86_64-pc-windows-msvc, - exe: '.exe', - # For now, disable LLVM in `windows-x64.` - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' - }, - { - build: linux-musl, - target: x86_64-unknown-linux-musl, - os: ubuntu-22.04, - exe: '', - container: 'alpine:latest' - } + #{ + # build: macos-arm, + # os: macos-14, + # target: aarch64-apple-darwin, + # exe: '', + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + #}, + #{ + # build: windows-x64, + # os: windows-2022, + # target: x86_64-pc-windows-msvc, + # exe: '.exe', + # # For now, disable LLVM in `windows-x64.` + # # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' + #}, + #{ + # build: linux-musl, + # target: x86_64-unknown-linux-musl, + # os: ubuntu-22.04, + # exe: '', + # container: 'alpine:latest' + #} ] container: ${{ matrix.metadata.container }} env: @@ -876,264 +875,264 @@ jobs: CARGO_TARGET: ${{ matrix.metadata.target }} - test_integration_cli: - name: CLI integration tests on ${{ matrix.build }} - runs-on: ${{ matrix.os }} - needs: [build, build_linux_aarch64, build_linux_riscv64] - strategy: - fail-fast: false - matrix: - include: - - build: linux-x64 - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' - - build: macos-x64 - os: macos-12 - target: x86_64-apple-darwin - # we only build the integration-test CLI, we don't run tests - - build: macos-arm - os: macos-12 - target: aarch64-apple-darwin, - - build: linux-musl - target: x86_64-unknown-linux-musl - os: ubuntu-22.04 - container: alpine:latest - - build: windows-x64 - os: windows-2019 - target: x86_64-pc-windows-msvc - # For now, disable LLVM in `windows-x64.` - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' - - container: ${{ matrix.container }} - env: - SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob - SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} - steps: - - uses: actions/checkout@v3 - - uses: goto-bus-stop/setup-zig@v2 - with: - version: 0.10.0 - - name: Set up base deps on musl - if: matrix.build == 'linux-musl' - run: | - ./scripts/alpine-linux-install-deps.sh - echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV - - uses: actions/download-artifact@v4 - id: download - with: - name: capi-${{ matrix.build }} - - uses: actions/download-artifact@v4 - with: - name: wasmer-cli-${{ matrix.build }} - - name: 'Echo download path' - run: echo ${{steps.download.outputs.download-path}} - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.MSRV }} - target: ${{ matrix.metadata.target }} - - name: Install Nextest - uses: taiki-e/install-action@nextest - - name: Cache - uses: whywaita/actions-cache-s3@v2 - with: - path: | - ~/.cargo/* - ./target/* - key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-integration-cli-${{ matrix.build }} - aws-s3-bucket: wasmer-rust-artifacts-cache - aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} - aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} - aws-region: auto - aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com - aws-s3-bucket-endpoint: false - aws-s3-force-path-style: true - - name: Prepare package directory - shell: bash - run: | - mkdir -p package - mkdir -p package/cache - - uses: actions/download-artifact@v4 - with: - name: capi-linux-aarch64 - path: package/cache/wasmercache1 - - uses: actions/download-artifact@v4 - with: - name: capi-windows-x64 - path: package/cache/wasmercache2 - - uses: actions/download-artifact@v4 - with: - name: capi-macos-arm - path: package/cache/wasmercache3 - - uses: actions/download-artifact@v4 - with: - name: capi-macos-x64 - path: package/cache/wasmercache4 - - uses: actions/download-artifact@v4 - with: - name: capi-linux-x64 - path: package/cache/wasmercache5 - - uses: actions/download-artifact@v4 - with: - name: capi-linux-riscv64 - path: package/cache/wasmercache6 - - name: Copy .tar.gz files to proper location - shell: bash - run: | - ls package/cache/wasmercache1 - ls package/cache/wasmercache2 - ls package/cache/wasmercache3 - ls package/cache/wasmercache4 - ls package/cache/wasmercache5 - cp package/cache/wasmercache1/wasmer.tar.gz package/cache/wasmer-linux-aarch64.tar.gz - cp package/cache/wasmercache2/build-capi.tar.gz package/cache/wasmer-windows-gnu64.tar.gz - cp package/cache/wasmercache3/build-capi.tar.gz package/cache/wasmer-darwin-arm64.tar.gz - cp package/cache/wasmercache4/build-capi.tar.gz package/cache/wasmer-darwin-amd64.tar.gz - cp package/cache/wasmercache5/build-capi.tar.gz package/cache/wasmer-linux-amd64.tar.gz - cp package/cache/wasmercache6/wasmer.tar.gz package/cache/wasmer-linux-riscv64.tar.gz - - uses: actions/download-artifact@v4 - if: ${{ matrix.build == 'windows-x64' }} - with: - name: capi-windows-x64 - path: download_link - - uses: actions/download-artifact@v4 - if: ${{ matrix.build == 'linux-musl' }} - with: - name: capi-linux-musl - path: download_link - - uses: actions/download-artifact@v4 - if: ${{ matrix.build == 'macos-arm' }} - with: - name: capi-macos-arm - path: download_link - - uses: actions/download-artifact@v4 - if: ${{ matrix.build == 'macos-x64' }} - with: - name: capi-macos-x64 - path: download_link - - uses: actions/download-artifact@v4 - if: ${{ matrix.build == 'linux-x64' }} - with: - name: capi-linux-x64 - path: download_link - - name: Copy build-capi.tar.gz to link.tar.gz - shell: bash - run: | - cp download_link/build-capi.tar.gz link.tar.gz - - name: Unzip Artifacts - shell: bash - run: | - make untar-capi - - name: Unzip Artifacts - shell: bash - run: | - make untar-wasmer - - # Removed in favour of freestanding integration tests - # - # - name: Test integration CLI - # if: false # matrix.build != 'macos-arm' - # shell: bash - # run: | - # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} - # export WASMER_DIR=`pwd`/package && make test-integration-cli-ci - # env: - # TARGET: ${{ matrix.target }} - # TARGET_DIR: target/${{ matrix.target }}/release - # CARGO_TARGET: ${{ matrix.target }} - # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - # ---- - # Note (xdoardo on 2024/10/07): - # --- - # As of now the WAMR, WASMI (and V8) backends are not that mature enough. We will re-enable these tests - # when they've been used and matured. - # ---- - # - # - name: Test CLI integration (WAMR) - # shell: bash - # run: | - # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} - # export WASMER_DIR=`pwd`/package && make test-integration-cli-wamr-ci - # env: - # TARGET: ${{ matrix.target }} - # TARGET_DIR: target/${{ matrix.target }}/release - # CARGO_TARGET: ${{ matrix.target }} - # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Test CLI integration (WASMI) - # shell: bash - # run: | - # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} - # export WASMER_DIR=`pwd`/package && make test-integration-cli-wasmi-ci - # env: - # TARGET: ${{ matrix.target }} - # TARGET_DIR: target/${{ matrix.target }}/release - # CARGO_TARGET: ${{ matrix.target }} - # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - # there is another set of integration tests in 'wasmer-integration-tests' repo. Run those - test-wasmer-integration-tests: - needs: [build] - runs-on: ubuntu-22.04 - steps: - - name: Checkout wasmer-integration-tests repository - uses: actions/checkout@v3 - with: - repository: wasmerio/wasmer-integration-tests - submodules: true - token: ${{ secrets.CLONE_WASMER_INTEGRATION_TESTS }} - - uses: actions/download-artifact@v4 - with: - name: wasmer-cli-linux-x64 - - name: Cargo Registry Cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/advisory-db - ~/.cargo/git - ~/.cargo/registry - key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cargo target cache - uses: actions/cache@v3 - with: - path: | - target/ - key: cargo-release-${{ hashFiles('**/Cargo.lock') }} - - run: | - # install rust toolchain - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - . "$HOME/.cargo/env" - - # add wasmer cli to PATH - tar -xzf build-wasmer.tar.gz - - docker build -t tmp . - docker run -v $PWD:/app -w /app tmp bash -c " \ - cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\ - export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ - export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ - export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ - export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ - export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ - export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ - export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ - export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ - export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ - export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ - export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ - wasmer config set registry.url https://registry.wasmer.io/graphql &&\ - wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\ - wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ - wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\ - cargo test --no-fail-fast" - - name: notify failure in slack - if: failure() - run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":"Integration tests failed ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.INTEGRATION_TEST_SLACK_WEBHOOK }} +# test_integration_cli: +# name: CLI integration tests on ${{ matrix.build }} +# runs-on: ${{ matrix.os }} +# needs: [build, build_linux_aarch64, build_linux_riscv64] +# strategy: +# fail-fast: false +# matrix: +# include: +# - build: linux-x64 +# os: ubuntu-22.04 +# target: x86_64-unknown-linux-gnu +# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' +# - build: macos-x64 +# os: macos-12 +# target: x86_64-apple-darwin +# # we only build the integration-test CLI, we don't run tests +# - build: macos-arm +# os: macos-12 +# target: aarch64-apple-darwin, +# - build: linux-musl +# target: x86_64-unknown-linux-musl +# os: ubuntu-22.04 +# container: alpine:latest +# - build: windows-x64 +# os: windows-2019 +# target: x86_64-pc-windows-msvc +# # For now, disable LLVM in `windows-x64.` +# # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' +# +# container: ${{ matrix.container }} +# env: +# SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob +# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} +# steps: +# - uses: actions/checkout@v3 +# - uses: goto-bus-stop/setup-zig@v2 +# with: +# version: 0.10.0 +# - name: Set up base deps on musl +# if: matrix.build == 'linux-musl' +# run: | +# ./scripts/alpine-linux-install-deps.sh +# echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV +# - uses: actions/download-artifact@v4 +# id: download +# with: +# name: capi-${{ matrix.build }} +# - uses: actions/download-artifact@v4 +# with: +# name: wasmer-cli-${{ matrix.build }} +# - name: 'Echo download path' +# run: echo ${{steps.download.outputs.download-path}} +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.MSRV }} +# target: ${{ matrix.metadata.target }} +# - name: Install Nextest +# uses: taiki-e/install-action@nextest +# - name: Cache +# uses: whywaita/actions-cache-s3@v2 +# with: +# path: | +# ~/.cargo/* +# ./target/* +# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-integration-cli-${{ matrix.build }} +# aws-s3-bucket: wasmer-rust-artifacts-cache +# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} +# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} +# aws-region: auto +# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com +# aws-s3-bucket-endpoint: false +# aws-s3-force-path-style: true +# - name: Prepare package directory +# shell: bash +# run: | +# mkdir -p package +# mkdir -p package/cache +# - uses: actions/download-artifact@v4 +# with: +# name: capi-linux-aarch64 +# path: package/cache/wasmercache1 +# - uses: actions/download-artifact@v4 +# with: +# name: capi-windows-x64 +# path: package/cache/wasmercache2 +# - uses: actions/download-artifact@v4 +# with: +# name: capi-macos-arm +# path: package/cache/wasmercache3 +# - uses: actions/download-artifact@v4 +# with: +# name: capi-macos-x64 +# path: package/cache/wasmercache4 +# - uses: actions/download-artifact@v4 +# with: +# name: capi-linux-x64 +# path: package/cache/wasmercache5 +# - uses: actions/download-artifact@v4 +# with: +# name: capi-linux-riscv64 +# path: package/cache/wasmercache6 +# - name: Copy .tar.gz files to proper location +# shell: bash +# run: | +# ls package/cache/wasmercache1 +# ls package/cache/wasmercache2 +# ls package/cache/wasmercache3 +# ls package/cache/wasmercache4 +# ls package/cache/wasmercache5 +# cp package/cache/wasmercache1/wasmer.tar.gz package/cache/wasmer-linux-aarch64.tar.gz +# cp package/cache/wasmercache2/build-capi.tar.gz package/cache/wasmer-windows-gnu64.tar.gz +# cp package/cache/wasmercache3/build-capi.tar.gz package/cache/wasmer-darwin-arm64.tar.gz +# cp package/cache/wasmercache4/build-capi.tar.gz package/cache/wasmer-darwin-amd64.tar.gz +# cp package/cache/wasmercache5/build-capi.tar.gz package/cache/wasmer-linux-amd64.tar.gz +# cp package/cache/wasmercache6/wasmer.tar.gz package/cache/wasmer-linux-riscv64.tar.gz +# - uses: actions/download-artifact@v4 +# if: ${{ matrix.build == 'windows-x64' }} +# with: +# name: capi-windows-x64 +# path: download_link +# - uses: actions/download-artifact@v4 +# if: ${{ matrix.build == 'linux-musl' }} +# with: +# name: capi-linux-musl +# path: download_link +# - uses: actions/download-artifact@v4 +# if: ${{ matrix.build == 'macos-arm' }} +# with: +# name: capi-macos-arm +# path: download_link +# - uses: actions/download-artifact@v4 +# if: ${{ matrix.build == 'macos-x64' }} +# with: +# name: capi-macos-x64 +# path: download_link +# - uses: actions/download-artifact@v4 +# if: ${{ matrix.build == 'linux-x64' }} +# with: +# name: capi-linux-x64 +# path: download_link +# - name: Copy build-capi.tar.gz to link.tar.gz +# shell: bash +# run: | +# cp download_link/build-capi.tar.gz link.tar.gz +# - name: Unzip Artifacts +# shell: bash +# run: | +# make untar-capi +# - name: Unzip Artifacts +# shell: bash +# run: | +# make untar-wasmer +# +# # Removed in favour of freestanding integration tests +# # +# # - name: Test integration CLI +# # if: false # matrix.build != 'macos-arm' +# # shell: bash +# # run: | +# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} +# # export WASMER_DIR=`pwd`/package && make test-integration-cli-ci +# # env: +# # TARGET: ${{ matrix.target }} +# # TARGET_DIR: target/${{ matrix.target }}/release +# # CARGO_TARGET: ${{ matrix.target }} +# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} +# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# +# # ---- +# # Note (xdoardo on 2024/10/07): +# # --- +# # As of now the WAMR, WASMI (and V8) backends are not that mature enough. We will re-enable these tests +# # when they've been used and matured. +# # ---- +# # +# # - name: Test CLI integration (WAMR) +# # shell: bash +# # run: | +# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} +# # export WASMER_DIR=`pwd`/package && make test-integration-cli-wamr-ci +# # env: +# # TARGET: ${{ matrix.target }} +# # TARGET_DIR: target/${{ matrix.target }}/release +# # CARGO_TARGET: ${{ matrix.target }} +# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} +# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# # - name: Test CLI integration (WASMI) +# # shell: bash +# # run: | +# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} +# # export WASMER_DIR=`pwd`/package && make test-integration-cli-wasmi-ci +# # env: +# # TARGET: ${{ matrix.target }} +# # TARGET_DIR: target/${{ matrix.target }}/release +# # CARGO_TARGET: ${{ matrix.target }} +# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} +# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# +# # there is another set of integration tests in 'wasmer-integration-tests' repo. Run those +# test-wasmer-integration-tests: +# needs: [build] +# runs-on: ubuntu-22.04 +# steps: +# - name: Checkout wasmer-integration-tests repository +# uses: actions/checkout@v3 +# with: +# repository: wasmerio/wasmer-integration-tests +# submodules: true +# token: ${{ secrets.CLONE_WASMER_INTEGRATION_TESTS }} +# - uses: actions/download-artifact@v4 +# with: +# name: wasmer-cli-linux-x64 +# - name: Cargo Registry Cache +# uses: actions/cache@v3 +# with: +# path: | +# ~/.cargo/advisory-db +# ~/.cargo/git +# ~/.cargo/registry +# key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} +# - name: Cargo target cache +# uses: actions/cache@v3 +# with: +# path: | +# target/ +# key: cargo-release-${{ hashFiles('**/Cargo.lock') }} +# - run: | +# # install rust toolchain +# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +# . "$HOME/.cargo/env" +# +# # add wasmer cli to PATH +# tar -xzf build-wasmer.tar.gz +# +# docker build -t tmp . +# docker run -v $PWD:/app -w /app tmp bash -c " \ +# cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\ +# export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ +# export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ +# export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ +# export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ +# export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ +# export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ +# export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ +# export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ +# export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ +# export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ +# export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ +# wasmer config set registry.url https://registry.wasmer.io/graphql &&\ +# wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\ +# wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ +# wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\ +# cargo test --no-fail-fast" +# - name: notify failure in slack +# if: failure() +# run: | +# curl -X POST -H 'Content-type: application/json' --data '{"text":"Integration tests failed ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.INTEGRATION_TEST_SLACK_WEBHOOK }} From 519782bb3a16fcf75e4aad2bbee2be9c1988bf95 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 14:33:23 +0100 Subject: [PATCH 19/23] ci: lower the filter level --- lib/wasix/tests/runners.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wasix/tests/runners.rs b/lib/wasix/tests/runners.rs index 3c54b500647..5f4187d384e 100644 --- a/lib/wasix/tests/runners.rs +++ b/lib/wasix/tests/runners.rs @@ -35,7 +35,7 @@ mod wasi { fn setup() { INIT.call_once(|| { env_logger::builder() - .filter_level(log::LevelFilter::max()) + .filter_level(log::LevelFilter::Debug) .init(); }); } From 8361007e8e43233d4fd27d972c5a3b40b30b5299 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 15:01:19 +0100 Subject: [PATCH 20/23] ci: build on aarch64 --- .github/workflows/test.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 143f752b683..d02e58c8797 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -750,21 +750,21 @@ jobs: # exe: '', # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' #}, - { - build: macos-x64, - os: macos-12, - target: x86_64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' - - }, #{ - # build: macos-arm, - # os: macos-14, - # target: aarch64-apple-darwin, + # build: macos-x64, + # os: macos-12, + # target: x86_64-apple-darwin, # exe: '', - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' + #}, + { + build: macos-arm, + os: macos-14, + target: aarch64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + }, #{ # build: windows-x64, # os: windows-2022, From 961fdf5df277a0f6cb8c38469507c17c990a2395 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 15:39:49 +0100 Subject: [PATCH 21/23] ci: run wast tests --- .github/workflows/test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d02e58c8797..e5dc87de57c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -717,15 +717,15 @@ jobs: fail-fast: false matrix: stage: [ - #{ - # description: 'Run wast test suite for all compilers', - # make: 'test-stage-0-wast', - #}, { - description: 'Unit-test packages on std', - make: 'test-stage-1-test-all', + description: 'Run wast test suite for all compilers', + make: 'test-stage-0-wast', }, #{ + # description: 'Unit-test packages on std', + # make: 'test-stage-1-test-all', + #}, + #{ # description: 'Unit-test cranelift on no-std', # make: 'test-stage-2-test-compiler-cranelift-nostd', #}, From 740a6eeff3bf4c19fa8f66951e3a3f664a03f577 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 15:47:04 +0100 Subject: [PATCH 22/23] ci: Run all tests on aarch64 --- .github/workflows/test.yaml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e5dc87de57c..97d60c5b47e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -721,26 +721,26 @@ jobs: description: 'Run wast test suite for all compilers', make: 'test-stage-0-wast', }, - #{ - # description: 'Unit-test packages on std', - # make: 'test-stage-1-test-all', - #}, - #{ - # description: 'Unit-test cranelift on no-std', - # make: 'test-stage-2-test-compiler-cranelift-nostd', - #}, - #{ - # description: 'Unit-test singlepass on no-std', - # make: 'test-stage-3-test-compiler-singlepass-nostd', - #}, - #{ - # description: 'Unit-test wasmer-cli', - # make: 'test-stage-4-wasmer-cli', - #}, - #{ - # description: 'Unit-test examples', - # make: 'test-stage-5-test-examples', - #} + { + description: 'Unit-test packages on std', + make: 'test-stage-1-test-all', + }, + { + description: 'Unit-test cranelift on no-std', + make: 'test-stage-2-test-compiler-cranelift-nostd', + }, + { + description: 'Unit-test singlepass on no-std', + make: 'test-stage-3-test-compiler-singlepass-nostd', + }, + { + description: 'Unit-test wasmer-cli', + make: 'test-stage-4-wasmer-cli', + }, + { + description: 'Unit-test examples', + make: 'test-stage-5-test-examples', + } ] metadata: [ #{ From 5eefba586c3bd9131a112d9e1fd40ec7475f40dd Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Tue, 5 Nov 2024 15:58:50 +0100 Subject: [PATCH 23/23] ci: reenable all jobs --- .github/workflows/test.yaml | 1901 +++++++++++++++++------------------ Cargo.lock | 4 - lib/wasix/Cargo.toml | 2 +- 3 files changed, 951 insertions(+), 956 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 97d60c5b47e..a103b45e5ac 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -48,666 +48,666 @@ jobs: echo $VERSION echo $DOING_RELEASE -# lint: -# name: Code lint -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# components: rustfmt, clippy -# - name: Install libtinfo -# shell: bash -# run: | -# sudo apt install -y libtinfo5 -# - name: Install LLVM (Linux) -# run: | -# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o /opt/llvm.tar.xz -# mkdir -p /opt/llvm-18 -# tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-18 -# echo '/opt/llvm-18/bin' >> $GITHUB_PATH -# echo 'LLVM_SYS_180_PREFIX=/opt/llvm-18' >> $GITHUB_ENV -# - name: Cache -# uses: whywaita/actions-cache-s3@v2 -# with: -# path: | -# ~/.cargo/* -# ./target/* -# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-lint-linux-x64 -# aws-s3-bucket: wasmer-rust-artifacts-cache -# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} -# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} -# aws-region: auto -# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com -# aws-s3-bucket-endpoint: false -# aws-s3-force-path-style: true -# - run: make lint -# env: -# ENABLE_CRANELIFT: "1" -# ENABLE_LLVM: "1" -# ENABLE_SINGLEPASS: "1" -# - name: Assert no files have changed -# run: | -# git status -# ! [[ $(git status -s) ]] -# -# cargo_deny: -# name: cargo-deny -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - uses: EmbarkStudios/cargo-deny-action@v1 -# with: -# log-level: error -# -# test_nodejs: -# name: Test on NodeJS -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# - name: Install NodeJS -# uses: actions/setup-node@v2 -# with: -# node-version: 16 -# - name: Install wasm-pack -# run: | -# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -# - name: make test-js -# run: | -# make test-js -# -# test_wasi_fyi: -# name: Test wasi-fyi -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: nightly -# targets: "wasm32-wasi" -# - name: Install wasm-pack -# run: | -# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -# - name: Install LLVM 18 -# run: | -# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz -# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} -# mkdir ${LLVM_DIR} -# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} -# echo "ENABLE_LLVM=1" >> $GITHUB_ENV -# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH -# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH -# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV -# env: -# LLVM_DIR: .llvm -# - name: make test-wasi-fyi -# run: | -# make test-wasi-fyi -# -# # The no_std functionality doesn't work at the moment - no point in testing it. -# # - name: make test-js-core -# # run: | -# # make test-js-core -# -# test_wasix: -# name: Test WASIX -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# - name: Install Tools -# run: | -# sudo apt-get update -# sudo apt-get install -y git llvm clang make lld curl -# - name: Build wasix sysroot -# run: | -# cd ~ -# git clone --recurse-submodules https://github.com/wasix-org/wasix-libc -# cd wasix-libc -# ./build32.sh -# rm -rf /opt/wasix-sysroot -# cp -r sysroot32 ~/wasix-sysroot -# - name: Install wasi-sdk Tools -# run: | -# cd ~ -# curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz" -o wasi-sdk.tar.gz -# tar -xzf wasi-sdk.tar.gz -# cp -r wasi-sdk-${{ env.WASI_SDK_VERSION }}.0 ~/wasi-sdk -# - name: Install LLVM 18 -# run: | -# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz -# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} -# mkdir ${LLVM_DIR} -# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} -# echo "ENABLE_LLVM=1" >> $GITHUB_ENV -# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH -# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH -# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV -# env: -# LLVM_DIR: .llvm -# - name: Install wasm-opt -# run: | -# sudo apt-get install -y binaryen -# - name: make test-wasix -# run: | -# WASI_SDK=~/wasi-sdk WASIX_SYSROOT=~/wasix-sysroot make test-wasix -# -# test_wasm_build: -# name: Test wasm build -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - name: rustup target add wasm32-wasi -# run: rustup target add wasm32-wasi -# - name: make build-wasmer-wasm -# run: make build-wasmer-wasm -# -# test_build_jsc: -# name: Test JSC build -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# target: x86_64-unknown-linux-gnu -# - name: Install NodeJS -# uses: actions/setup-node@v2 -# with: -# node-version: 16 -# - name: Install libjavascriptcoregtk-4.0-dev -# run: sudo apt update && sudo apt install -y libjavascriptcoregtk-4.0-dev -# - name: make build-wasmer-jsc -# run: make build-wasmer-jsc -# -# test_interpreter_api: -# name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} -# runs-on: ${{ matrix.metadata.os }} -# strategy: -# fail-fast: false -# matrix: -# build-what: [ -# { -# key: wamr, -# build-cmd: 'make test-wamr-api', -# name: 'Test API for wamr feature' -# }, -# { -# key: wasmi, -# build-cmd: 'make test-wasmi-api', -# name: 'Test API for wasmi feature' -# }, -# { -# key: v8, -# build-cmd: 'make test-v8-api', -# name: 'Test API for v8 feature' -# } -# -# ] -# metadata: [ -# { -# build: linux-x64, -# os: ubuntu-22.04, -# }, -# { -# build: macos-arm, -# os: macos-14, -# }, -# { -# build: windows-x64, -# os: windows-2022, -# } -# ] -# container: ${{ matrix.metadata.container }} -# steps: -# - uses: actions/checkout@v3 -# -# - name: Setup MSVC (Windows) -# uses: ilammy/msvc-dev-cmd@v1 -# if: matrix.metadata.build == 'windows-x64' -# -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# -# - name: Install Nextest -# uses: taiki-e/install-action@nextest -# -# - name: Install `ninja`, clang` and `mold` on Ubuntu -# if: startsWith(matrix.metadata.build, 'linux-') -# shell: bash -# run: | -# sudo apt-get update -y && sudo apt-get install ninja-build clang mold -y -# -# - name: Install `ninja` on macOS -# if: startsWith(matrix.metadata.build, 'macos-') -# shell: bash -# run: | -# brew install ninja -# -# - name: Install `ninja` on Windows -# if: startsWith(matrix.metadata.build, 'windows-') -# shell: bash -# run: | -# choco install ninja -# -# - name: Delete unwanted link to stop it from interfering (Windows) -# shell: bash -# run: rm /usr/bin/link.exe -# if: startsWith(matrix.metadata.build, 'windows-') -# -# - name: Test WAMR API -# if: ${{ matrix.build-what.key == 'wamr' }} -# run: ${{ matrix.build-what.build-cmd }} -# -# - name: Test wasmi API -# if: ${{ matrix.build-what.key == 'wasmi' }} -# run: ${{ matrix.build-what.build-cmd }} -# -# - name: Test v8 API (Linux + mold) -# if: ${{ matrix.build-what.key == 'v8' && startsWith(matrix.metadata.build, 'linux-')}} -# run: RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" CARGO_TERM_VERBOSE=true cargo nextest run --package=wasmer --release --features=v8 --no-default-features -# -# - name: Test v8 API -# if: ${{ matrix.build-what.key == 'v8' && !startsWith(matrix.metadata.build, 'linux-')}} -# run: ${{ matrix.build-what.build-cmd }} -# -# test_build_docs_rs: -# name: Test build docs rs -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v3 -# - uses: dtolnay/rust-toolchain@master -# with: -# toolchain: "nightly-2024-08-21" -# target: x86_64-unknown-linux-gnu -# - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` -# -# - name: Install `ninja` on Ubuntu -# shell: bash -# run: | -# sudo apt-get install ninja-build -y -# -# - name: Install LLVM 18 -# run: | -# curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz -# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} -# mkdir ${LLVM_DIR} -# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} -# echo "ENABLE_LLVM=1" >> $GITHUB_ENV -# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH -# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH -# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV -# env: -# LLVM_DIR: .llvm -# - name: make test-build-docs-rs-ci -# run: make test-build-docs-rs-ci -# -# build_linux_aarch64: -# name: ${{ matrix.build-what.name }} on linux-aarch64 -# runs-on: ubuntu-22.04 -# strategy: -# fail-fast: false -# matrix: -# build-what: [ -# { -# key: capi, -# build-cmd: 'make build-capi && make package-capi', -# name: 'Build C-API' -# }, -# { -# key: wasmer, -# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', -# name: 'Build wasmer-cli' -# } -# ] -# steps: -# - uses: actions/checkout@v3 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# target: aarch64-unknown-linux-gnu -# - name: Build cross image -# run: | -# docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ -# env: -# CROSS_DOCKER_IN_DOCKER: true -# - name: Build ${{ matrix.build-what.key }} -# run: | -# ${{ matrix.build-what.build-cmd }} -# env: -# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross -# CROSS_DOCKER_IN_DOCKER: true -# CARGO_TARGET: aarch64-unknown-linux-gnu -# PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig -# PKG_CONFIG_ALLOW_CROSS: true -# ENABLE_LLVM: 0 -# - name: Dist -# if: ${{ matrix.build-what.key == 'capi' }} -# run: | -# make distribution -# env: -# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross -# CROSS_DOCKER_IN_DOCKER: true -# CARGO_TARGET: aarch64-unknown-linux-gnu -# PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig -# PKG_CONFIG_ALLOW_CROSS: true -# TARGET: aarch64-unknown-linux-gnu -# TARGET_DIR: target/aarch64-unknown-linux-gnu/release -# - name: Upload Artifacts -# if: ${{ matrix.build-what.key == 'capi' }} -# uses: actions/upload-artifact@v4 -# with: -# name: capi-linux-aarch64 -# path: dist -# if-no-files-found: error -# retention-days: 2 -# -# build_linux_riscv64: -# name: ${{ matrix.build-what.name }} on linux-riscv64 -# runs-on: ubuntu-22.04 -# strategy: -# fail-fast: false -# matrix: -# build-what: [ -# { -# key: capi, -# build-cmd: 'make build-capi && make package-capi', -# name: 'Build C-API' -# }, -# { -# key: wasmer, -# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', -# name: 'Build wasmer-cli' -# } -# ] -# steps: -# - uses: actions/checkout@v3 -# #- uses: dtolnay/rust-toolchain@stable -# # with: -# # toolchain: ${{ env.MSRV }} -# # target: riscv64gc-unknown-linux-gnu -# - name: Build cross image -# run: | -# docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ -# env: -# CROSS_DOCKER_IN_DOCKER: true -# - name: Build ${{ matrix.build-what.key }} -# run: | -# ${{ matrix.build-what.build-cmd }} -# env: -# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo -# CROSS_DOCKER_IN_DOCKER: true -# CARGO_TARGET: riscv64gc-unknown-linux-gnu -# ENABLE_LLVM: 0 -# - name: Dist -# if: ${{ matrix.build-what.key == 'capi' }} -# run: | -# make distribution -# env: -# CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo -# CROSS_DOCKER_IN_DOCKER: true -# CARGO_TARGET: riscv64gc-unknown-linux-gnu -# PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig -# PKG_CONFIG_ALLOW_CROSS: true -# TARGET: riscv64gc-unknown-linux-gnu -# TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release -# - name: Upload Artifacts -# if: ${{ matrix.build-what.key == 'capi' }} -# uses: actions/upload-artifact@v4 -# with: -# name: capi-linux-riscv64 -# path: dist -# if-no-files-found: error -# retention-days: 2 -# -# build: -# name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} -# runs-on: ${{ matrix.metadata.os }} -# needs: setup -# strategy: -# fail-fast: false -# matrix: -# build-what: [ -# { -# key: capi, -# build-cmd: 'make build-capi && make build-capi-headless && make package-capi && make tar-capi', -# name: 'Build and test C-API' -# }, -# { -# key: wasmer, -# build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', -# name: 'Build wasmer-cli' -# } -# ] -# metadata: [ -# { -# build: linux-x64, -# os: ubuntu-22.04, -# target: x86_64-unknown-linux-gnu, -# exe: '', -# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' -# }, -# { -# build: macos-x64, -# os: macos-12, -# target: x86_64-apple-darwin, -# exe: '', -# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' -# -# }, -# { -# build: macos-arm, -# os: macos-14, -# target: aarch64-apple-darwin, -# exe: '', -# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' -# }, -# { -# build: windows-x64, -# os: windows-2022, -# target: x86_64-pc-windows-msvc, -# exe: '.exe', -# # For now, disable LLVM in `windows-x64.` -# # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' -# }, -# { -# build: windows-gnu, -# target: x86_64-pc-windows-gnu, -# os: ubuntu-22.04, -# }, -# { -# build: linux-musl, -# target: x86_64-unknown-linux-musl, -# os: ubuntu-22.04, -# exe: '', -# container: 'alpine:latest' -# } -# -# ] -# container: ${{ matrix.metadata.container }} -# env: -# SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob -# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} -# steps: -# - uses: actions/checkout@v3 -# - name: Set up libstdc++ on Linux -# if: matrix.metadata.build == 'linux-x64' -# run: | -# sudo apt-get update -y -# sudo apt-get install -y --allow-downgrades libstdc++6 libtinfo5 -# sudo apt-get install --reinstall g++ -# - name: Set up base deps on musl -# if: matrix.metadata.build == 'linux-musl' -# run: | -# ./scripts/alpine-linux-install-deps.sh -# echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV -# - name: Set up dependencies for Mac OS -# run: | -# brew install automake -# # using gnu-tar is a workaround for https://github.com/actions/cache/issues/403 -# brew install gnu-tar -# echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV -# if: matrix.metadata.os == 'macos-12' -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# target: ${{ matrix.metadata.target }} -# - name: Install Nextest -# uses: taiki-e/install-action@nextest -# - name: Install MSVC dev-cmd (Windows) -# uses: ilammy/msvc-dev-cmd@v1 -# if: ${{ matrix.metadata.build == 'windows-x64' }} -# - name: Delete unwanted link to stop it from interfering (Windows) -# shell: bash -# run: rm /usr/bin/link.exe -# if: ${{ matrix.metadata.build == 'windows-x64' }} -# - name: Install Windows-GNU linker -# if: ${{ matrix.metadata.build == 'windows-gnu' }} -# shell: bash -# run: | -# sudo apt install -y mingw-w64 -# - name: Install Windows-GNU target -# if: ${{ matrix.metadata.build == 'windows-gnu' }} -# shell: bash -# run: | -# rustup target add x86_64-pc-windows-gnu -# - name: Install Windows 10 SDK with xwin -# if: ${{ matrix.metadata.build == 'windows-gnu' }} -# shell: bash -# run: | -# mkdir -p /tmp/xwin -# mkdir -p /tmp/xwindownload -# mkdir -p /tmp/xwincache -# git clone https://github.com/wasmerio/xwin --depth=1 /tmp/xwin -# cargo build --release --manifest-path=/tmp/xwin/Cargo.toml -# /tmp/xwin/target/release/xwin --accept-license --cache-dir /tmp/xwincache splat --output /tmp/xwindownload -# mkdir -p /tmp/winsdk -# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/WS2_32.lib /tmp/winsdk/ -# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/KERNEL32.lib /tmp/winsdk/ -# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/BCRYPT.lib /tmp/winsdk/ -# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/ADVAPI32.lib /tmp/winsdk/ -# cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/USERENV.lib /tmp/winsdk/ -# echo "WinSDK files:" -# ls -laH /tmp/winsdk -# echo "" -# mkdir -p package -# mkdir -p package/winsdk -# cp -r /tmp/winsdk/* package/winsdk -# - name: Install LLVM (macOS Apple Silicon) -# if: matrix.metadata.os == 'macos-12' && !matrix.metadata.llvm_url -# run: | -# brew install llvm -# - name: Install LLVM -# shell: bash -# if: matrix.metadata.llvm_url -# run: | -# curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.metadata.llvm_url }} -L -o llvm.tar.xz -# LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} -# mkdir ${LLVM_DIR} -# tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} -# echo "ENABLE_LLVM=1" >> $GITHUB_ENV -# echo "${LLVM_DIR}/bin" >> $GITHUB_PATH -# echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH -# echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV -# env: -# LLVM_DIR: .llvm -# - name: Add `brew` libs to `RUSTFLAGS` -# if: matrix.metadata.os == 'macos-14' -# shell: bash -# run: | -# echo "RUSTFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV -# - name: Setup Rust target -# shell: bash -# run: | -# mkdir -p .cargo -# cat << EOF > .cargo/config.toml -# [build] -# target = "${{ matrix.metadata.target }}" -# EOF -# if: matrix.metadata.target -# - name: which cargo -# if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} -# run: which cargo -# - name: Set cargo env -# run: echo "CARGO_ROOT_DIR=$(dirname $(dirname $( which cargo )))" >> $GITHUB_ENV -# - name: List root dir -# shell: bash -# if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} -# run: ls -R $CARGO_ROOT_DIR -# - name: Cache -# uses: whywaita/actions-cache-s3@v2 -# with: -# path: | -# ~/.cargo/* -# ./target/* -# $CARGO_ROOT_DIR/* -# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-build-wasmer-${{ matrix.build-what.key }}-${{ matrix.metadata.build }} -# aws-s3-bucket: wasmer-rust-artifacts-cache -# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} -# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} -# aws-region: auto -# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com -# aws-s3-bucket-endpoint: false -# aws-s3-force-path-style: true -# - name: Build C-API -# shell: bash -# run: ${{ matrix.build-what.build-cmd }} -# if: ${{ matrix.build-what.key == 'capi' }} -# env: -# TARGET: ${{ matrix.metadata.target }} -# TARGET_DIR: target/${{ matrix.metadata.target }}/release -# CARGO_TARGET: ${{ matrix.metadata.target }} -# - name: Build Wasmer -# shell: bash -# if: ${{ matrix.build-what.key == 'wasmer' && matrix.metadata.build != 'windows-gnu' }} -# run: ${{ matrix.build-what.build-cmd }} -# env: -# TARGET: ${{ matrix.metadata.target }} -# TARGET_DIR: target/${{ matrix.metadata.target }}/release -# CARGO_TARGET: ${{ matrix.metadata.target }} -# - name: Test C-API -# shell: bash -# if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} -# run: make test-capi-ci -# env: -# TARGET: ${{ matrix.metadata.target }} -# TARGET_DIR: target/${{ matrix.metadata.target }}/release -# CARGO_TARGET: ${{ matrix.metadata.target }} -# # C-API tests were disabled for linux-musl and macos-arm (we can't run them) -# - name: Test C-API integration -# shell: bash -# if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} -# run: export WASMER_DIR=`pwd`/package && make test-stage-7-capi-integration-tests -# env: -# TARGET: ${{ matrix.metadata.target }} -# TARGET_DIR: target/${{ matrix.metadata.target }}/release -# CARGO_TARGET: ${{ matrix.metadata.target }} -# - name: Archive production artifacts -# uses: actions/upload-artifact@v4 -# with: -# name: wasmer-cli-${{ matrix.metadata.build }} -# path: build-wasmer.tar.gz -# if-no-files-found: ignore -# retention-days: 2 -# - name: Archive production artifacts -# uses: actions/upload-artifact@v4 -# with: -# name: capi-${{ matrix.metadata.build }} -# path: build-capi.tar.gz -# if-no-files-found: ignore -# retention-days: 2 + lint: + name: Code lint + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + components: rustfmt, clippy + - name: Install libtinfo + shell: bash + run: | + sudo apt install -y libtinfo5 + - name: Install LLVM (Linux) + run: | + curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o /opt/llvm.tar.xz + mkdir -p /opt/llvm-18 + tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-18 + echo '/opt/llvm-18/bin' >> $GITHUB_PATH + echo 'LLVM_SYS_180_PREFIX=/opt/llvm-18' >> $GITHUB_ENV + - name: Cache + uses: whywaita/actions-cache-s3@v2 + with: + path: | + ~/.cargo/* + ./target/* + key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-lint-linux-x64 + aws-s3-bucket: wasmer-rust-artifacts-cache + aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} + aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} + aws-region: auto + aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com + aws-s3-bucket-endpoint: false + aws-s3-force-path-style: true + - run: make lint + env: + ENABLE_CRANELIFT: "1" + ENABLE_LLVM: "1" + ENABLE_SINGLEPASS: "1" + - name: Assert no files have changed + run: | + git status + ! [[ $(git status -s) ]] + + cargo_deny: + name: cargo-deny + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + log-level: error + + test_nodejs: + name: Test on NodeJS + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + - name: Install NodeJS + uses: actions/setup-node@v2 + with: + node-version: 16 + - name: Install wasm-pack + run: | + curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - name: make test-js + run: | + make test-js + + test_wasi_fyi: + name: Test wasi-fyi + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + targets: "wasm32-wasi" + - name: Install wasm-pack + run: | + curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - name: Install LLVM 18 + run: | + curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "ENABLE_LLVM=1" >> $GITHUB_ENV + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH + echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: make test-wasi-fyi + run: | + make test-wasi-fyi + + # The no_std functionality doesn't work at the moment - no point in testing it. + # - name: make test-js-core + # run: | + # make test-js-core + + test_wasix: + name: Test WASIX + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + - name: Install Tools + run: | + sudo apt-get update + sudo apt-get install -y git llvm clang make lld curl + - name: Build wasix sysroot + run: | + cd ~ + git clone --recurse-submodules https://github.com/wasix-org/wasix-libc + cd wasix-libc + ./build32.sh + rm -rf /opt/wasix-sysroot + cp -r sysroot32 ~/wasix-sysroot + - name: Install wasi-sdk Tools + run: | + cd ~ + curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz" -o wasi-sdk.tar.gz + tar -xzf wasi-sdk.tar.gz + cp -r wasi-sdk-${{ env.WASI_SDK_VERSION }}.0 ~/wasi-sdk + - name: Install LLVM 18 + run: | + curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "ENABLE_LLVM=1" >> $GITHUB_ENV + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH + echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: Install wasm-opt + run: | + sudo apt-get install -y binaryen + - name: make test-wasix + run: | + WASI_SDK=~/wasi-sdk WASIX_SYSROOT=~/wasix-sysroot make test-wasix + + test_wasm_build: + name: Test wasm build + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: rustup target add wasm32-wasi + run: rustup target add wasm32-wasi + - name: make build-wasmer-wasm + run: make build-wasmer-wasm + + test_build_jsc: + name: Test JSC build + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + target: x86_64-unknown-linux-gnu + - name: Install NodeJS + uses: actions/setup-node@v2 + with: + node-version: 16 + - name: Install libjavascriptcoregtk-4.0-dev + run: sudo apt update && sudo apt install -y libjavascriptcoregtk-4.0-dev + - name: make build-wasmer-jsc + run: make build-wasmer-jsc + + test_interpreter_api: + name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} + runs-on: ${{ matrix.metadata.os }} + strategy: + fail-fast: false + matrix: + build-what: [ + { + key: wamr, + build-cmd: 'make test-wamr-api', + name: 'Test API for wamr feature' + }, + { + key: wasmi, + build-cmd: 'make test-wasmi-api', + name: 'Test API for wasmi feature' + }, + { + key: v8, + build-cmd: 'make test-v8-api', + name: 'Test API for v8 feature' + } + + ] + metadata: [ + { + build: linux-x64, + os: ubuntu-22.04, + }, + { + build: macos-arm, + os: macos-14, + }, + { + build: windows-x64, + os: windows-2022, + } + ] + container: ${{ matrix.metadata.container }} + steps: + - uses: actions/checkout@v3 + + - name: Setup MSVC (Windows) + uses: ilammy/msvc-dev-cmd@v1 + if: matrix.metadata.build == 'windows-x64' + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + + - name: Install Nextest + uses: taiki-e/install-action@nextest + + - name: Install `ninja`, clang` and `mold` on Ubuntu + if: startsWith(matrix.metadata.build, 'linux-') + shell: bash + run: | + sudo apt-get update -y && sudo apt-get install ninja-build clang mold -y + + - name: Install `ninja` on macOS + if: startsWith(matrix.metadata.build, 'macos-') + shell: bash + run: | + brew install ninja + + - name: Install `ninja` on Windows + if: startsWith(matrix.metadata.build, 'windows-') + shell: bash + run: | + choco install ninja + + - name: Delete unwanted link to stop it from interfering (Windows) + shell: bash + run: rm /usr/bin/link.exe + if: startsWith(matrix.metadata.build, 'windows-') + + - name: Test WAMR API + if: ${{ matrix.build-what.key == 'wamr' }} + run: ${{ matrix.build-what.build-cmd }} + + - name: Test wasmi API + if: ${{ matrix.build-what.key == 'wasmi' }} + run: ${{ matrix.build-what.build-cmd }} + + - name: Test v8 API (Linux + mold) + if: ${{ matrix.build-what.key == 'v8' && startsWith(matrix.metadata.build, 'linux-')}} + run: RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" CARGO_TERM_VERBOSE=true cargo nextest run --package=wasmer --release --features=v8 --no-default-features + + - name: Test v8 API + if: ${{ matrix.build-what.key == 'v8' && !startsWith(matrix.metadata.build, 'linux-')}} + run: ${{ matrix.build-what.build-cmd }} + + test_build_docs_rs: + name: Test build docs rs + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: "nightly-2024-08-21" + target: x86_64-unknown-linux-gnu + - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` + + - name: Install `ninja` on Ubuntu + shell: bash + run: | + sudo apt-get install ninja-build -y + + - name: Install LLVM 18 + run: | + curl --proto '=https' --tlsv1.2 -sSf https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "ENABLE_LLVM=1" >> $GITHUB_ENV + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH + echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: make test-build-docs-rs-ci + run: make test-build-docs-rs-ci + + build_linux_aarch64: + name: ${{ matrix.build-what.name }} on linux-aarch64 + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + build-what: [ + { + key: capi, + build-cmd: 'make build-capi && make package-capi', + name: 'Build C-API' + }, + { + key: wasmer, + build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', + name: 'Build wasmer-cli' + } + ] + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + target: aarch64-unknown-linux-gnu + - name: Build cross image + run: | + docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Build ${{ matrix.build-what.key }} + run: | + ${{ matrix.build-what.build-cmd }} + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + ENABLE_LLVM: 0 + - name: Dist + if: ${{ matrix.build-what.key == 'capi' }} + run: | + make distribution + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + TARGET: aarch64-unknown-linux-gnu + TARGET_DIR: target/aarch64-unknown-linux-gnu/release + - name: Upload Artifacts + if: ${{ matrix.build-what.key == 'capi' }} + uses: actions/upload-artifact@v4 + with: + name: capi-linux-aarch64 + path: dist + if-no-files-found: error + retention-days: 2 + + build_linux_riscv64: + name: ${{ matrix.build-what.name }} on linux-riscv64 + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + build-what: [ + { + key: capi, + build-cmd: 'make build-capi && make package-capi', + name: 'Build C-API' + }, + { + key: wasmer, + build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', + name: 'Build wasmer-cli' + } + ] + steps: + - uses: actions/checkout@v3 + #- uses: dtolnay/rust-toolchain@stable + # with: + # toolchain: ${{ env.MSRV }} + # target: riscv64gc-unknown-linux-gnu + - name: Build cross image + run: | + docker build -t wasmer/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/ + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Build ${{ matrix.build-what.key }} + run: | + ${{ matrix.build-what.build-cmd }} + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + ENABLE_LLVM: 0 + - name: Dist + if: ${{ matrix.build-what.key == 'capi' }} + run: | + make distribution + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/riscv64 cargo + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: riscv64gc-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + TARGET: riscv64gc-unknown-linux-gnu + TARGET_DIR: target/riscv64gc-unknown-linux-gnu/release + - name: Upload Artifacts + if: ${{ matrix.build-what.key == 'capi' }} + uses: actions/upload-artifact@v4 + with: + name: capi-linux-riscv64 + path: dist + if-no-files-found: error + retention-days: 2 + + build: + name: ${{ matrix.build-what.name }} on ${{ matrix.metadata.build }} + runs-on: ${{ matrix.metadata.os }} + needs: setup + strategy: + fail-fast: false + matrix: + build-what: [ + { + key: capi, + build-cmd: 'make build-capi && make build-capi-headless && make package-capi && make tar-capi', + name: 'Build and test C-API' + }, + { + key: wasmer, + build-cmd: 'make build-wasmer && make package-wasmer && make tar-wasmer', + name: 'Build wasmer-cli' + } + ] + metadata: [ + { + build: linux-x64, + os: ubuntu-22.04, + target: x86_64-unknown-linux-gnu, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' + }, + { + build: macos-x64, + os: macos-12, + target: x86_64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' + + }, + { + build: macos-arm, + os: macos-14, + target: aarch64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' + }, + { + build: windows-x64, + os: windows-2022, + target: x86_64-pc-windows-msvc, + exe: '.exe', + # For now, disable LLVM in `windows-x64.` + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' + }, + { + build: windows-gnu, + target: x86_64-pc-windows-gnu, + os: ubuntu-22.04, + }, + { + build: linux-musl, + target: x86_64-unknown-linux-musl, + os: ubuntu-22.04, + exe: '', + container: 'alpine:latest' + } + + ] + container: ${{ matrix.metadata.container }} + env: + SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob + SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} + steps: + - uses: actions/checkout@v3 + - name: Set up libstdc++ on Linux + if: matrix.metadata.build == 'linux-x64' + run: | + sudo apt-get update -y + sudo apt-get install -y --allow-downgrades libstdc++6 libtinfo5 + sudo apt-get install --reinstall g++ + - name: Set up base deps on musl + if: matrix.metadata.build == 'linux-musl' + run: | + ./scripts/alpine-linux-install-deps.sh + echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV + - name: Set up dependencies for Mac OS + run: | + brew install automake + # using gnu-tar is a workaround for https://github.com/actions/cache/issues/403 + brew install gnu-tar + echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV + if: matrix.metadata.os == 'macos-12' + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + target: ${{ matrix.metadata.target }} + - name: Install Nextest + uses: taiki-e/install-action@nextest + - name: Install MSVC dev-cmd (Windows) + uses: ilammy/msvc-dev-cmd@v1 + if: ${{ matrix.metadata.build == 'windows-x64' }} + - name: Delete unwanted link to stop it from interfering (Windows) + shell: bash + run: rm /usr/bin/link.exe + if: ${{ matrix.metadata.build == 'windows-x64' }} + - name: Install Windows-GNU linker + if: ${{ matrix.metadata.build == 'windows-gnu' }} + shell: bash + run: | + sudo apt install -y mingw-w64 + - name: Install Windows-GNU target + if: ${{ matrix.metadata.build == 'windows-gnu' }} + shell: bash + run: | + rustup target add x86_64-pc-windows-gnu + - name: Install Windows 10 SDK with xwin + if: ${{ matrix.metadata.build == 'windows-gnu' }} + shell: bash + run: | + mkdir -p /tmp/xwin + mkdir -p /tmp/xwindownload + mkdir -p /tmp/xwincache + git clone https://github.com/wasmerio/xwin --depth=1 /tmp/xwin + cargo build --release --manifest-path=/tmp/xwin/Cargo.toml + /tmp/xwin/target/release/xwin --accept-license --cache-dir /tmp/xwincache splat --output /tmp/xwindownload + mkdir -p /tmp/winsdk + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/WS2_32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/KERNEL32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/BCRYPT.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/ADVAPI32.lib /tmp/winsdk/ + cp /tmp/xwindownload/sdk/lib/10.0.20348/um/x86_64/USERENV.lib /tmp/winsdk/ + echo "WinSDK files:" + ls -laH /tmp/winsdk + echo "" + mkdir -p package + mkdir -p package/winsdk + cp -r /tmp/winsdk/* package/winsdk + - name: Install LLVM (macOS Apple Silicon) + if: matrix.metadata.os == 'macos-12' && !matrix.metadata.llvm_url + run: | + brew install llvm + - name: Install LLVM + shell: bash + if: matrix.metadata.llvm_url + run: | + curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.metadata.llvm_url }} -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "ENABLE_LLVM=1" >> $GITHUB_ENV + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH + echo "LLVM_SYS_180_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: Add `brew` libs to `RUSTFLAGS` + if: matrix.metadata.os == 'macos-14' + shell: bash + run: | + echo "RUSTFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV + - name: Setup Rust target + shell: bash + run: | + mkdir -p .cargo + cat << EOF > .cargo/config.toml + [build] + target = "${{ matrix.metadata.target }}" + EOF + if: matrix.metadata.target + - name: which cargo + if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} + run: which cargo + - name: Set cargo env + run: echo "CARGO_ROOT_DIR=$(dirname $(dirname $( which cargo )))" >> $GITHUB_ENV + - name: List root dir + shell: bash + if: ${{ matrix.build-what.key == 'capi' && matrix.metadata.build == 'windows-x64' }} + run: ls -R $CARGO_ROOT_DIR + - name: Cache + uses: whywaita/actions-cache-s3@v2 + with: + path: | + ~/.cargo/* + ./target/* + $CARGO_ROOT_DIR/* + key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-build-wasmer-${{ matrix.build-what.key }}-${{ matrix.metadata.build }} + aws-s3-bucket: wasmer-rust-artifacts-cache + aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} + aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} + aws-region: auto + aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com + aws-s3-bucket-endpoint: false + aws-s3-force-path-style: true + - name: Build C-API + shell: bash + run: ${{ matrix.build-what.build-cmd }} + if: ${{ matrix.build-what.key == 'capi' }} + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + CARGO_TARGET: ${{ matrix.metadata.target }} + - name: Build Wasmer + shell: bash + if: ${{ matrix.build-what.key == 'wasmer' && matrix.metadata.build != 'windows-gnu' }} + run: ${{ matrix.build-what.build-cmd }} + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + CARGO_TARGET: ${{ matrix.metadata.target }} + - name: Test C-API + shell: bash + if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} + run: make test-capi-ci + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + CARGO_TARGET: ${{ matrix.metadata.target }} + # C-API tests were disabled for linux-musl and macos-arm (we can't run them) + - name: Test C-API integration + shell: bash + if: ${{ matrix.build-what.key == 'capi' && !(matrix.metadata.build == 'linux-musl' || matrix.metadata.build == 'windows-gnu') }} + run: export WASMER_DIR=`pwd`/package && make test-stage-7-capi-integration-tests + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + CARGO_TARGET: ${{ matrix.metadata.target }} + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: wasmer-cli-${{ matrix.metadata.build }} + path: build-wasmer.tar.gz + if-no-files-found: ignore + retention-days: 2 + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: capi-${{ matrix.metadata.build }} + path: build-capi.tar.gz + if-no-files-found: ignore + retention-days: 2 test: name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} @@ -743,21 +743,20 @@ jobs: } ] metadata: [ - #{ - # build: linux-x64, - # os: ubuntu-22.04, - # target: x86_64-unknown-linux-gnu, - # exe: '', - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' - #}, - #{ - # build: macos-x64, - # os: macos-12, - # target: x86_64-apple-darwin, - # exe: '', - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' - - #}, + { + build: linux-x64, + os: ubuntu-22.04, + target: x86_64-unknown-linux-gnu, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' + }, + { + build: macos-x64, + os: macos-12, + target: x86_64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-amd64.tar.xz' + }, { build: macos-arm, os: macos-14, @@ -765,21 +764,21 @@ jobs: exe: '', llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-darwin-aarch64.tar.xz' }, - #{ - # build: windows-x64, - # os: windows-2022, - # target: x86_64-pc-windows-msvc, - # exe: '.exe', - # # For now, disable LLVM in `windows-x64.` - # # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' - #}, - #{ - # build: linux-musl, - # target: x86_64-unknown-linux-musl, - # os: ubuntu-22.04, - # exe: '', - # container: 'alpine:latest' - #} + { + build: windows-x64, + os: windows-2022, + target: x86_64-pc-windows-msvc, + exe: '.exe', + # For now, disable LLVM in `windows-x64.` + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' + }, + { + build: linux-musl, + target: x86_64-unknown-linux-musl, + os: ubuntu-22.04, + exe: '', + container: 'alpine:latest' + } ] container: ${{ matrix.metadata.container }} env: @@ -875,264 +874,264 @@ jobs: CARGO_TARGET: ${{ matrix.metadata.target }} -# test_integration_cli: -# name: CLI integration tests on ${{ matrix.build }} -# runs-on: ${{ matrix.os }} -# needs: [build, build_linux_aarch64, build_linux_riscv64] -# strategy: -# fail-fast: false -# matrix: -# include: -# - build: linux-x64 -# os: ubuntu-22.04 -# target: x86_64-unknown-linux-gnu -# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' -# - build: macos-x64 -# os: macos-12 -# target: x86_64-apple-darwin -# # we only build the integration-test CLI, we don't run tests -# - build: macos-arm -# os: macos-12 -# target: aarch64-apple-darwin, -# - build: linux-musl -# target: x86_64-unknown-linux-musl -# os: ubuntu-22.04 -# container: alpine:latest -# - build: windows-x64 -# os: windows-2019 -# target: x86_64-pc-windows-msvc -# # For now, disable LLVM in `windows-x64.` -# # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' -# -# container: ${{ matrix.container }} -# env: -# SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob -# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} -# steps: -# - uses: actions/checkout@v3 -# - uses: goto-bus-stop/setup-zig@v2 -# with: -# version: 0.10.0 -# - name: Set up base deps on musl -# if: matrix.build == 'linux-musl' -# run: | -# ./scripts/alpine-linux-install-deps.sh -# echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV -# - uses: actions/download-artifact@v4 -# id: download -# with: -# name: capi-${{ matrix.build }} -# - uses: actions/download-artifact@v4 -# with: -# name: wasmer-cli-${{ matrix.build }} -# - name: 'Echo download path' -# run: echo ${{steps.download.outputs.download-path}} -# - name: Install Rust -# uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.MSRV }} -# target: ${{ matrix.metadata.target }} -# - name: Install Nextest -# uses: taiki-e/install-action@nextest -# - name: Cache -# uses: whywaita/actions-cache-s3@v2 -# with: -# path: | -# ~/.cargo/* -# ./target/* -# key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-integration-cli-${{ matrix.build }} -# aws-s3-bucket: wasmer-rust-artifacts-cache -# aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} -# aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} -# aws-region: auto -# aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com -# aws-s3-bucket-endpoint: false -# aws-s3-force-path-style: true -# - name: Prepare package directory -# shell: bash -# run: | -# mkdir -p package -# mkdir -p package/cache -# - uses: actions/download-artifact@v4 -# with: -# name: capi-linux-aarch64 -# path: package/cache/wasmercache1 -# - uses: actions/download-artifact@v4 -# with: -# name: capi-windows-x64 -# path: package/cache/wasmercache2 -# - uses: actions/download-artifact@v4 -# with: -# name: capi-macos-arm -# path: package/cache/wasmercache3 -# - uses: actions/download-artifact@v4 -# with: -# name: capi-macos-x64 -# path: package/cache/wasmercache4 -# - uses: actions/download-artifact@v4 -# with: -# name: capi-linux-x64 -# path: package/cache/wasmercache5 -# - uses: actions/download-artifact@v4 -# with: -# name: capi-linux-riscv64 -# path: package/cache/wasmercache6 -# - name: Copy .tar.gz files to proper location -# shell: bash -# run: | -# ls package/cache/wasmercache1 -# ls package/cache/wasmercache2 -# ls package/cache/wasmercache3 -# ls package/cache/wasmercache4 -# ls package/cache/wasmercache5 -# cp package/cache/wasmercache1/wasmer.tar.gz package/cache/wasmer-linux-aarch64.tar.gz -# cp package/cache/wasmercache2/build-capi.tar.gz package/cache/wasmer-windows-gnu64.tar.gz -# cp package/cache/wasmercache3/build-capi.tar.gz package/cache/wasmer-darwin-arm64.tar.gz -# cp package/cache/wasmercache4/build-capi.tar.gz package/cache/wasmer-darwin-amd64.tar.gz -# cp package/cache/wasmercache5/build-capi.tar.gz package/cache/wasmer-linux-amd64.tar.gz -# cp package/cache/wasmercache6/wasmer.tar.gz package/cache/wasmer-linux-riscv64.tar.gz -# - uses: actions/download-artifact@v4 -# if: ${{ matrix.build == 'windows-x64' }} -# with: -# name: capi-windows-x64 -# path: download_link -# - uses: actions/download-artifact@v4 -# if: ${{ matrix.build == 'linux-musl' }} -# with: -# name: capi-linux-musl -# path: download_link -# - uses: actions/download-artifact@v4 -# if: ${{ matrix.build == 'macos-arm' }} -# with: -# name: capi-macos-arm -# path: download_link -# - uses: actions/download-artifact@v4 -# if: ${{ matrix.build == 'macos-x64' }} -# with: -# name: capi-macos-x64 -# path: download_link -# - uses: actions/download-artifact@v4 -# if: ${{ matrix.build == 'linux-x64' }} -# with: -# name: capi-linux-x64 -# path: download_link -# - name: Copy build-capi.tar.gz to link.tar.gz -# shell: bash -# run: | -# cp download_link/build-capi.tar.gz link.tar.gz -# - name: Unzip Artifacts -# shell: bash -# run: | -# make untar-capi -# - name: Unzip Artifacts -# shell: bash -# run: | -# make untar-wasmer -# -# # Removed in favour of freestanding integration tests -# # -# # - name: Test integration CLI -# # if: false # matrix.build != 'macos-arm' -# # shell: bash -# # run: | -# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} -# # export WASMER_DIR=`pwd`/package && make test-integration-cli-ci -# # env: -# # TARGET: ${{ matrix.target }} -# # TARGET_DIR: target/${{ matrix.target }}/release -# # CARGO_TARGET: ${{ matrix.target }} -# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} -# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# -# -# # ---- -# # Note (xdoardo on 2024/10/07): -# # --- -# # As of now the WAMR, WASMI (and V8) backends are not that mature enough. We will re-enable these tests -# # when they've been used and matured. -# # ---- -# # -# # - name: Test CLI integration (WAMR) -# # shell: bash -# # run: | -# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} -# # export WASMER_DIR=`pwd`/package && make test-integration-cli-wamr-ci -# # env: -# # TARGET: ${{ matrix.target }} -# # TARGET_DIR: target/${{ matrix.target }}/release -# # CARGO_TARGET: ${{ matrix.target }} -# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} -# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# -# # - name: Test CLI integration (WASMI) -# # shell: bash -# # run: | -# # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} -# # export WASMER_DIR=`pwd`/package && make test-integration-cli-wasmi-ci -# # env: -# # TARGET: ${{ matrix.target }} -# # TARGET_DIR: target/${{ matrix.target }}/release -# # CARGO_TARGET: ${{ matrix.target }} -# # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} -# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# -# -# # there is another set of integration tests in 'wasmer-integration-tests' repo. Run those -# test-wasmer-integration-tests: -# needs: [build] -# runs-on: ubuntu-22.04 -# steps: -# - name: Checkout wasmer-integration-tests repository -# uses: actions/checkout@v3 -# with: -# repository: wasmerio/wasmer-integration-tests -# submodules: true -# token: ${{ secrets.CLONE_WASMER_INTEGRATION_TESTS }} -# - uses: actions/download-artifact@v4 -# with: -# name: wasmer-cli-linux-x64 -# - name: Cargo Registry Cache -# uses: actions/cache@v3 -# with: -# path: | -# ~/.cargo/advisory-db -# ~/.cargo/git -# ~/.cargo/registry -# key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} -# - name: Cargo target cache -# uses: actions/cache@v3 -# with: -# path: | -# target/ -# key: cargo-release-${{ hashFiles('**/Cargo.lock') }} -# - run: | -# # install rust toolchain -# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -# . "$HOME/.cargo/env" -# -# # add wasmer cli to PATH -# tar -xzf build-wasmer.tar.gz -# -# docker build -t tmp . -# docker run -v $PWD:/app -w /app tmp bash -c " \ -# cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\ -# export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ -# export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ -# export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ -# export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ -# export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ -# export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ -# export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ -# export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ -# export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ -# export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ -# export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ -# wasmer config set registry.url https://registry.wasmer.io/graphql &&\ -# wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\ -# wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ -# wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\ -# cargo test --no-fail-fast" -# - name: notify failure in slack -# if: failure() -# run: | -# curl -X POST -H 'Content-type: application/json' --data '{"text":"Integration tests failed ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.INTEGRATION_TEST_SLACK_WEBHOOK }} + test_integration_cli: + name: CLI integration tests on ${{ matrix.build }} + runs-on: ${{ matrix.os }} + needs: [build, build_linux_aarch64, build_linux_riscv64] + strategy: + fail-fast: false + matrix: + include: + - build: linux-x64 + os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-linux-amd64.tar.xz' + - build: macos-x64 + os: macos-12 + target: x86_64-apple-darwin + # we only build the integration-test CLI, we don't run tests + - build: macos-arm + os: macos-12 + target: aarch64-apple-darwin, + - build: linux-musl + target: x86_64-unknown-linux-musl + os: ubuntu-22.04 + container: alpine:latest + - build: windows-x64 + os: windows-2019 + target: x86_64-pc-windows-msvc + # For now, disable LLVM in `windows-x64.` + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/18.x/llvm-windows-amd64.tar.xz' + + container: ${{ matrix.container }} + env: + SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob + SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} + steps: + - uses: actions/checkout@v3 + - uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.10.0 + - name: Set up base deps on musl + if: matrix.build == 'linux-musl' + run: | + ./scripts/alpine-linux-install-deps.sh + echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV + - uses: actions/download-artifact@v4 + id: download + with: + name: capi-${{ matrix.build }} + - uses: actions/download-artifact@v4 + with: + name: wasmer-cli-${{ matrix.build }} + - name: 'Echo download path' + run: echo ${{steps.download.outputs.download-path}} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.MSRV }} + target: ${{ matrix.metadata.target }} + - name: Install Nextest + uses: taiki-e/install-action@nextest + - name: Cache + uses: whywaita/actions-cache-s3@v2 + with: + path: | + ~/.cargo/* + ./target/* + key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-integration-cli-${{ matrix.build }} + aws-s3-bucket: wasmer-rust-artifacts-cache + aws-access-key-id: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_TOKEN }} + aws-secret-access-key: ${{ secrets.CLOUDFLARE_ARTIFACTS_CACHE_ACCESS_KEY }} + aws-region: auto + aws-endpoint: https://1541b1e8a3fc6ad155ce67ef38899700.r2.cloudflarestorage.com + aws-s3-bucket-endpoint: false + aws-s3-force-path-style: true + - name: Prepare package directory + shell: bash + run: | + mkdir -p package + mkdir -p package/cache + - uses: actions/download-artifact@v4 + with: + name: capi-linux-aarch64 + path: package/cache/wasmercache1 + - uses: actions/download-artifact@v4 + with: + name: capi-windows-x64 + path: package/cache/wasmercache2 + - uses: actions/download-artifact@v4 + with: + name: capi-macos-arm + path: package/cache/wasmercache3 + - uses: actions/download-artifact@v4 + with: + name: capi-macos-x64 + path: package/cache/wasmercache4 + - uses: actions/download-artifact@v4 + with: + name: capi-linux-x64 + path: package/cache/wasmercache5 + - uses: actions/download-artifact@v4 + with: + name: capi-linux-riscv64 + path: package/cache/wasmercache6 + - name: Copy .tar.gz files to proper location + shell: bash + run: | + ls package/cache/wasmercache1 + ls package/cache/wasmercache2 + ls package/cache/wasmercache3 + ls package/cache/wasmercache4 + ls package/cache/wasmercache5 + cp package/cache/wasmercache1/wasmer.tar.gz package/cache/wasmer-linux-aarch64.tar.gz + cp package/cache/wasmercache2/build-capi.tar.gz package/cache/wasmer-windows-gnu64.tar.gz + cp package/cache/wasmercache3/build-capi.tar.gz package/cache/wasmer-darwin-arm64.tar.gz + cp package/cache/wasmercache4/build-capi.tar.gz package/cache/wasmer-darwin-amd64.tar.gz + cp package/cache/wasmercache5/build-capi.tar.gz package/cache/wasmer-linux-amd64.tar.gz + cp package/cache/wasmercache6/wasmer.tar.gz package/cache/wasmer-linux-riscv64.tar.gz + - uses: actions/download-artifact@v4 + if: ${{ matrix.build == 'windows-x64' }} + with: + name: capi-windows-x64 + path: download_link + - uses: actions/download-artifact@v4 + if: ${{ matrix.build == 'linux-musl' }} + with: + name: capi-linux-musl + path: download_link + - uses: actions/download-artifact@v4 + if: ${{ matrix.build == 'macos-arm' }} + with: + name: capi-macos-arm + path: download_link + - uses: actions/download-artifact@v4 + if: ${{ matrix.build == 'macos-x64' }} + with: + name: capi-macos-x64 + path: download_link + - uses: actions/download-artifact@v4 + if: ${{ matrix.build == 'linux-x64' }} + with: + name: capi-linux-x64 + path: download_link + - name: Copy build-capi.tar.gz to link.tar.gz + shell: bash + run: | + cp download_link/build-capi.tar.gz link.tar.gz + - name: Unzip Artifacts + shell: bash + run: | + make untar-capi + - name: Unzip Artifacts + shell: bash + run: | + make untar-wasmer + + # Removed in favour of freestanding integration tests + # + # - name: Test integration CLI + # if: false # matrix.build != 'macos-arm' + # shell: bash + # run: | + # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} + # export WASMER_DIR=`pwd`/package && make test-integration-cli-ci + # env: + # TARGET: ${{ matrix.target }} + # TARGET_DIR: target/${{ matrix.target }}/release + # CARGO_TARGET: ${{ matrix.target }} + # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + # ---- + # Note (xdoardo on 2024/10/07): + # --- + # As of now the WAMR, WASMI (and V8) backends are not that mature enough. We will re-enable these tests + # when they've been used and matured. + # ---- + # + # - name: Test CLI integration (WAMR) + # shell: bash + # run: | + # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} + # export WASMER_DIR=`pwd`/package && make test-integration-cli-wamr-ci + # env: + # TARGET: ${{ matrix.target }} + # TARGET_DIR: target/${{ matrix.target }}/release + # CARGO_TARGET: ${{ matrix.target }} + # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Test CLI integration (WASMI) + # shell: bash + # run: | + # export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }} + # export WASMER_DIR=`pwd`/package && make test-integration-cli-wasmi-ci + # env: + # TARGET: ${{ matrix.target }} + # TARGET_DIR: target/${{ matrix.target }}/release + # CARGO_TARGET: ${{ matrix.target }} + # WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + # there is another set of integration tests in 'wasmer-integration-tests' repo. Run those + test-wasmer-integration-tests: + needs: [build] + runs-on: ubuntu-22.04 + steps: + - name: Checkout wasmer-integration-tests repository + uses: actions/checkout@v3 + with: + repository: wasmerio/wasmer-integration-tests + submodules: true + token: ${{ secrets.CLONE_WASMER_INTEGRATION_TESTS }} + - uses: actions/download-artifact@v4 + with: + name: wasmer-cli-linux-x64 + - name: Cargo Registry Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/advisory-db + ~/.cargo/git + ~/.cargo/registry + key: cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cargo target cache + uses: actions/cache@v3 + with: + path: | + target/ + key: cargo-release-${{ hashFiles('**/Cargo.lock') }} + - run: | + # install rust toolchain + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + . "$HOME/.cargo/env" + + # add wasmer cli to PATH + tar -xzf build-wasmer.tar.gz + + docker build -t tmp . + docker run -v $PWD:/app -w /app tmp bash -c " \ + cp ./bin/wasmer /root/.wasmer/bin/wasmer &&\ + export MYSQL_HOST='${{ vars.INTEGRATION_TEST_MYSQL_HOST }}' &&\ + export MYSQL_DBNAME='${{ vars.INTEGRATION_TEST_MYSQL_DBNAME }}' &&\ + export MYSQL_USERNAME='${{ secrets.INTEGRATION_TEST_MYSQL_USERNAME }}' &&\ + export MYSQL_PASSWORD='${{ secrets.INTEGRATION_TEST_MYSQL_PASSWORD }}' &&\ + export MYSQL_PORT='${{ vars.INTEGRATION_TEST_MYSQL_PORT }}' &&\ + export MYSQL_CERT='${{ secrets.INTEGRATION_TEST_MYSQL_CERT }}' &&\ + export PG_HOST='${{ vars.INTEGRATION_TEST_PG_HOST }}' &&\ + export PG_DBNAME='${{ vars.INTEGRATION_TEST_PG_DBNAME }}' &&\ + export PG_USERNAME='${{ secrets.INTEGRATION_TEST_PG_USERNAME }}' &&\ + export PG_PASSWORD='${{ secrets.INTEGRATION_TEST_PG_PASSWORD }}' &&\ + export PG_PORT='${{ vars.INTEGRATION_TEST_PG_PORT }}' &&\ + wasmer config set registry.url https://registry.wasmer.io/graphql &&\ + wasmer login '${{ secrets.WAPM_PROD_TOKEN }}' &&\ + wasmer config set registry.url https://registry.wasmer.wtf/graphql &&\ + wasmer login '${{ secrets.WAPM_DEV_TOKEN }}' &&\ + cargo test --no-fail-fast" + - name: notify failure in slack + if: failure() + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"Integration tests failed ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.INTEGRATION_TEST_SLACK_WEBHOOK }} diff --git a/Cargo.lock b/Cargo.lock index af23f37d64a..ef856131f56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1688,7 +1688,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ "log", - "regex", ] [[package]] @@ -1697,10 +1696,7 @@ version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ - "anstream", - "anstyle", "env_filter", - "humantime", "log", ] diff --git a/lib/wasix/Cargo.toml b/lib/wasix/Cargo.toml index 99b77f54ac1..aec2e632e5f 100644 --- a/lib/wasix/Cargo.toml +++ b/lib/wasix/Cargo.toml @@ -164,7 +164,7 @@ tokio = { workspace = true, features = [ pretty_assertions.workspace = true tracing-test = "0.2.4" wasm-bindgen-test = "0.3.0" -env_logger = "0.11.5" +env_logger = { version = "0.11.5", default-features = false} log = "0.4.22" [target.'cfg(target_arch = "wasm32")'.dev-dependencies]