From f25b549494e1df2b4362b2a30392764ac929dde1 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 04:41:48 +0330 Subject: [PATCH 01/25] mount current dir to /home and set CWD to /home for WASI process --- lib/cli/src/commands/run/wasi.rs | 14 +++++++++++++- lib/wasix/src/runners/wasi.rs | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index f452f46777d..2c5cdc4156c 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -180,7 +180,7 @@ pub struct RunProperties { #[allow(dead_code)] impl Wasi { - const MAPPED_CURRENT_DIR_DEFAULT_PATH: &'static str = "/mnt/host"; + const MAPPED_CURRENT_DIR_DEFAULT_PATH: &'static str = "/home"; pub fn map_dir(&mut self, alias: &str, target_on_disk: PathBuf) { self.mapped_dirs.push(MappedDirectory { @@ -483,6 +483,18 @@ impl Wasi { mapped_dirs.push(mapping); } + if !have_current_dir { + let current_dir = + std::env::current_dir().context("could not determine current directory")?; + + let mapping = MappedDirectory { + host: current_dir, + guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + }; + + mapped_dirs.push(mapping); + } + Ok(mapped_dirs) } diff --git a/lib/wasix/src/runners/wasi.rs b/lib/wasix/src/runners/wasi.rs index 42c65826886..bd03a75c4e9 100644 --- a/lib/wasix/src/runners/wasi.rs +++ b/lib/wasix/src/runners/wasi.rs @@ -328,6 +328,8 @@ impl crate::runners::Runner for WasiRunner { .prepare_webc_env(command_name, &wasi, Some(pkg), Arc::clone(&runtime), None) .context("Unable to prepare the WASI environment")?; + env.set_current_dir("/home"); + #[cfg(feature = "journal")] { for journal in self.wasi.journals.clone() { From f6e6de0333c0dd8580099041f12989534694af08 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 14:10:12 +0330 Subject: [PATCH 02/25] conditionally set cwd to /home --- lib/cli/src/commands/run/mod.rs | 5 ++++- lib/cli/src/commands/run/wasi.rs | 6 ++++-- lib/wasix/src/runners/wasi.rs | 10 +++++++++- lib/wasix/src/runners/wasi_common.rs | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/cli/src/commands/run/mod.rs b/lib/cli/src/commands/run/mod.rs index eac19537da7..dc4bf97b8bb 100644 --- a/lib/cli/src/commands/run/mod.rs +++ b/lib/cli/src/commands/run/mod.rs @@ -395,12 +395,15 @@ impl Run { let mut runner = WasiRunner::new(); + let (is_home_mapped, mapped_diretories) = self.wasi.build_mapped_directories()?; + runner .with_args(&self.args) .with_injected_packages(packages) .with_envs(self.wasi.env_vars.clone()) .with_mapped_host_commands(self.wasi.build_mapped_commands()?) - .with_mapped_directories(self.wasi.build_mapped_directories()?) + .with_mapped_directories(mapped_diretories) + .with_home_mapped(is_home_mapped) .with_forward_host_env(self.wasi.forward_host_env) .with_capabilities(self.wasi.capabilities()); diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index 2c5cdc4156c..9d87b144b81 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -402,7 +402,7 @@ impl Wasi { Ok(Vec::new()) } - pub fn build_mapped_directories(&self) -> Result, anyhow::Error> { + pub fn build_mapped_directories(&self) -> Result<(bool, Vec), anyhow::Error> { let mut mapped_dirs = Vec::new(); // Process the --dirs flag and merge it with --mapdir. @@ -493,9 +493,11 @@ impl Wasi { }; mapped_dirs.push(mapping); + + have_current_dir = true; } - Ok(mapped_dirs) + Ok((have_current_dir, mapped_dirs)) } pub fn build_mapped_commands(&self) -> Result, anyhow::Error> { diff --git a/lib/wasix/src/runners/wasi.rs b/lib/wasix/src/runners/wasi.rs index bd03a75c4e9..4d7f8d05582 100644 --- a/lib/wasix/src/runners/wasi.rs +++ b/lib/wasix/src/runners/wasi.rs @@ -80,6 +80,11 @@ impl WasiRunner { self.with_mounted_directories(dirs.into_iter().map(Into::into).map(MountedDirectory::from)) } + pub fn with_home_mapped(&mut self, is_home_mapped: bool) -> &mut Self { + self.wasi.is_home_mapped = is_home_mapped; + self + } + pub fn with_mounted_directories(&mut self, dirs: I) -> &mut Self where I: IntoIterator, @@ -328,7 +333,10 @@ impl crate::runners::Runner for WasiRunner { .prepare_webc_env(command_name, &wasi, Some(pkg), Arc::clone(&runtime), None) .context("Unable to prepare the WASI environment")?; - env.set_current_dir("/home"); + // check whether + if self.wasi.is_home_mapped { + env.set_current_dir("/home"); + } #[cfg(feature = "journal")] { diff --git a/lib/wasix/src/runners/wasi_common.rs b/lib/wasix/src/runners/wasi_common.rs index 1a48482c1fc..214fe1a3d68 100644 --- a/lib/wasix/src/runners/wasi_common.rs +++ b/lib/wasix/src/runners/wasi_common.rs @@ -34,6 +34,7 @@ pub(crate) struct CommonWasiOptions { pub(crate) forward_host_env: bool, pub(crate) mapped_host_commands: Vec, pub(crate) mounts: Vec, + pub(crate) is_home_mapped: bool, pub(crate) injected_packages: Vec, pub(crate) capabilities: Capabilities, #[derivative(Debug = "ignore")] From 41121ced2b50adae25df489172cbb2aa29eeb08b Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 14:22:57 +0330 Subject: [PATCH 03/25] fix wasi-fyi expected output --- lib/wasix/src/runners/wasi.rs | 2 +- tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wasix/src/runners/wasi.rs b/lib/wasix/src/runners/wasi.rs index 4d7f8d05582..026cebc6ff4 100644 --- a/lib/wasix/src/runners/wasi.rs +++ b/lib/wasix/src/runners/wasi.rs @@ -333,7 +333,7 @@ impl crate::runners::Runner for WasiRunner { .prepare_webc_env(command_name, &wasi, Some(pkg), Arc::clone(&runtime), None) .context("Unable to prepare the WASI environment")?; - // check whether + // check whether home directory is mapped if self.wasi.is_home_mapped { env.set_current_dir("/home"); } diff --git a/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout b/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout index ffc48122ddd..09106dc493b 100644 --- a/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout +++ b/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout @@ -5,6 +5,7 @@ "/etc" "/fyi" "/hamlet" +"/home" "/tmp" "/hamlet/act1/../README.md" "/hamlet/act1/../act1" From f9d6ce19aefe1dd0bebe78aaa444260e8d64d5ed Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 14:51:10 +0330 Subject: [PATCH 04/25] factor out MAPPED_CURRENT_DIR_DEFAULT_PATH --- lib/cli/src/commands/run/wasi.rs | 15 +++++++-------- lib/wasix/src/runners/mod.rs | 4 +++- lib/wasix/src/runners/wasi.rs | 4 ++-- lib/wasix/src/runners/wasi_common.rs | 2 ++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index 9d87b144b81..5d72bddd130 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -26,6 +26,7 @@ use wasmer_wasix::{ journal::{CompactingLogFileJournal, DynJournal}, os::{tty_sys::SysTty, TtyBridge}, rewind_ext, + runners::MAPPED_CURRENT_DIR_DEFAULT_PATH, runners::{MappedCommand, MappedDirectory}, runtime::{ module_cache::{FileSystemCache, ModuleCache}, @@ -180,8 +181,6 @@ pub struct RunProperties { #[allow(dead_code)] impl Wasi { - const MAPPED_CURRENT_DIR_DEFAULT_PATH: &'static str = "/home"; - pub fn map_dir(&mut self, alias: &str, target_on_disk: PathBuf) { self.mapped_dirs.push(MappedDirectory { guest: alias.to_string(), @@ -269,7 +268,7 @@ impl Wasi { MappedDirectory { host: current_dir, - guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), } } else { let resolved = dir.canonicalize().with_context(|| { @@ -322,7 +321,7 @@ impl Wasi { MappedDirectory { host: resolved_host, - guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), } } else { MappedDirectory { @@ -353,7 +352,7 @@ impl Wasi { .unwrap(); if have_current_dir { - b.map_dir(".", Self::MAPPED_CURRENT_DIR_DEFAULT_PATH)? + b.map_dir(".", MAPPED_CURRENT_DIR_DEFAULT_PATH)? } else { b.map_dir(".", "/")? } @@ -419,7 +418,7 @@ impl Wasi { MappedDirectory { host: current_dir, - guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), } } else { let resolved = dir.canonicalize().with_context(|| { @@ -472,7 +471,7 @@ impl Wasi { MappedDirectory { host: resolved_host, - guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), } } else { MappedDirectory { @@ -489,7 +488,7 @@ impl Wasi { let mapping = MappedDirectory { host: current_dir, - guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), + guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), }; mapped_dirs.push(mapping); diff --git a/lib/wasix/src/runners/mod.rs b/lib/wasix/src/runners/mod.rs index a2bf9eb4128..949ac65b397 100644 --- a/lib/wasix/src/runners/mod.rs +++ b/lib/wasix/src/runners/mod.rs @@ -13,5 +13,7 @@ pub mod wcgi; pub use self::{ runner::Runner, - wasi_common::{MappedCommand, MappedDirectory, MountedDirectory}, + wasi_common::{ + MappedCommand, MappedDirectory, MountedDirectory, MAPPED_CURRENT_DIR_DEFAULT_PATH, + }, }; diff --git a/lib/wasix/src/runners/wasi.rs b/lib/wasix/src/runners/wasi.rs index 026cebc6ff4..e2986135079 100644 --- a/lib/wasix/src/runners/wasi.rs +++ b/lib/wasix/src/runners/wasi.rs @@ -18,7 +18,7 @@ use crate::{ }; use wasmer_types::ModuleHash; -use super::wasi_common::MappedCommand; +use super::wasi_common::{MappedCommand, MAPPED_CURRENT_DIR_DEFAULT_PATH}; #[derive(Debug, Default, Clone)] pub struct WasiRunner { @@ -335,7 +335,7 @@ impl crate::runners::Runner for WasiRunner { // check whether home directory is mapped if self.wasi.is_home_mapped { - env.set_current_dir("/home"); + env.set_current_dir(MAPPED_CURRENT_DIR_DEFAULT_PATH); } #[cfg(feature = "journal")] diff --git a/lib/wasix/src/runners/wasi_common.rs b/lib/wasix/src/runners/wasi_common.rs index 214fe1a3d68..fe442011198 100644 --- a/lib/wasix/src/runners/wasi_common.rs +++ b/lib/wasix/src/runners/wasi_common.rs @@ -18,6 +18,8 @@ use crate::{ WasiEnvBuilder, }; +pub const MAPPED_CURRENT_DIR_DEFAULT_PATH: &'static str = "/home"; + #[derive(Debug, Clone)] pub struct MappedCommand { /// The new alias. From 5c241683ff0f9bc2b4e6266c84039a03da18378a Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 14:59:32 +0330 Subject: [PATCH 05/25] fix lint --- lib/wasix/src/runners/wasi_common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wasix/src/runners/wasi_common.rs b/lib/wasix/src/runners/wasi_common.rs index fe442011198..87956d2c7e8 100644 --- a/lib/wasix/src/runners/wasi_common.rs +++ b/lib/wasix/src/runners/wasi_common.rs @@ -18,7 +18,7 @@ use crate::{ WasiEnvBuilder, }; -pub const MAPPED_CURRENT_DIR_DEFAULT_PATH: &'static str = "/home"; +pub const MAPPED_CURRENT_DIR_DEFAULT_PATH: &str = "/home"; #[derive(Debug, Clone)] pub struct MappedCommand { From 265191a1bc377c6c7dbdcbdeacd96b2360da8123 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 15:42:47 +0330 Subject: [PATCH 06/25] only mount home when --dir is present --- lib/cli/src/commands/run/wasi.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/cli/src/commands/run/wasi.rs b/lib/cli/src/commands/run/wasi.rs index 5d72bddd130..9e9d135dc01 100644 --- a/lib/cli/src/commands/run/wasi.rs +++ b/lib/cli/src/commands/run/wasi.rs @@ -482,20 +482,6 @@ impl Wasi { mapped_dirs.push(mapping); } - if !have_current_dir { - let current_dir = - std::env::current_dir().context("could not determine current directory")?; - - let mapping = MappedDirectory { - host: current_dir, - guest: MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(), - }; - - mapped_dirs.push(mapping); - - have_current_dir = true; - } - Ok((have_current_dir, mapped_dirs)) } From 6aee08d6b0e1b9a9cc38e6bef0e93c0aa3f52fe1 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Wed, 22 May 2024 15:57:38 +0330 Subject: [PATCH 07/25] adjust wasi-fyi expected output --- tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout b/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout index 09106dc493b..ffc48122ddd 100644 --- a/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout +++ b/tests/wasi-fyi/ported_wasi_sees_virtual_root.stdout @@ -5,7 +5,6 @@ "/etc" "/fyi" "/hamlet" -"/home" "/tmp" "/hamlet/act1/../README.md" "/hamlet/act1/../act1" From 5b5b9bb4e7dd1540746fa4e1d5076492b0687b62 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 30 May 2024 15:04:48 +0330 Subject: [PATCH 08/25] fix issue with local wasm files --- lib/wasix/src/runners/wasi.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/wasix/src/runners/wasi.rs b/lib/wasix/src/runners/wasi.rs index e2986135079..11905849df5 100644 --- a/lib/wasix/src/runners/wasi.rs +++ b/lib/wasix/src/runners/wasi.rs @@ -255,6 +255,10 @@ impl WasiRunner { builder.set_stderr(Box::new(stderr.clone())); } + if self.wasi.is_home_mapped { + builder.set_current_dir(MAPPED_CURRENT_DIR_DEFAULT_PATH); + } + Ok(builder) } @@ -333,11 +337,6 @@ impl crate::runners::Runner for WasiRunner { .prepare_webc_env(command_name, &wasi, Some(pkg), Arc::clone(&runtime), None) .context("Unable to prepare the WASI environment")?; - // check whether home directory is mapped - if self.wasi.is_home_mapped { - env.set_current_dir(MAPPED_CURRENT_DIR_DEFAULT_PATH); - } - #[cfg(feature = "journal")] { for journal in self.wasi.journals.clone() { From 7895faba54d3ef9356744c218efe12d879432e04 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 30 May 2024 23:49:05 +0330 Subject: [PATCH 09/25] add wasix tests --- .github/workflows/test.yaml | 1577 +++++++++++++++-------------- Makefile | 4 + tests/wasix/.gitignore | 2 + tests/wasix/cwd-to-home/expected | 1 + tests/wasix/cwd-to-home/hello.txt | 0 tests/wasix/cwd-to-home/main.c | 10 + tests/wasix/cwd-to-home/run.sh | 7 + tests/wasix/test.sh | 79 ++ 8 files changed, 908 insertions(+), 772 deletions(-) create mode 100644 tests/wasix/.gitignore create mode 100644 tests/wasix/cwd-to-home/expected create mode 100644 tests/wasix/cwd-to-home/hello.txt create mode 100644 tests/wasix/cwd-to-home/main.c create mode 100755 tests/wasix/cwd-to-home/run.sh create mode 100755 tests/wasix/test.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8cc2f06f2e4..3b6de38a0d9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -27,83 +27,126 @@ env: MSRV: "1.74" NEXTEST_PROFILE: "ci" RUSTUP_WINDOWS_PATH_ADD_BIN: 1 + WASI_SDK_VERSION: "22" jobs: - setup: - name: Set up - runs-on: ubuntu-22.04 - outputs: - VERSION: ${{ steps.setup.outputs.VERSION }} - DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} - steps: - - name: Set up env vars - id: setup - shell: bash - run: | - VERSION=${GITHUB_REF/refs\/tags\//} - echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT - DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) - echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT - echo $VERSION - echo $DOING_RELEASE + # setup: + # name: Set up + # runs-on: ubuntu-22.04 + # outputs: + # VERSION: ${{ steps.setup.outputs.VERSION }} + # DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} + # steps: + # - name: Set up env vars + # id: setup + # shell: bash + # run: | + # VERSION=${GITHUB_REF/refs\/tags\//} + # echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + # DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) + # echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz - mkdir -p /opt/llvm-15 - tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 - echo '/opt/llvm-15/bin' >> $GITHUB_PATH - echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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) ]] + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz + # mkdir -p /opt/llvm-15 + # tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 + # echo '/opt/llvm-15/bin' >> $GITHUB_PATH + # echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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 + # 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_nodejs: - name: Test on NodeJS + # 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: 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 @@ -111,716 +154,706 @@ jobs: 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 + - name: Install Tools run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: make test-js + sudo apt-get update + sudo apt-get install -y git llvm clang make lld curl + - name: Build wasix sysroot 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 + git clone --recurse-submodules https://github.com/wasix-org/wasix-libc + cd wasix-libc + ./build32.sh + rm -rf /opt/wasix-sysroot + cp -r sysroot32 /opt/wasix-sysroot + - name: Install wasi-sdk Tools run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: make test-wasi-fyi + 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 /opt/wasi-sdk + - name: Install wasm-opt run: | - make test-wasi-fyi + sudo apt-get install -y binaryen + - name: make test-wasix + run: | + WASI_SDK=/opt/wasi-sdk WASIX_SYSROOT=/opt/wasix-sysroot make test-wasix - # 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_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_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_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_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-2023-10-05" + # target: x86_64-unknown-linux-gnu + # - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` + # - name: make test-build-docs-rs-ci + # run: make test-build-docs-rs-ci - 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-2023-10-05" - target: x86_64-unknown-linux-gnu - - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` - - 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@v3 + # with: + # name: capi-linux-aarch64 + # path: dist + # if-no-files-found: error + # retention-days: 2 - 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@v3 - 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@v3 - with: - name: capi-linux-riscv64 - 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@v3 + # 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, - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - }, - { - build: linux-musl, - target: x86_64-unknown-linux-musl, - os: ubuntu-22.04, - container: 'alpine:latest' - }, - { - build: macos-x64, - os: macos-11, - target: x86_64-apple-darwin, - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - }, - { - build: macos-arm, - os: macos-11, - target: aarch64-apple-darwin, - }, - { - build: windows-x64, - os: windows-2019, - target: x86_64-pc-windows-msvc, - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' - }, - { - build: windows-gnu, - target: x86_64-pc-windows-gnu, - os: ubuntu-22.04, - } - ] - 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 - - 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-latest' || matrix.metadata.os == 'macos-11.0' - - 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 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-11.0' && !matrix.metadata.llvm_url - run: | - brew install llvm - - name: Install LLVM - if: matrix.metadata.llvm_url - shell: bash - 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 - 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@v3 - with: - name: capi-${{ matrix.metadata.build }} - path: build-capi.tar.gz - if-no-files-found: ignore - 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, + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # }, + # { + # build: linux-musl, + # target: x86_64-unknown-linux-musl, + # os: ubuntu-22.04, + # container: 'alpine:latest' + # }, + # { + # build: macos-x64, + # os: macos-11, + # target: x86_64-apple-darwin, + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # }, + # { + # build: macos-arm, + # os: macos-11, + # target: aarch64-apple-darwin, + # }, + # { + # build: windows-x64, + # os: windows-2019, + # target: x86_64-pc-windows-msvc, + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' + # }, + # { + # build: windows-gnu, + # target: x86_64-pc-windows-gnu, + # os: ubuntu-22.04, + # } + # ] + # 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 + # - 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-latest' || matrix.metadata.os == 'macos-11.0' + # - 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 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-11.0' && !matrix.metadata.llvm_url + # run: | + # brew install llvm + # - name: Install LLVM + # if: matrix.metadata.llvm_url + # shell: bash + # 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + # env: + # LLVM_DIR: .llvm + # - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 + # 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@v3 + # 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 }} - runs-on: ${{ matrix.metadata.os }} - needs: setup - strategy: - 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - }, - { - build: macos-x64, - os: macos-11, - target: x86_64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - }, - { - build: macos-arm64, - os: macos-14, - target: aarch64-apple-darwin, - exe: '', - }, - { - build: windows-x64, - os: windows-2019, - target: x86_64-pc-windows-msvc, - exe: '.exe', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: - 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 - 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 - - 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-latest' || matrix.metadata.os == 'macos-11.0' - - 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 LLVM (macOS Apple Silicon) - if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url - run: | - brew install llvm - - name: Install LLVM - if: matrix.metadata.llvm_url - shell: bash - 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - 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: Cache - uses: whywaita/actions-cache-s3@v2 - with: - path: | - ~/.cargo/* - ./target/* - key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} - run: make ${{ matrix.stage.make }} - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} + # test: + # name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} + # runs-on: ${{ matrix.metadata.os }} + # needs: setup + # strategy: + # 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # }, + # { + # build: macos-x64, + # os: macos-11, + # target: x86_64-apple-darwin, + # exe: '', + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # }, + # { + # build: macos-arm64, + # os: macos-14, + # target: aarch64-apple-darwin, + # exe: '', + # }, + # { + # build: windows-x64, + # os: windows-2019, + # target: x86_64-pc-windows-msvc, + # exe: '.exe', + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: + # 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 + # 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 + # - 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-latest' || matrix.metadata.os == 'macos-11.0' + # - 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 LLVM (macOS Apple Silicon) + # if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url + # run: | + # brew install llvm + # - name: Install LLVM + # if: matrix.metadata.llvm_url + # shell: bash + # 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH + # echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + # env: + # LLVM_DIR: .llvm + # - 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: Cache + # uses: whywaita/actions-cache-s3@v2 + # with: + # path: | + # ~/.cargo/* + # ./target/* + # key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} + # run: make ${{ matrix.stage.make }} + # env: + # TARGET: ${{ matrix.metadata.target }} + # TARGET_DIR: target/${{ matrix.metadata.target }}/release + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - - build: macos-x64 - os: macos-11 - target: x86_64-apple-darwin - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # we only build the integration-test CLI, we don't run tests - - build: macos-arm - os: macos-11 - 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 - 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 - - uses: actions/download-artifact@v3 - id: download - with: - name: capi-${{ matrix.build }} - - uses: actions/download-artifact@v3 - 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@v3 - with: - name: capi-linux-aarch64 - path: package/cache/wasmercache1 - - uses: actions/download-artifact@v3 - with: - name: capi-windows-gnu - path: package/cache/wasmercache2 - - uses: actions/download-artifact@v3 - with: - name: capi-macos-arm - path: package/cache/wasmercache3 - - uses: actions/download-artifact@v3 - with: - name: capi-macos-x64 - path: package/cache/wasmercache4 - - uses: actions/download-artifact@v3 - with: - name: capi-linux-x64 - path: package/cache/wasmercache5 - - uses: actions/download-artifact@v3 - 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@v3 - if: ${{ matrix.build == 'windows-x64' }} - with: - name: capi-windows-gnu - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'linux-musl' }} - with: - name: capi-linux-musl - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'macos-arm' }} - with: - name: capi-macos-arm - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'macos-x64' }} - with: - name: capi-macos-x64 - path: download_link - - uses: actions/download-artifact@v3 - 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 - - 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 }} + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # - build: macos-x64 + # os: macos-11 + # target: x86_64-apple-darwin + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # # we only build the integration-test CLI, we don't run tests + # - build: macos-arm + # os: macos-11 + # 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 + # 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 + # - uses: actions/download-artifact@v3 + # id: download + # with: + # name: capi-${{ matrix.build }} + # - uses: actions/download-artifact@v3 + # 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@v3 + # with: + # name: capi-linux-aarch64 + # path: package/cache/wasmercache1 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-windows-gnu + # path: package/cache/wasmercache2 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-macos-arm + # path: package/cache/wasmercache3 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-macos-x64 + # path: package/cache/wasmercache4 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-linux-x64 + # path: package/cache/wasmercache5 + # - uses: actions/download-artifact@v3 + # 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@v3 + # if: ${{ matrix.build == 'windows-x64' }} + # with: + # name: capi-windows-gnu + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'linux-musl' }} + # with: + # name: capi-linux-musl + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'macos-arm' }} + # with: + # name: capi-macos-arm + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'macos-x64' }} + # with: + # name: capi-macos-x64 + # path: download_link + # - uses: actions/download-artifact@v3 + # 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 + # - 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 }} diff --git a/Makefile b/Makefile index 726632d0e05..9b705e2bab1 100644 --- a/Makefile +++ b/Makefile @@ -632,6 +632,10 @@ test-wasi-fyi: build-wasmer cd tests/wasi-fyi; \ ./test.sh +test-wasix: build-wasmer + cd tests/wasix; \ + ./test.sh + test-integration-cli: build-wasmer build-capi package-capi-headless package distribution cp ./dist/wasmer.tar.gz ./link.tar.gz rustup target add wasm32-wasi diff --git a/tests/wasix/.gitignore b/tests/wasix/.gitignore new file mode 100644 index 00000000000..554767ae207 --- /dev/null +++ b/tests/wasix/.gitignore @@ -0,0 +1,2 @@ +output +*.wasm \ No newline at end of file diff --git a/tests/wasix/cwd-to-home/expected b/tests/wasix/cwd-to-home/expected new file mode 100644 index 00000000000..c227083464f --- /dev/null +++ b/tests/wasix/cwd-to-home/expected @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/tests/wasix/cwd-to-home/hello.txt b/tests/wasix/cwd-to-home/hello.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c new file mode 100644 index 00000000000..7009ef98a97 --- /dev/null +++ b/tests/wasix/cwd-to-home/main.c @@ -0,0 +1,10 @@ +#include +#include + +int main() +{ + int fd = open("hello.txt", O_RDWR); + printf("%d", (fd == -1)); + + return 0; +} \ No newline at end of file diff --git a/tests/wasix/cwd-to-home/run.sh b/tests/wasix/cwd-to-home/run.sh new file mode 100755 index 00000000000..b5286fa1ed9 --- /dev/null +++ b/tests/wasix/cwd-to-home/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +$CC $CFLAGS $LDFLAGS -o main.wasm main.c + +wasmer run -q main.wasm --dir=. > output + +diff -u output expected 1>/dev/null \ No newline at end of file diff --git a/tests/wasix/test.sh b/tests/wasix/test.sh new file mode 100755 index 00000000000..1c2159897c1 --- /dev/null +++ b/tests/wasix/test.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +if [[ -z "${WASI_SDK}" ]]; then + echo "WASI_SDK is not found" + exit 1 +fi + +if [[ -z "${WASIX_SYSROOT}" ]]; then + echo "WASIX_SYSROOT is not found" + exit 1 +fi + +export RANLIB="$WASI_SDK/bin/ranlib" +export AR="$WASI_SDK/bin/ar" +export NM="$WASI_SDK/bin/nm" +export CC="$WASI_SDK/bin/clang" +export CXX="$WASI_SDK/bin/clang" +export CFLAGS="\ +--sysroot=$WASIX_SYSROOT \ +-matomics \ +-mbulk-memory \ +-mmutable-globals \ +-pthread \ +-mthread-model posix \ +-ftls-model=local-exec \ +-fno-trapping-math \ +-D_WASI_EMULATED_MMAN \ +-D_WASI_EMULATED_SIGNAL \ +-D_WASI_EMULATED_PROCESS_CLOCKS \ +-O3 \ +-g \ +-flto" +export LD="$WASI_SDK/bin/wasm-ld" +export LDFLAGS="\ +-Wl,--shared-memory \ +-Wl,--max-memory=4294967296 \ +-Wl,--import-memory \ +-Wl,--export-dynamic \ +-Wl,--export=__heap_base \ +-Wl,--export=__stack_pointer \ +-Wl,--export=__data_end \ +-Wl,--export=__wasm_init_tls \ +-Wl,--export=__wasm_signal \ +-Wl,--export=__tls_size \ +-Wl,--export=__tls_align \ +-Wl,--export=__tls_base \ +-lwasi-emulated-mman \ +-O3 \ +-g \ +-flto" +export LIBS="\ +-Wl,--shared-memory \ +-Wl,--max-memory=4294967296 \ +-Wl,--import-memory \ +-Wl,--export-dynamic \ +-Wl,--export=__heap_base \ +-Wl,--export=__stack_pointer \ +-Wl,--export=__data_end \ +-Wl,--export=__wasm_init_tls \ +-Wl,--export=__wasm_signal \ +-Wl,--export=__tls_size \ +-Wl,--export=__tls_align \ +-Wl,--export=__tls_base \ +-lwasi-emulated-mman \ +-O3 \ +-g \ +-flto" + +printf "\n\nStarting WASIX Test Suite:\n" + +find . -mindepth 1 -maxdepth 1 -type d | while read dir; do + dir=$(basename $dir) + printf "Testing $dir..." + if bash -c "cd $dir && ./run.sh"; then + printf "\rTesting $dir ✅\n" + else + printf "\rTesting $dir ❌\n" + fi +done \ No newline at end of file From 51c97a4b266a44cf02f9651a5e85e5e23de6cf18 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 30 May 2024 23:52:43 +0330 Subject: [PATCH 10/25] temp: disable wasmer-config jobs --- .github/workflows/wasmer-config.yaml | 74 +++++++++++++++------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/.github/workflows/wasmer-config.yaml b/.github/workflows/wasmer-config.yaml index 9091574b1e3..fe1395bf2c2 100644 --- a/.github/workflows/wasmer-config.yaml +++ b/.github/workflows/wasmer-config.yaml @@ -16,39 +16,47 @@ env: DEFAULT_CRATE_NAME: wasmer_toml jobs: - check: - name: Compile and Test + placeholder: + name: placeholder runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Setup Rust - uses: dsherret/rust-toolchain-file@v1 - - name: Install Nextest - uses: taiki-e/install-action@nextest - - name: Type Checking - run: | - cd lib/config && cargo check --verbose --locked - - name: Build - run: | - cd lib/config && cargo build --verbose --locked - - name: Test - run: | - cd lib/config && cargo nextest run --verbose --locked + - name: placeholder + run: | + echo "Placeholder" - lints: - name: Linting and Formatting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Setup Rust - uses: dsherret/rust-toolchain-file@v1 - - name: Check Formatting - run: | - cd lib/config && cargo fmt --verbose --check - - name: Clippy - run: | - cd lib/config && cargo clippy --verbose + # check: + # name: Compile and Test + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Rust Cache + # uses: Swatinem/rust-cache@v2 + # - name: Setup Rust + # uses: dsherret/rust-toolchain-file@v1 + # - name: Install Nextest + # uses: taiki-e/install-action@nextest + # - name: Type Checking + # run: | + # cd lib/config && cargo check --verbose --locked + # - name: Build + # run: | + # cd lib/config && cargo build --verbose --locked + # - name: Test + # run: | + # cd lib/config && cargo nextest run --verbose --locked + + # lints: + # name: Linting and Formatting + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Rust Cache + # uses: Swatinem/rust-cache@v2 + # - name: Setup Rust + # uses: dsherret/rust-toolchain-file@v1 + # - name: Check Formatting + # run: | + # cd lib/config && cargo fmt --verbose --check + # - name: Clippy + # run: | + # cd lib/config && cargo clippy --verbose From 887ca940894862c9bc2fa0f71e8af16eeccbe5a5 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:01:44 +0330 Subject: [PATCH 11/25] switch to root before some steps --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3b6de38a0d9..6ba4c37b8fe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -160,6 +160,7 @@ jobs: 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 @@ -167,6 +168,7 @@ jobs: cp -r sysroot32 /opt/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 /opt/wasi-sdk From f2c93c9b48bef44d029f79f9b607959c3f6cf09a Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:03:32 +0330 Subject: [PATCH 12/25] switch to home before some steps --- .github/workflows/test.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6ba4c37b8fe..481443b3004 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -160,24 +160,24 @@ jobs: sudo apt-get install -y git llvm clang make lld curl - name: Build wasix sysroot run: | - cd / + 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 /opt/wasix-sysroot + cp -r sysroot32 ~/wasix-sysroot - name: Install wasi-sdk Tools run: | - cd / + 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 /opt/wasi-sdk + cp -r wasi-sdk-${{ env.WASI_SDK_VERSION }}.0 ~/wasi-sdk - name: Install wasm-opt run: | sudo apt-get install -y binaryen - name: make test-wasix run: | - WASI_SDK=/opt/wasi-sdk WASIX_SYSROOT=/opt/wasix-sysroot make test-wasix + WASI_SDK=~/wasi-sdk WASIX_SYSROOT=~/wasix-sysroot make test-wasix # test_wasm_build: # name: Test wasm build From 5db91c76ea6ddcba63f748dcde69de52a8cbb204 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:17:07 +0330 Subject: [PATCH 13/25] expose WASMER to tests --- tests/wasix/cwd-to-home/run.sh | 2 +- tests/wasix/test.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/wasix/cwd-to-home/run.sh b/tests/wasix/cwd-to-home/run.sh index b5286fa1ed9..cd3f45e8372 100755 --- a/tests/wasix/cwd-to-home/run.sh +++ b/tests/wasix/cwd-to-home/run.sh @@ -2,6 +2,6 @@ $CC $CFLAGS $LDFLAGS -o main.wasm main.c -wasmer run -q main.wasm --dir=. > output +$WASMER run -q main.wasm --dir=. > output diff -u output expected 1>/dev/null \ No newline at end of file diff --git a/tests/wasix/test.sh b/tests/wasix/test.sh index 1c2159897c1..5b2ab4908b4 100755 --- a/tests/wasix/test.sh +++ b/tests/wasix/test.sh @@ -66,6 +66,8 @@ export LIBS="\ -g \ -flto" +export WASMER=$(realpath "../../target/release/wasmer") + printf "\n\nStarting WASIX Test Suite:\n" find . -mindepth 1 -maxdepth 1 -type d | while read dir; do From af2a68271075cb18b89bbaaaad7ebd21d483968a Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:19:56 +0330 Subject: [PATCH 14/25] add return status --- tests/wasix/test.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/wasix/test.sh b/tests/wasix/test.sh index 5b2ab4908b4..8630e1b6d6e 100755 --- a/tests/wasix/test.sh +++ b/tests/wasix/test.sh @@ -70,12 +70,16 @@ export WASMER=$(realpath "../../target/release/wasmer") printf "\n\nStarting WASIX Test Suite:\n" +status=0 + find . -mindepth 1 -maxdepth 1 -type d | while read dir; do dir=$(basename $dir) printf "Testing $dir..." if bash -c "cd $dir && ./run.sh"; then printf "\rTesting $dir ✅\n" else - printf "\rTesting $dir ❌\n" + printf "\rTesting $dir ❌\n" || status=1 fi -done \ No newline at end of file +done + +exit $status \ No newline at end of file From af855747c3cdc83ad7f1509379f40c7678a17124 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:20:29 +0330 Subject: [PATCH 15/25] fail on purpose --- tests/wasix/cwd-to-home/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c index 7009ef98a97..8f762286a00 100644 --- a/tests/wasix/cwd-to-home/main.c +++ b/tests/wasix/cwd-to-home/main.c @@ -4,7 +4,7 @@ int main() { int fd = open("hello.txt", O_RDWR); - printf("%d", (fd == -1)); + printf("%d", (fd == 1)); return 0; } \ No newline at end of file From 29b942d50d43d9ae224b391982b76945b39a8806 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:32:10 +0330 Subject: [PATCH 16/25] fail on purpose --- tests/wasix/cwd-to-home/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c index 8f762286a00..ea42f3b0426 100644 --- a/tests/wasix/cwd-to-home/main.c +++ b/tests/wasix/cwd-to-home/main.c @@ -4,7 +4,7 @@ int main() { int fd = open("hello.txt", O_RDWR); - printf("%d", (fd == 1)); + printf("%d", (fd != -1)); return 0; } \ No newline at end of file From 985fddd96c442d643fc9ae829bd39ea0a8de9065 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:46:31 +0330 Subject: [PATCH 17/25] fix the wasix test --- tests/wasix/cwd-to-home/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c index ea42f3b0426..7009ef98a97 100644 --- a/tests/wasix/cwd-to-home/main.c +++ b/tests/wasix/cwd-to-home/main.c @@ -4,7 +4,7 @@ int main() { int fd = open("hello.txt", O_RDWR); - printf("%d", (fd != -1)); + printf("%d", (fd == -1)); return 0; } \ No newline at end of file From debe4935951c43ca5efb767d5321c8909c67dd2a Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 00:52:06 +0330 Subject: [PATCH 18/25] bring back jobs and make them required --- .github/workflows/test.yaml | 1577 +++++++++++++------------- .github/workflows/wasmer-config.yaml | 74 +- 2 files changed, 832 insertions(+), 819 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 481443b3004..bd1633da189 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,115 +30,114 @@ env: WASI_SDK_VERSION: "22" jobs: + setup: + name: Set up + runs-on: ubuntu-22.04 + outputs: + VERSION: ${{ steps.setup.outputs.VERSION }} + DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} + steps: + - name: Set up env vars + id: setup + shell: bash + run: | + VERSION=${GITHUB_REF/refs\/tags\//} + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) + echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT + echo $VERSION + echo $DOING_RELEASE - # setup: - # name: Set up - # runs-on: ubuntu-22.04 - # outputs: - # VERSION: ${{ steps.setup.outputs.VERSION }} - # DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} - # steps: - # - name: Set up env vars - # id: setup - # shell: bash - # run: | - # VERSION=${GITHUB_REF/refs\/tags\//} - # echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT - # DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) - # echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT - # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz - # mkdir -p /opt/llvm-15 - # tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 - # echo '/opt/llvm-15/bin' >> $GITHUB_PATH - # echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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) ]] + 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz + mkdir -p /opt/llvm-15 + tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 + echo '/opt/llvm-15/bin' >> $GITHUB_PATH + echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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 + 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_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: make test-wasi-fyi - # run: | - # make test-wasi-fyi + 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: 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 @@ -179,683 +178,705 @@ jobs: 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_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_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_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-2023-10-05" - # target: x86_64-unknown-linux-gnu - # - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` - # - name: make test-build-docs-rs-ci - # run: make test-build-docs-rs-ci + 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-2023-10-05" + target: x86_64-unknown-linux-gnu + - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` + - 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@v3 - # with: - # name: capi-linux-aarch64 - # path: dist - # if-no-files-found: error - # retention-days: 2 + 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@v3 + 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@v3 + with: + name: capi-linux-riscv64 + 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@v3 - # 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, + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + }, + { + build: linux-musl, + target: x86_64-unknown-linux-musl, + os: ubuntu-22.04, + container: 'alpine:latest' + }, + { + build: macos-x64, + os: macos-11, + target: x86_64-apple-darwin, + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + }, + { + build: macos-arm, + os: macos-11, + target: aarch64-apple-darwin, + }, + { + build: windows-x64, + os: windows-2019, + target: x86_64-pc-windows-msvc, + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' + }, + { + build: windows-gnu, + target: x86_64-pc-windows-gnu, + os: ubuntu-22.04, + } + ] + 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 + - 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-latest' || matrix.metadata.os == 'macos-11.0' + - 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 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-11.0' && !matrix.metadata.llvm_url + run: | + brew install llvm + - name: Install LLVM + if: matrix.metadata.llvm_url + shell: bash + 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 + 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@v3 + with: + name: capi-${{ matrix.metadata.build }} + path: build-capi.tar.gz + if-no-files-found: ignore + 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, - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # }, - # { - # build: linux-musl, - # target: x86_64-unknown-linux-musl, - # os: ubuntu-22.04, - # container: 'alpine:latest' - # }, - # { - # build: macos-x64, - # os: macos-11, - # target: x86_64-apple-darwin, - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # }, - # { - # build: macos-arm, - # os: macos-11, - # target: aarch64-apple-darwin, - # }, - # { - # build: windows-x64, - # os: windows-2019, - # target: x86_64-pc-windows-msvc, - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' - # }, - # { - # build: windows-gnu, - # target: x86_64-pc-windows-gnu, - # os: ubuntu-22.04, - # } - # ] - # 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 - # - 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-latest' || matrix.metadata.os == 'macos-11.0' - # - 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 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-11.0' && !matrix.metadata.llvm_url - # run: | - # brew install llvm - # - name: Install LLVM - # if: matrix.metadata.llvm_url - # shell: bash - # 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - # env: - # LLVM_DIR: .llvm - # - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 - # 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@v3 - # 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 }} + runs-on: ${{ matrix.metadata.os }} + needs: setup + strategy: + 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + }, + { + build: macos-x64, + os: macos-11, + target: x86_64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + }, + { + build: macos-arm64, + os: macos-14, + target: aarch64-apple-darwin, + exe: '', + }, + { + build: windows-x64, + os: windows-2019, + target: x86_64-pc-windows-msvc, + exe: '.exe', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: + 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 + 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 + - 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-latest' || matrix.metadata.os == 'macos-11.0' + - 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 LLVM (macOS Apple Silicon) + if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url + run: | + brew install llvm + - name: Install LLVM + if: matrix.metadata.llvm_url + shell: bash + 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - 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: Cache + uses: whywaita/actions-cache-s3@v2 + with: + path: | + ~/.cargo/* + ./target/* + key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} + run: make ${{ matrix.stage.make }} + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + CARGO_TARGET: ${{ matrix.metadata.target }} - # test: - # name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} - # runs-on: ${{ matrix.metadata.os }} - # needs: setup - # strategy: - # 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # }, - # { - # build: macos-x64, - # os: macos-11, - # target: x86_64-apple-darwin, - # exe: '', - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # }, - # { - # build: macos-arm64, - # os: macos-14, - # target: aarch64-apple-darwin, - # exe: '', - # }, - # { - # build: windows-x64, - # os: windows-2019, - # target: x86_64-pc-windows-msvc, - # exe: '.exe', - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: - # 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 - # 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 - # - 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-latest' || matrix.metadata.os == 'macos-11.0' - # - 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 LLVM (macOS Apple Silicon) - # if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url - # run: | - # brew install llvm - # - name: Install LLVM - # if: matrix.metadata.llvm_url - # shell: bash - # 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH - # echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - # env: - # LLVM_DIR: .llvm - # - 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: Cache - # uses: whywaita/actions-cache-s3@v2 - # with: - # path: | - # ~/.cargo/* - # ./target/* - # key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} - # run: make ${{ matrix.stage.make }} - # env: - # TARGET: ${{ matrix.metadata.target }} - # TARGET_DIR: target/${{ matrix.metadata.target }}/release - # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + - build: macos-x64 + os: macos-11 + target: x86_64-apple-darwin + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # we only build the integration-test CLI, we don't run tests + - build: macos-arm + os: macos-11 + 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 + 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 + - uses: actions/download-artifact@v3 + id: download + with: + name: capi-${{ matrix.build }} + - uses: actions/download-artifact@v3 + 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@v3 + with: + name: capi-linux-aarch64 + path: package/cache/wasmercache1 + - uses: actions/download-artifact@v3 + with: + name: capi-windows-gnu + path: package/cache/wasmercache2 + - uses: actions/download-artifact@v3 + with: + name: capi-macos-arm + path: package/cache/wasmercache3 + - uses: actions/download-artifact@v3 + with: + name: capi-macos-x64 + path: package/cache/wasmercache4 + - uses: actions/download-artifact@v3 + with: + name: capi-linux-x64 + path: package/cache/wasmercache5 + - uses: actions/download-artifact@v3 + 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@v3 + if: ${{ matrix.build == 'windows-x64' }} + with: + name: capi-windows-gnu + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'linux-musl' }} + with: + name: capi-linux-musl + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'macos-arm' }} + with: + name: capi-macos-arm + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'macos-x64' }} + with: + name: capi-macos-x64 + path: download_link + - uses: actions/download-artifact@v3 + 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 + - 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 }} - # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # - build: macos-x64 - # os: macos-11 - # target: x86_64-apple-darwin - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # # we only build the integration-test CLI, we don't run tests - # - build: macos-arm - # os: macos-11 - # 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 - # 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 - # - uses: actions/download-artifact@v3 - # id: download - # with: - # name: capi-${{ matrix.build }} - # - uses: actions/download-artifact@v3 - # 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@v3 - # with: - # name: capi-linux-aarch64 - # path: package/cache/wasmercache1 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-windows-gnu - # path: package/cache/wasmercache2 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-macos-arm - # path: package/cache/wasmercache3 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-macos-x64 - # path: package/cache/wasmercache4 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-linux-x64 - # path: package/cache/wasmercache5 - # - uses: actions/download-artifact@v3 - # 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@v3 - # if: ${{ matrix.build == 'windows-x64' }} - # with: - # name: capi-windows-gnu - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'linux-musl' }} - # with: - # name: capi-linux-musl - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'macos-arm' }} - # with: - # name: capi-macos-arm - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'macos-x64' }} - # with: - # name: capi-macos-x64 - # path: download_link - # - uses: actions/download-artifact@v3 - # 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 - # - 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 }} +# Depends on all actions that are required for a "successful" CI run. + tests-pass: + name: all systems go + runs-on: ubuntu-latest + needs: + - setup + - lint + - cargo_deny + - test_nodejs + - test_wasi_fyi + - test_wasix + - test_wasm_build + - test_build_jsc + - test_build_docs_rs + - build_linux_aarch64 + - build_linux_riscv64 + - build + - test + - test_integration_cli + steps: + - run: exit 0 diff --git a/.github/workflows/wasmer-config.yaml b/.github/workflows/wasmer-config.yaml index fe1395bf2c2..9091574b1e3 100644 --- a/.github/workflows/wasmer-config.yaml +++ b/.github/workflows/wasmer-config.yaml @@ -16,47 +16,39 @@ env: DEFAULT_CRATE_NAME: wasmer_toml jobs: - placeholder: - name: placeholder + check: + name: Compile and Test runs-on: ubuntu-latest steps: - - name: placeholder - run: | - echo "Placeholder" + - uses: actions/checkout@v2 + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Setup Rust + uses: dsherret/rust-toolchain-file@v1 + - name: Install Nextest + uses: taiki-e/install-action@nextest + - name: Type Checking + run: | + cd lib/config && cargo check --verbose --locked + - name: Build + run: | + cd lib/config && cargo build --verbose --locked + - name: Test + run: | + cd lib/config && cargo nextest run --verbose --locked - # check: - # name: Compile and Test - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Rust Cache - # uses: Swatinem/rust-cache@v2 - # - name: Setup Rust - # uses: dsherret/rust-toolchain-file@v1 - # - name: Install Nextest - # uses: taiki-e/install-action@nextest - # - name: Type Checking - # run: | - # cd lib/config && cargo check --verbose --locked - # - name: Build - # run: | - # cd lib/config && cargo build --verbose --locked - # - name: Test - # run: | - # cd lib/config && cargo nextest run --verbose --locked - - # lints: - # name: Linting and Formatting - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Rust Cache - # uses: Swatinem/rust-cache@v2 - # - name: Setup Rust - # uses: dsherret/rust-toolchain-file@v1 - # - name: Check Formatting - # run: | - # cd lib/config && cargo fmt --verbose --check - # - name: Clippy - # run: | - # cd lib/config && cargo clippy --verbose + lints: + name: Linting and Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Setup Rust + uses: dsherret/rust-toolchain-file@v1 + - name: Check Formatting + run: | + cd lib/config && cargo fmt --verbose --check + - name: Clippy + run: | + cd lib/config && cargo clippy --verbose From 01b3ddd17b1c5fbc0eb56d7d5940dd2cb04854b3 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 01:05:21 +0330 Subject: [PATCH 19/25] fail on purpose --- .github/workflows/test.yaml | 1594 +++++++++++++------------- .github/workflows/wasmer-config.yaml | 67 +- tests/wasix/cwd-to-home/main.c | 2 +- tests/wasix/test.sh | 10 +- 4 files changed, 840 insertions(+), 833 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd1633da189..13c9bbeb9c0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,114 +30,114 @@ env: WASI_SDK_VERSION: "22" jobs: - setup: - name: Set up - runs-on: ubuntu-22.04 - outputs: - VERSION: ${{ steps.setup.outputs.VERSION }} - DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} - steps: - - name: Set up env vars - id: setup - shell: bash - run: | - VERSION=${GITHUB_REF/refs\/tags\//} - echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT - DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) - echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT - echo $VERSION - echo $DOING_RELEASE + # setup: + # name: Set up + # runs-on: ubuntu-22.04 + # outputs: + # VERSION: ${{ steps.setup.outputs.VERSION }} + # DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} + # steps: + # - name: Set up env vars + # id: setup + # shell: bash + # run: | + # VERSION=${GITHUB_REF/refs\/tags\//} + # echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + # DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) + # echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz - mkdir -p /opt/llvm-15 - tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 - echo '/opt/llvm-15/bin' >> $GITHUB_PATH - echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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) ]] + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz + # mkdir -p /opt/llvm-15 + # tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 + # echo '/opt/llvm-15/bin' >> $GITHUB_PATH + # echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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 + # 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_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: make test-wasi-fyi - run: | - make test-wasi-fyi + # 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: 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 @@ -178,705 +178,705 @@ jobs: 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_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_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_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-2023-10-05" - target: x86_64-unknown-linux-gnu - - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` - - name: make test-build-docs-rs-ci - run: make test-build-docs-rs-ci + # 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-2023-10-05" + # target: x86_64-unknown-linux-gnu + # - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` + # - 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@v3 - with: - name: capi-linux-aarch64 - path: dist - if-no-files-found: error - retention-days: 2 + # 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@v3 + # 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@v3 - with: - name: capi-linux-riscv64 - 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@v3 + # 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, - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - }, - { - build: linux-musl, - target: x86_64-unknown-linux-musl, - os: ubuntu-22.04, - container: 'alpine:latest' - }, - { - build: macos-x64, - os: macos-11, - target: x86_64-apple-darwin, - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - }, - { - build: macos-arm, - os: macos-11, - target: aarch64-apple-darwin, - }, - { - build: windows-x64, - os: windows-2019, - target: x86_64-pc-windows-msvc, - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' - }, - { - build: windows-gnu, - target: x86_64-pc-windows-gnu, - os: ubuntu-22.04, - } - ] - 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 - - 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-latest' || matrix.metadata.os == 'macos-11.0' - - 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 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-11.0' && !matrix.metadata.llvm_url - run: | - brew install llvm - - name: Install LLVM - if: matrix.metadata.llvm_url - shell: bash - 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 - 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@v3 - with: - name: capi-${{ matrix.metadata.build }} - path: build-capi.tar.gz - if-no-files-found: ignore - 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, + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # }, + # { + # build: linux-musl, + # target: x86_64-unknown-linux-musl, + # os: ubuntu-22.04, + # container: 'alpine:latest' + # }, + # { + # build: macos-x64, + # os: macos-11, + # target: x86_64-apple-darwin, + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # }, + # { + # build: macos-arm, + # os: macos-11, + # target: aarch64-apple-darwin, + # }, + # { + # build: windows-x64, + # os: windows-2019, + # target: x86_64-pc-windows-msvc, + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' + # }, + # { + # build: windows-gnu, + # target: x86_64-pc-windows-gnu, + # os: ubuntu-22.04, + # } + # ] + # 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 + # - 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-latest' || matrix.metadata.os == 'macos-11.0' + # - 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 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-11.0' && !matrix.metadata.llvm_url + # run: | + # brew install llvm + # - name: Install LLVM + # if: matrix.metadata.llvm_url + # shell: bash + # 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + # env: + # LLVM_DIR: .llvm + # - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 + # 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@v3 + # 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 }} - runs-on: ${{ matrix.metadata.os }} - needs: setup - strategy: - 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - }, - { - build: macos-x64, - os: macos-11, - target: x86_64-apple-darwin, - exe: '', - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - }, - { - build: macos-arm64, - os: macos-14, - target: aarch64-apple-darwin, - exe: '', - }, - { - build: windows-x64, - os: windows-2019, - target: x86_64-pc-windows-msvc, - exe: '.exe', - llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: - 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 - 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 - - 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-latest' || matrix.metadata.os == 'macos-11.0' - - 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 LLVM (macOS Apple Silicon) - if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url - run: | - brew install llvm - - name: Install LLVM - if: matrix.metadata.llvm_url - shell: bash - 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - 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: Cache - uses: whywaita/actions-cache-s3@v2 - with: - path: | - ~/.cargo/* - ./target/* - key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} - run: make ${{ matrix.stage.make }} - env: - TARGET: ${{ matrix.metadata.target }} - TARGET_DIR: target/${{ matrix.metadata.target }}/release - CARGO_TARGET: ${{ matrix.metadata.target }} + # test: + # name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} + # runs-on: ${{ matrix.metadata.os }} + # needs: setup + # strategy: + # 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # }, + # { + # build: macos-x64, + # os: macos-11, + # target: x86_64-apple-darwin, + # exe: '', + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # }, + # { + # build: macos-arm64, + # os: macos-14, + # target: aarch64-apple-darwin, + # exe: '', + # }, + # { + # build: windows-x64, + # os: windows-2019, + # target: x86_64-pc-windows-msvc, + # exe: '.exe', + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: + # 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 + # 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 + # - 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-latest' || matrix.metadata.os == 'macos-11.0' + # - 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 LLVM (macOS Apple Silicon) + # if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url + # run: | + # brew install llvm + # - name: Install LLVM + # if: matrix.metadata.llvm_url + # shell: bash + # 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH + # echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + # env: + # LLVM_DIR: .llvm + # - 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: Cache + # uses: whywaita/actions-cache-s3@v2 + # with: + # path: | + # ~/.cargo/* + # ./target/* + # key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} + # run: make ${{ matrix.stage.make }} + # env: + # TARGET: ${{ matrix.metadata.target }} + # TARGET_DIR: target/${{ matrix.metadata.target }}/release + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - - build: macos-x64 - os: macos-11 - target: x86_64-apple-darwin - llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # we only build the integration-test CLI, we don't run tests - - build: macos-arm - os: macos-11 - 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 - 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 - - uses: actions/download-artifact@v3 - id: download - with: - name: capi-${{ matrix.build }} - - uses: actions/download-artifact@v3 - 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@v3 - with: - name: capi-linux-aarch64 - path: package/cache/wasmercache1 - - uses: actions/download-artifact@v3 - with: - name: capi-windows-gnu - path: package/cache/wasmercache2 - - uses: actions/download-artifact@v3 - with: - name: capi-macos-arm - path: package/cache/wasmercache3 - - uses: actions/download-artifact@v3 - with: - name: capi-macos-x64 - path: package/cache/wasmercache4 - - uses: actions/download-artifact@v3 - with: - name: capi-linux-x64 - path: package/cache/wasmercache5 - - uses: actions/download-artifact@v3 - 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@v3 - if: ${{ matrix.build == 'windows-x64' }} - with: - name: capi-windows-gnu - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'linux-musl' }} - with: - name: capi-linux-musl - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'macos-arm' }} - with: - name: capi-macos-arm - path: download_link - - uses: actions/download-artifact@v3 - if: ${{ matrix.build == 'macos-x64' }} - with: - name: capi-macos-x64 - path: download_link - - uses: actions/download-artifact@v3 - 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 - - 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 }} + # 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + # - build: macos-x64 + # os: macos-11 + # target: x86_64-apple-darwin + # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # # we only build the integration-test CLI, we don't run tests + # - build: macos-arm + # os: macos-11 + # 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 + # 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 + # - uses: actions/download-artifact@v3 + # id: download + # with: + # name: capi-${{ matrix.build }} + # - uses: actions/download-artifact@v3 + # 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@v3 + # with: + # name: capi-linux-aarch64 + # path: package/cache/wasmercache1 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-windows-gnu + # path: package/cache/wasmercache2 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-macos-arm + # path: package/cache/wasmercache3 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-macos-x64 + # path: package/cache/wasmercache4 + # - uses: actions/download-artifact@v3 + # with: + # name: capi-linux-x64 + # path: package/cache/wasmercache5 + # - uses: actions/download-artifact@v3 + # 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@v3 + # if: ${{ matrix.build == 'windows-x64' }} + # with: + # name: capi-windows-gnu + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'linux-musl' }} + # with: + # name: capi-linux-musl + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'macos-arm' }} + # with: + # name: capi-macos-arm + # path: download_link + # - uses: actions/download-artifact@v3 + # if: ${{ matrix.build == 'macos-x64' }} + # with: + # name: capi-macos-x64 + # path: download_link + # - uses: actions/download-artifact@v3 + # 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 + # - 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 }} # Depends on all actions that are required for a "successful" CI run. - tests-pass: - name: all systems go - runs-on: ubuntu-latest - needs: - - setup - - lint - - cargo_deny - - test_nodejs - - test_wasi_fyi - - test_wasix - - test_wasm_build - - test_build_jsc - - test_build_docs_rs - - build_linux_aarch64 - - build_linux_riscv64 - - build - - test - - test_integration_cli - steps: - - run: exit 0 + # tests-pass: + # name: all systems go + # runs-on: ubuntu-latest + # needs: + # - setup + # - lint + # - cargo_deny + # - test_nodejs + # - test_wasi_fyi + # - test_wasix + # - test_wasm_build + # - test_build_jsc + # - test_build_docs_rs + # - build_linux_aarch64 + # - build_linux_riscv64 + # - build + # - test + # - test_integration_cli + # steps: + # - run: exit 0 diff --git a/.github/workflows/wasmer-config.yaml b/.github/workflows/wasmer-config.yaml index 9091574b1e3..3404b3b1c1e 100644 --- a/.github/workflows/wasmer-config.yaml +++ b/.github/workflows/wasmer-config.yaml @@ -20,35 +20,42 @@ jobs: name: Compile and Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Setup Rust - uses: dsherret/rust-toolchain-file@v1 - - name: Install Nextest - uses: taiki-e/install-action@nextest - - name: Type Checking + - name: "Placeholder" run: | - cd lib/config && cargo check --verbose --locked - - name: Build - run: | - cd lib/config && cargo build --verbose --locked - - name: Test - run: | - cd lib/config && cargo nextest run --verbose --locked + exit 0 + # check: + # name: Compile and Test + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Rust Cache + # uses: Swatinem/rust-cache@v2 + # - name: Setup Rust + # uses: dsherret/rust-toolchain-file@v1 + # - name: Install Nextest + # uses: taiki-e/install-action@nextest + # - name: Type Checking + # run: | + # cd lib/config && cargo check --verbose --locked + # - name: Build + # run: | + # cd lib/config && cargo build --verbose --locked + # - name: Test + # run: | + # cd lib/config && cargo nextest run --verbose --locked - lints: - name: Linting and Formatting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Setup Rust - uses: dsherret/rust-toolchain-file@v1 - - name: Check Formatting - run: | - cd lib/config && cargo fmt --verbose --check - - name: Clippy - run: | - cd lib/config && cargo clippy --verbose + # lints: + # name: Linting and Formatting + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Rust Cache + # uses: Swatinem/rust-cache@v2 + # - name: Setup Rust + # uses: dsherret/rust-toolchain-file@v1 + # - name: Check Formatting + # run: | + # cd lib/config && cargo fmt --verbose --check + # - name: Clippy + # run: | + # cd lib/config && cargo clippy --verbose diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c index 7009ef98a97..ea42f3b0426 100644 --- a/tests/wasix/cwd-to-home/main.c +++ b/tests/wasix/cwd-to-home/main.c @@ -4,7 +4,7 @@ int main() { int fd = open("hello.txt", O_RDWR); - printf("%d", (fd == -1)); + printf("%d", (fd != -1)); return 0; } \ No newline at end of file diff --git a/tests/wasix/test.sh b/tests/wasix/test.sh index 8630e1b6d6e..619b221d558 100755 --- a/tests/wasix/test.sh +++ b/tests/wasix/test.sh @@ -71,15 +71,15 @@ export WASMER=$(realpath "../../target/release/wasmer") printf "\n\nStarting WASIX Test Suite:\n" status=0 - -find . -mindepth 1 -maxdepth 1 -type d | while read dir; do - dir=$(basename $dir) +while read dir; do + dir=$(basename "$dir") printf "Testing $dir..." if bash -c "cd $dir && ./run.sh"; then printf "\rTesting $dir ✅\n" else - printf "\rTesting $dir ❌\n" || status=1 + printf "\rTesting $dir ❌\n" + status=1 fi -done +done < <(find . -mindepth 1 -maxdepth 1 -type d) exit $status \ No newline at end of file From 8d37bdd1a85b732073cc447cbd874c90b6d21f6b Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 01:18:44 +0330 Subject: [PATCH 20/25] fix test and bring back jobs --- .github/workflows/test.yaml | 1594 +++++++++++++------------- .github/workflows/wasmer-config.yaml | 67 +- tests/wasix/cwd-to-home/main.c | 2 +- 3 files changed, 828 insertions(+), 835 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 13c9bbeb9c0..bd1633da189 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,114 +30,114 @@ env: WASI_SDK_VERSION: "22" jobs: - # setup: - # name: Set up - # runs-on: ubuntu-22.04 - # outputs: - # VERSION: ${{ steps.setup.outputs.VERSION }} - # DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} - # steps: - # - name: Set up env vars - # id: setup - # shell: bash - # run: | - # VERSION=${GITHUB_REF/refs\/tags\//} - # echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT - # DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) - # echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT - # echo $VERSION - # echo $DOING_RELEASE + setup: + name: Set up + runs-on: ubuntu-22.04 + outputs: + VERSION: ${{ steps.setup.outputs.VERSION }} + DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} + steps: + - name: Set up env vars + id: setup + shell: bash + run: | + VERSION=${GITHUB_REF/refs\/tags\//} + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) + echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT + 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz - # mkdir -p /opt/llvm-15 - # tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 - # echo '/opt/llvm-15/bin' >> $GITHUB_PATH - # echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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) ]] + 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz -L -o /opt/llvm.tar.xz + mkdir -p /opt/llvm-15 + tar xf /opt/llvm.tar.xz --strip-components=1 -C /opt/llvm-15 + echo '/opt/llvm-15/bin' >> $GITHUB_PATH + echo 'LLVM_SYS_150_PREFIX=/opt/llvm-15' >> $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 + 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_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: make test-wasi-fyi - # run: | - # make test-wasi-fyi + 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: 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 @@ -178,705 +178,705 @@ jobs: 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_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_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_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-2023-10-05" - # target: x86_64-unknown-linux-gnu - # - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` - # - name: make test-build-docs-rs-ci - # run: make test-build-docs-rs-ci + 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-2023-10-05" + target: x86_64-unknown-linux-gnu + - run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs` + - 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@v3 - # with: - # name: capi-linux-aarch64 - # path: dist - # if-no-files-found: error - # retention-days: 2 + 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@v3 + 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@v3 - # with: - # name: capi-linux-riscv64 - # 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@v3 + 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, - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # }, - # { - # build: linux-musl, - # target: x86_64-unknown-linux-musl, - # os: ubuntu-22.04, - # container: 'alpine:latest' - # }, - # { - # build: macos-x64, - # os: macos-11, - # target: x86_64-apple-darwin, - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # }, - # { - # build: macos-arm, - # os: macos-11, - # target: aarch64-apple-darwin, - # }, - # { - # build: windows-x64, - # os: windows-2019, - # target: x86_64-pc-windows-msvc, - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' - # }, - # { - # build: windows-gnu, - # target: x86_64-pc-windows-gnu, - # os: ubuntu-22.04, - # } - # ] - # 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 - # - 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-latest' || matrix.metadata.os == 'macos-11.0' - # - 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 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-11.0' && !matrix.metadata.llvm_url - # run: | - # brew install llvm - # - name: Install LLVM - # if: matrix.metadata.llvm_url - # shell: bash - # 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - # env: - # LLVM_DIR: .llvm - # - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 - # 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@v3 - # with: - # name: capi-${{ matrix.metadata.build }} - # path: build-capi.tar.gz - # if-no-files-found: ignore - # 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, + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + }, + { + build: linux-musl, + target: x86_64-unknown-linux-musl, + os: ubuntu-22.04, + container: 'alpine:latest' + }, + { + build: macos-x64, + os: macos-11, + target: x86_64-apple-darwin, + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + }, + { + build: macos-arm, + os: macos-11, + target: aarch64-apple-darwin, + }, + { + build: windows-x64, + os: windows-2019, + target: x86_64-pc-windows-msvc, + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.x/llvm-windows-amd64.tar.xz' + }, + { + build: windows-gnu, + target: x86_64-pc-windows-gnu, + os: ubuntu-22.04, + } + ] + 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 + - 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-latest' || matrix.metadata.os == 'macos-11.0' + - 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 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-11.0' && !matrix.metadata.llvm_url + run: | + brew install llvm + - name: Install LLVM + if: matrix.metadata.llvm_url + shell: bash + 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_150_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - 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 == 'macos-arm' || 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 == 'macos-arm' || 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@v3 + 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@v3 + 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 }} - # runs-on: ${{ matrix.metadata.os }} - # needs: setup - # strategy: - # 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # }, - # { - # build: macos-x64, - # os: macos-11, - # target: x86_64-apple-darwin, - # exe: '', - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # }, - # { - # build: macos-arm64, - # os: macos-14, - # target: aarch64-apple-darwin, - # exe: '', - # }, - # { - # build: windows-x64, - # os: windows-2019, - # target: x86_64-pc-windows-msvc, - # exe: '.exe', - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: - # 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 - # 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 - # - 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-latest' || matrix.metadata.os == 'macos-11.0' - # - 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 LLVM (macOS Apple Silicon) - # if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url - # run: | - # brew install llvm - # - name: Install LLVM - # if: matrix.metadata.llvm_url - # shell: bash - # 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH - # echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - # env: - # LLVM_DIR: .llvm - # - 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: Cache - # uses: whywaita/actions-cache-s3@v2 - # with: - # path: | - # ~/.cargo/* - # ./target/* - # key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} - # run: make ${{ matrix.stage.make }} - # env: - # TARGET: ${{ matrix.metadata.target }} - # TARGET_DIR: target/${{ matrix.metadata.target }}/release - # CARGO_TARGET: ${{ matrix.metadata.target }} + test: + name: ${{ matrix.stage.description }} on ${{ matrix.metadata.build }} + runs-on: ${{ matrix.metadata.os }} + needs: setup + strategy: + 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: '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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + }, + { + build: macos-x64, + os: macos-11, + target: x86_64-apple-darwin, + exe: '', + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + }, + { + build: macos-arm64, + os: macos-14, + target: aarch64-apple-darwin, + exe: '', + }, + { + build: windows-x64, + os: windows-2019, + target: x86_64-pc-windows-msvc, + exe: '.exe', + llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/15.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: + 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 + 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 + - 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-latest' || matrix.metadata.os == 'macos-11.0' + - 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 LLVM (macOS Apple Silicon) + if: matrix.metadata.os == 'macos-11.0' && !matrix.metadata.llvm_url + run: | + brew install llvm + - name: Install LLVM + if: matrix.metadata.llvm_url + shell: bash + 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 "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - 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: Cache + uses: whywaita/actions-cache-s3@v2 + with: + path: | + ~/.cargo/* + ./target/* + key: r22-${{ github.repository }}-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-wasmer-make-test-stage-${{ matrix.stage.make }}-${{ 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: ${{ matrix.stage.description }} + run: make ${{ matrix.stage.make }} + env: + TARGET: ${{ matrix.metadata.target }} + TARGET_DIR: target/${{ matrix.metadata.target }}/release + 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' - # - build: macos-x64 - # os: macos-11 - # target: x86_64-apple-darwin - # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' - # # we only build the integration-test CLI, we don't run tests - # - build: macos-arm - # os: macos-11 - # 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 - # 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 - # - uses: actions/download-artifact@v3 - # id: download - # with: - # name: capi-${{ matrix.build }} - # - uses: actions/download-artifact@v3 - # 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@v3 - # with: - # name: capi-linux-aarch64 - # path: package/cache/wasmercache1 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-windows-gnu - # path: package/cache/wasmercache2 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-macos-arm - # path: package/cache/wasmercache3 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-macos-x64 - # path: package/cache/wasmercache4 - # - uses: actions/download-artifact@v3 - # with: - # name: capi-linux-x64 - # path: package/cache/wasmercache5 - # - uses: actions/download-artifact@v3 - # 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@v3 - # if: ${{ matrix.build == 'windows-x64' }} - # with: - # name: capi-windows-gnu - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'linux-musl' }} - # with: - # name: capi-linux-musl - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'macos-arm' }} - # with: - # name: capi-macos-arm - # path: download_link - # - uses: actions/download-artifact@v3 - # if: ${{ matrix.build == 'macos-x64' }} - # with: - # name: capi-macos-x64 - # path: download_link - # - uses: actions/download-artifact@v3 - # 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 - # - 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 }} + 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/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + - build: macos-x64 + os: macos-11 + target: x86_64-apple-darwin + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz' + # we only build the integration-test CLI, we don't run tests + - build: macos-arm + os: macos-11 + 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 + 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 + - uses: actions/download-artifact@v3 + id: download + with: + name: capi-${{ matrix.build }} + - uses: actions/download-artifact@v3 + 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@v3 + with: + name: capi-linux-aarch64 + path: package/cache/wasmercache1 + - uses: actions/download-artifact@v3 + with: + name: capi-windows-gnu + path: package/cache/wasmercache2 + - uses: actions/download-artifact@v3 + with: + name: capi-macos-arm + path: package/cache/wasmercache3 + - uses: actions/download-artifact@v3 + with: + name: capi-macos-x64 + path: package/cache/wasmercache4 + - uses: actions/download-artifact@v3 + with: + name: capi-linux-x64 + path: package/cache/wasmercache5 + - uses: actions/download-artifact@v3 + 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@v3 + if: ${{ matrix.build == 'windows-x64' }} + with: + name: capi-windows-gnu + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'linux-musl' }} + with: + name: capi-linux-musl + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'macos-arm' }} + with: + name: capi-macos-arm + path: download_link + - uses: actions/download-artifact@v3 + if: ${{ matrix.build == 'macos-x64' }} + with: + name: capi-macos-x64 + path: download_link + - uses: actions/download-artifact@v3 + 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 + - 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 }} # Depends on all actions that are required for a "successful" CI run. - # tests-pass: - # name: all systems go - # runs-on: ubuntu-latest - # needs: - # - setup - # - lint - # - cargo_deny - # - test_nodejs - # - test_wasi_fyi - # - test_wasix - # - test_wasm_build - # - test_build_jsc - # - test_build_docs_rs - # - build_linux_aarch64 - # - build_linux_riscv64 - # - build - # - test - # - test_integration_cli - # steps: - # - run: exit 0 + tests-pass: + name: all systems go + runs-on: ubuntu-latest + needs: + - setup + - lint + - cargo_deny + - test_nodejs + - test_wasi_fyi + - test_wasix + - test_wasm_build + - test_build_jsc + - test_build_docs_rs + - build_linux_aarch64 + - build_linux_riscv64 + - build + - test + - test_integration_cli + steps: + - run: exit 0 diff --git a/.github/workflows/wasmer-config.yaml b/.github/workflows/wasmer-config.yaml index 3404b3b1c1e..9091574b1e3 100644 --- a/.github/workflows/wasmer-config.yaml +++ b/.github/workflows/wasmer-config.yaml @@ -20,42 +20,35 @@ jobs: name: Compile and Test runs-on: ubuntu-latest steps: - - name: "Placeholder" + - uses: actions/checkout@v2 + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Setup Rust + uses: dsherret/rust-toolchain-file@v1 + - name: Install Nextest + uses: taiki-e/install-action@nextest + - name: Type Checking run: | - exit 0 - # check: - # name: Compile and Test - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Rust Cache - # uses: Swatinem/rust-cache@v2 - # - name: Setup Rust - # uses: dsherret/rust-toolchain-file@v1 - # - name: Install Nextest - # uses: taiki-e/install-action@nextest - # - name: Type Checking - # run: | - # cd lib/config && cargo check --verbose --locked - # - name: Build - # run: | - # cd lib/config && cargo build --verbose --locked - # - name: Test - # run: | - # cd lib/config && cargo nextest run --verbose --locked + cd lib/config && cargo check --verbose --locked + - name: Build + run: | + cd lib/config && cargo build --verbose --locked + - name: Test + run: | + cd lib/config && cargo nextest run --verbose --locked - # lints: - # name: Linting and Formatting - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Rust Cache - # uses: Swatinem/rust-cache@v2 - # - name: Setup Rust - # uses: dsherret/rust-toolchain-file@v1 - # - name: Check Formatting - # run: | - # cd lib/config && cargo fmt --verbose --check - # - name: Clippy - # run: | - # cd lib/config && cargo clippy --verbose + lints: + name: Linting and Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Setup Rust + uses: dsherret/rust-toolchain-file@v1 + - name: Check Formatting + run: | + cd lib/config && cargo fmt --verbose --check + - name: Clippy + run: | + cd lib/config && cargo clippy --verbose diff --git a/tests/wasix/cwd-to-home/main.c b/tests/wasix/cwd-to-home/main.c index ea42f3b0426..7009ef98a97 100644 --- a/tests/wasix/cwd-to-home/main.c +++ b/tests/wasix/cwd-to-home/main.c @@ -4,7 +4,7 @@ int main() { int fd = open("hello.txt", O_RDWR); - printf("%d", (fd != -1)); + printf("%d", (fd == -1)); return 0; } \ No newline at end of file From df8032ea5cad29322c4ac4673b6ddb3c3026348e Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 01:42:57 +0330 Subject: [PATCH 21/25] test more code paths --- tests/wasix/.gitignore | 3 ++- tests/wasix/cwd-to-home/run.sh | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/wasix/.gitignore b/tests/wasix/.gitignore index 554767ae207..61b5cdac584 100644 --- a/tests/wasix/.gitignore +++ b/tests/wasix/.gitignore @@ -1,2 +1,3 @@ -output +output* +*.webc *.wasm \ No newline at end of file diff --git a/tests/wasix/cwd-to-home/run.sh b/tests/wasix/cwd-to-home/run.sh index cd3f45e8372..0e47d5f48fe 100755 --- a/tests/wasix/cwd-to-home/run.sh +++ b/tests/wasix/cwd-to-home/run.sh @@ -2,6 +2,12 @@ $CC $CFLAGS $LDFLAGS -o main.wasm main.c -$WASMER run -q main.wasm --dir=. > output +$WASMER -q run main.wasm --dir=. > output0 +$WASMER -q run . --dir=. > output1 +$WASMER -q package build --out cwd-to-home.webc . > /dev/null && $WASMER -q run cwd-to-home.webc --dir=. > output2 -diff -u output expected 1>/dev/null \ No newline at end of file +rm cwd-to-home.webc + +diff -u output0 expected 1>/dev/null && \ +diff -u output1 expected 1>/dev/null && \ +diff -u output2 expected 1>/dev/null \ No newline at end of file From d71a26c083a0c2ad209bb8f4e6ab6351854de014 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 01:43:57 +0330 Subject: [PATCH 22/25] undo unnecessary comment --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd1633da189..7a253885649 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -139,10 +139,10 @@ jobs: 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 + # 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 From eaab7d68eb00d7f45805a929b392cde2540de338 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 01:49:47 +0330 Subject: [PATCH 23/25] remove all system go job --- .github/workflows/test.yaml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7a253885649..03f404c62cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -858,25 +858,3 @@ jobs: CARGO_TARGET: ${{ matrix.target }} WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -# Depends on all actions that are required for a "successful" CI run. - tests-pass: - name: all systems go - runs-on: ubuntu-latest - needs: - - setup - - lint - - cargo_deny - - test_nodejs - - test_wasi_fyi - - test_wasix - - test_wasm_build - - test_build_jsc - - test_build_docs_rs - - build_linux_aarch64 - - build_linux_riscv64 - - build - - test - - test_integration_cli - steps: - - run: exit 0 From d47a69fd575737791ed255a99c30c016255e4372 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 02:08:49 +0330 Subject: [PATCH 24/25] include wasmer.toml files in tests folder --- .gitignore | 2 +- tests/wasix/cwd-to-home/wasmer.toml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/wasix/cwd-to-home/wasmer.toml diff --git a/.gitignore b/.gitignore index ed9fd0c7e3a..a5f49e67270 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ api-docs-repo/ /lib/c-api/wasmer.h .xwin-cache wapm.toml -wasmer.toml +lib/**/wasmer.toml *.snap.new # Generated by tests on Android /avd diff --git a/tests/wasix/cwd-to-home/wasmer.toml b/tests/wasix/cwd-to-home/wasmer.toml new file mode 100644 index 00000000000..6c9f1600345 --- /dev/null +++ b/tests/wasix/cwd-to-home/wasmer.toml @@ -0,0 +1,7 @@ +[[module]] +name = "main" +source = "main.wasm" + +[[command]] +name = "main" +module = "main" \ No newline at end of file From d202535dd2c75b8efa4aaf82a10fcdcb5c79328c Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 31 May 2024 14:35:17 +0330 Subject: [PATCH 25/25] make the build step common among tests --- .gitignore | 2 +- tests/wasix/cwd-to-home/run.sh | 12 ++---------- tests/wasix/cwd-to-home/wasmer.toml | 7 ------- tests/wasix/test.sh | 7 ++++++- 4 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 tests/wasix/cwd-to-home/wasmer.toml diff --git a/.gitignore b/.gitignore index a5f49e67270..ed9fd0c7e3a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ api-docs-repo/ /lib/c-api/wasmer.h .xwin-cache wapm.toml -lib/**/wasmer.toml +wasmer.toml *.snap.new # Generated by tests on Android /avd diff --git a/tests/wasix/cwd-to-home/run.sh b/tests/wasix/cwd-to-home/run.sh index 0e47d5f48fe..474bd170e0d 100755 --- a/tests/wasix/cwd-to-home/run.sh +++ b/tests/wasix/cwd-to-home/run.sh @@ -1,13 +1,5 @@ #!/bin/bash -$CC $CFLAGS $LDFLAGS -o main.wasm main.c +$WASMER -q run main.wasm --dir=. > output -$WASMER -q run main.wasm --dir=. > output0 -$WASMER -q run . --dir=. > output1 -$WASMER -q package build --out cwd-to-home.webc . > /dev/null && $WASMER -q run cwd-to-home.webc --dir=. > output2 - -rm cwd-to-home.webc - -diff -u output0 expected 1>/dev/null && \ -diff -u output1 expected 1>/dev/null && \ -diff -u output2 expected 1>/dev/null \ No newline at end of file +diff -u output expected 1>/dev/null \ No newline at end of file diff --git a/tests/wasix/cwd-to-home/wasmer.toml b/tests/wasix/cwd-to-home/wasmer.toml deleted file mode 100644 index 6c9f1600345..00000000000 --- a/tests/wasix/cwd-to-home/wasmer.toml +++ /dev/null @@ -1,7 +0,0 @@ -[[module]] -name = "main" -source = "main.wasm" - -[[command]] -name = "main" -module = "main" \ No newline at end of file diff --git a/tests/wasix/test.sh b/tests/wasix/test.sh index 619b221d558..f3349e46c4a 100755 --- a/tests/wasix/test.sh +++ b/tests/wasix/test.sh @@ -74,7 +74,12 @@ status=0 while read dir; do dir=$(basename "$dir") printf "Testing $dir..." - if bash -c "cd $dir && ./run.sh"; then + + cmd="cd $dir; \ + $CC $CFLAGS $LDFLAGS -o main.wasm main.c; \ + ./run.sh" + + if bash -c "$cmd"; then printf "\rTesting $dir ✅\n" else printf "\rTesting $dir ❌\n"