From c40f46ddab9bae348ff11290a30e3eae89d2389a Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 27 Apr 2022 23:35:08 +0300 Subject: [PATCH 1/2] Github Actions: add linux-aarch64 release build --- .github/cross-linux-aarch64/Dockerfile | 12 +++ .github/workflows/build_linux_aarch64.yml | 75 ++++++++++++++++ .github/workflows/test-sys.yaml | 24 ++--- Makefile | 103 +++++++++++----------- 4 files changed, 148 insertions(+), 66 deletions(-) create mode 100644 .github/cross-linux-aarch64/Dockerfile create mode 100644 .github/workflows/build_linux_aarch64.yml diff --git a/.github/cross-linux-aarch64/Dockerfile b/.github/cross-linux-aarch64/Dockerfile new file mode 100644 index 00000000000..394652cbe2b --- /dev/null +++ b/.github/cross-linux-aarch64/Dockerfile @@ -0,0 +1,12 @@ +FROM rust:1 +#FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge + +# set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container +ENV CROSS_DOCKER_IN_DOCKER=true + +RUN cargo install cross +RUN dpkg --add-architecture arm64 && \ + apt-get update && \ + apt-get install -qy curl && \ + curl -sSL https://get.docker.com/ | sh && \ + apt-get install --assume-yes libxkbcommon0:arm64 libwayland-cursor0:arm64 libxkbcommon-dev:arm64 libwayland-dev:arm64 libxkbcommon-x11-dev:arm64 diff --git a/.github/workflows/build_linux_aarch64.yml b/.github/workflows/build_linux_aarch64.yml new file mode 100644 index 00000000000..2623c754430 --- /dev/null +++ b/.github/workflows/build_linux_aarch64.yml @@ -0,0 +1,75 @@ +on: [push] + +name: linux-aarch64 build + +jobs: + linux_aarch64: + name: Linux aarch64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true + - name: Build cross image + run: | + #cargo install cross + docker build -t wasmer/aarch64 /home/runner/work/wasmer/wasmer/.github/cross-linux-aarch64/ + #cat << EOF > ./Cross.toml + #[target.aarch64-unknown-linux-gnu] + #image = "wasmer/aarch64" + #EOF + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Install LLVM + shell: bash + run: | + sudo apt-get update -y + sudo apt-get install -yq tree + curl --proto '=https' --tlsv1.2 -sSf "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-aarch64-linux-gnu.tar.xz" -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: Build Wasmer binary + run: | + make build-wasmer + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + - name: Build C API + run: | + make build-capi + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + - name: Dist + run: | + #tree target/ + make distribution + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --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 + uses: actions/upload-artifact@v2 + with: + name: wasmer.tar.gz + path: dist + if-no-files-found: error + retention-days: 1 diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index 84686ad4ac7..db68cd29e2c 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -76,13 +76,6 @@ jobs: use_sccache: true run_test: true run_test_capi: false # We can't run yet the capi tests on Windows - #- build: linux-aarch64 - # os: [self-hosted, linux, ARM64] - # random_sccache_port: true - # use_sccache: true - # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/linux-aarch64.tar.gz' - # artifact_name: 'wasmer-linux-aarch64' - # run_integration_tests: false - build: linux-musl-x64 os: ubuntu-latest container: alpine:latest @@ -247,8 +240,16 @@ jobs: echo "rpath = false" >> Cargo.toml make build-wasmer-headless-minimal - name: Dist + if: matrix.build != 'macos-arm64' run: | make distribution + - name: Dist macos-arm64 + if: matrix.build == 'macos-arm64' + run: | + make distribution + env: + TARGET: aarch64-apple-darwin + TARGET_DIR: target/aarch64-apple-darwin/release - name: Run integration tests (Windows) shell: cmd run: | @@ -438,15 +439,6 @@ jobs: asset_path: artifacts/wasmer-darwin-arm64/wasmer.tar.gz asset_name: wasmer-darwin-arm64.tar.gz asset_content_type: application/gzip - #- name: Upload Release Asset Linux aarch64 - # uses: actions/upload-release-asset@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # asset_path: artifacts/wasmer-linux-aarch64/wasmer.tar.gz - # asset_name: wasmer-linux-aarch64.tar.gz - # asset_content_type: application/gzip audit: name: Audit diff --git a/Makefile b/Makefile index 6fba03fab3e..5c2d7c5ef17 100644 --- a/Makefile +++ b/Makefile @@ -98,12 +98,15 @@ endif # ##### +CARGO_BINARY ?= cargo +CARGO_TARGET ?= # Variables that can be overriden by the users to force to enable or # to disable a specific compiler. ENABLE_CRANELIFT ?= ENABLE_LLVM ?= ENABLE_SINGLEPASS ?= +LLVM_VERSION ?= # Which compilers we build. These have dependencies that may not be on the system. compilers := @@ -127,11 +130,11 @@ endif ifneq ($(ENABLE_LLVM), 0) # … then maybe the user forced to enable the LLVM compiler. ifeq ($(ENABLE_LLVM), 1) - LLVM_VERSION := $(shell llvm-config --version) + LLVM_VERSION ?= $(shell llvm-config --version) compilers += llvm # … otherwise, we try to autodetect LLVM from `llvm-config` else ifneq (, $(shell which llvm-config 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config --version) + LLVM_VERSION ?= $(shell llvm-config --version) # If findstring is not empty, then it have found the value ifneq (, $(findstring 13,$(LLVM_VERSION))) @@ -142,10 +145,10 @@ ifneq ($(ENABLE_LLVM), 0) # … or try to autodetect LLVM from `llvm-config-`. else ifneq (, $(shell which llvm-config-13 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config-13 --version) + LLVM_VERSION ?= $(shell llvm-config-13 --version) compilers += llvm else ifneq (, $(shell which llvm-config-12 2>/dev/null)) - LLVM_VERSION := $(shell llvm-config-12 --version) + LLVM_VERSION ?= $(shell llvm-config-12 --version) compilers += llvm endif endif @@ -304,10 +307,10 @@ endif HOST_TARGET=$(shell rustup show | grep 'Default host: ' | cut -d':' -f2 | tr -d ' ') -TARGET_DIR := target/release +TARGET_DIR ?= target/release ifneq (, $(TARGET)) - TARGET_DIR := target/$(TARGET)/release + TARGET_DIR ?= target/$(TARGET)/release endif $(info -----------) @@ -371,13 +374,13 @@ endif all: build-wasmer build-capi build-wasmer: - cargo build --release --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer + $(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer build-wasmer-debug: - cargo build --manifest-path lib/cli/Cargo.toml $(compiler_features) --features "debug" --bin wasmer + $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/cli/Cargo.toml $(compiler_features) --features "debug" --bin wasmer bench: - cargo bench $(compiler_features) + $(CARGO_BINARY) bench $(CARGO_TARGET) $(compiler_features) build-wasmer-wasm: cargo build --release --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,universal --bin wasmer-compiler @@ -412,13 +415,13 @@ get-wapm: build-wapm: get-wapm ifeq ($(IS_DARWIN), 1) # We build it without bundling sqlite, as is included by default in macos - cargo build --release --manifest-path wapm-cli/Cargo.toml --no-default-features --features "full packagesigning telemetry update-notifications" + $(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path wapm-cli/Cargo.toml --no-default-features --features "full packagesigning telemetry update-notifications" else - cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications" + $(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications" endif build-docs: - cargo doc --release $(compiler_features) --document-private-items --no-deps --workspace --exclude wasmer-c-api + $(CARGO_BINARY) doc $(CARGO_TARGET) --release $(compiler_features) --document-private-items --no-deps --workspace --exclude wasmer-c-api capi-setup: ifeq ($(IS_WINDOWS), 1) @@ -430,77 +433,77 @@ build-docs-capi: capi-setup # when generating the documentation, we rename it to its # crate's name. Then we restore the lib's name. sed "$(SEDI)" -e 's/name = "wasmer" # ##lib.name##/name = "wasmer_c_api" # ##lib.name##/' lib/c-api/Cargo.toml - RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,staticlib,dylib,cranelift,wasi + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,staticlib,dylib,cranelift,wasi sed "$(SEDI)" -e 's/name = "wasmer_c_api" # ##lib.name##/name = "wasmer" # ##lib.name##/' lib/c-api/Cargo.toml build-capi: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares $(capi_compiler_features) build-capi-singlepass: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,dylib,staticlib,singlepass,wasi,middlewares build-capi-singlepass-universal: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,singlepass,wasi,middlewares build-capi-singlepass-dylib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,dylib,singlepass,wasi,middlewares build-capi-singlepass-staticlib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,staticlib,singlepass,wasi,middlewares build-capi-cranelift: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,dylib,staticlib,cranelift,wasi,middlewares build-capi-cranelift-universal: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,cranelift,wasi,middlewares build-capi-cranelift-dylib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,dylib,cranelift,wasi,middlewares build-capi-cranelift-staticlib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,dylib,staticlib,cranelift,wasi,middlewares build-capi-llvm: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,dylib,staticlib,llvm,wasi,middlewares build-capi-llvm-universal: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,llvm,wasi,middlewares build-capi-llvm-dylib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,dylib,llvm,wasi,middlewares build-capi-llvm-staticlib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,staticlib,llvm,wasi,middlewares # Headless (we include the minimal to be able to run) build-capi-headless-universal: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features universal,wasi build-capi-headless-dylib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features dylib,wasi build-capi-headless-staticlib: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features staticlib,wasi build-capi-headless-all: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features universal,dylib,staticlib,wasi build-capi-headless-ios: capi-setup @@ -516,13 +519,13 @@ build-capi-headless-ios: capi-setup test: test-compilers test-packages test-examples test-compilers: - cargo test --release --tests $(compiler_features) + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) test-packages: - cargo test --all --release $(exclude_tests) - cargo test --manifest-path lib/compiler-cranelift/Cargo.toml --release --no-default-features --features=std - cargo test --manifest-path lib/compiler-singlepass/Cargo.toml --release --no-default-features --features=std - cargo test --manifest-path lib/cli/Cargo.toml $(compiler_features) --release + $(CARGO_BINARY) test $(CARGO_TARGET) --all --release $(exclude_tests) + $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/compiler-cranelift/Cargo.toml --release --no-default-features --features=std + $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/compiler-singlepass/Cargo.toml --release --no-default-features --features=std + $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/cli/Cargo.toml $(compiler_features) --release test-js: test-js-api test-js-wasi @@ -541,22 +544,22 @@ test-js-wasi: test-compilers-compat: $(foreach compiler,$(compilers),test-$(compiler)) test-singlepass-dylib: - cargo test --release --tests $(compiler_features) -- singlepass::dylib + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- singlepass::dylib test-singlepass-universal: - cargo test --release --tests $(compiler_features) -- singlepass::universal + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- singlepass::universal test-cranelift-dylib: - cargo test --release --tests $(compiler_features) -- cranelift::dylib + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- cranelift::dylib test-cranelift-universal: - cargo test --release --tests $(compiler_features) -- cranelift::universal + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- cranelift::universal test-llvm-dylib: - cargo test --release --tests $(compiler_features) -- llvm::dylib + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- llvm::dylib test-llvm-universal: - cargo test --release --tests $(compiler_features) -- llvm::universal + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- llvm::universal test-singlepass: $(foreach singlepass_engine,$(filter singlepass-%,$(compilers_engines)),test-$(singlepass_engine)) @@ -569,7 +572,7 @@ test-llvm: $(foreach llvm_engine,$(filter llvm-%,$(compilers_engines)),test-$(ll test-capi: build-capi package-capi $(foreach compiler_engine,$(capi_compilers_engines),test-capi-crate-$(compiler_engine) test-capi-integration-$(compiler_engine)) test-capi-crate-%: - WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-crate-//) cargo test --manifest-path lib/c-api/Cargo.toml --release \ + WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-crate-//) $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features wat,universal,dylib,staticlib,wasi,middlewares $(capi_compiler_features) -- --nocapture test-capi-integration-%: @@ -579,25 +582,25 @@ test-capi-integration-%: cd lib/c-api/examples; WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-integration-//) WASMER_DIR=`pwd`/../../../package make run test-wasi-unit: - cargo test --manifest-path lib/wasi/Cargo.toml --release + $(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/wasi/Cargo.toml --release test-wasi: - cargo test --release --tests $(compiler_features) -- wasi::wasitests + $(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- wasi::wasitests test-examples: - cargo test $(compiler_features) --features wasi --examples - cargo test --release $(compiler_features) --features wasi --examples + $(CARGO_BINARY) test $(CARGO_TARGET) $(compiler_features) --features wasi --examples + $(CARGO_BINARY) test $(CARGO_TARGET) --release $(compiler_features) --features wasi --examples test-integration: - cargo test -p wasmer-integration-tests-cli + $(CARGO_BINARY) test $(CARGO_TARGET) -p wasmer-integration-tests-cli test-integration-ios: - cargo test -p wasmer-integration-tests-ios + $(CARGO_BINARY) test $(CARGO_TARGET) -p wasmer-integration-tests-ios generate-wasi-tests: # Uncomment the following for installing the toolchain # cargo run -p wasi-test-generator -- -s - cargo run -p wasi-test-generator -- -g + $(CARGO_BINARY) run $(CARGO_TARGET) -p wasi-test-generator -- -g ##### # # Packaging. @@ -675,7 +678,7 @@ package-docs: build-docs build-docs-capi echo '' > package/docs/index.html echo '' > package/docs/crates/index.html -package: package-wapm package-wasmer package-minimal-headless-wasmer package-capi +package: package-wasmer package-minimal-headless-wasmer package-capi distribution: package cp LICENSE package/LICENSE From b8b280f0fd086b5485a1c731a1e36eab1aedfba2 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 4 May 2022 09:20:44 +0300 Subject: [PATCH 2/2] Github Actions: separate build and test workflow --- .github/workflows/build.yml | 379 ++++++++++++++++++++++ .github/workflows/build_linux_aarch64.yml | 75 ----- .github/workflows/test-sys.yaml | 260 ++------------- CHANGELOG.md | 3 + 4 files changed, 401 insertions(+), 316 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/build_linux_aarch64.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..1f099d05241 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,379 @@ +name: Builds + +env: + RUST_BACKTRACE: 1 + +on: + push: + branches: + - 'master' + tags: + # this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + - '[0-9]+.[0-9]+.[0-9]+*' + workflow_dispatch: +jobs: + setup: + name: Set up + runs-on: ubuntu-latest + 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 ::set-output name=VERSION::${VERSION} + DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true) + echo ::set-output name=DOING_RELEASE::${DOING_RELEASE} + echo $VERSION + echo $DOING_RELEASE + + build: + name: Build on ${{ matrix.build }} + runs-on: ${{ matrix.os }} + needs: setup + strategy: + matrix: + include: + - build: linux-x64 + os: ubuntu-18.04 + artifact_name: 'wasmer-linux-amd64' + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz' + cross_compilation_artifact_name: 'cross_compiled_from_linux' + use_sccache: true + - build: macos-x64 + os: macos-11 + llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz' + artifact_name: 'wasmer-darwin-amd64' + cross_compilation_artifact_name: 'cross_compiled_from_mac' + use_sccache: true + - build: macos-arm64 + os: macos-11.0 + target: aarch64-apple-darwin + artifact_name: 'wasmer-darwin-arm64' + use_sccache: true + - build: windows-x64 + os: windows-2019 + artifact_name: 'wasmer-windows-amd64' + # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/windows-amd64.tar.gz' + llvm_choco_version: 13.0.0 + cross_compilation_artifact_name: 'cross_compiled_from_win' + use_sccache: true + - build: linux-musl-x64 + os: ubuntu-latest + artifact_name: 'wasmer-linux-musl-amd64' + container: alpine:latest + use_sccache: false + container: ${{ matrix.container }} + env: + SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob + SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} + TARGET: ${{ matrix.target }} + steps: + - uses: actions/checkout@v2 + - name: Set up libstdc++ on Linux + if: matrix.build == 'linux-x64' + run: | + sudo apt-get update -y + sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04 + sudo apt-get install --reinstall g++-8 + - name: Install dependencies on Linux + if: matrix.build == 'linux-x64' + run: | + sudo apt-get update -y + sudo apt-get install -y libwayland-cursor0 libxkbcommon-dev libwayland-dev + - name: Set up base deps on musl + if: matrix.build == 'linux-musl-x64' + run: | + apk add build-base musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++ libxkbcommon-dev wayland-dev + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + target: ${{ matrix.target }} + override: true + - uses: Swatinem/rust-cache@v1 + if: matrix.use_sccache != true + - name: Install LLVM (Choco - Windows) + if: matrix.llvm_choco_version + shell: bash + run: | + choco install llvm --version ${{ matrix.llvm_choco_version }} --allow-downgrade + cd 'C:\Program Files\LLVM\' + LLVM_DIR=$(pwd) + echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + - name: Install LLVM (macOS Apple Silicon) + if: matrix.os == 'macos-11.0' && !matrix.llvm_url + run: | + brew install llvm + - name: Install LLVM + if: matrix.llvm_url + shell: bash + run: | + curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.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: 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.os == 'macos-latest' || matrix.os == 'macos-11.0' + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ matrix.build }}-${{ matrix.target }}-cargo-${{ hashFiles('Cargo.lock') }}-v1 + - uses: actions/cache@v2 + if: matrix.use_sccache + with: + path: ${{ runner.tool_cache }}/cargo-sccache + key: ${{ matrix.build }}-${{ matrix.target }}-sccache-bin-${{ env.CARGO_SCCACHE_VERSION }}-v1 + - name: Install sccache + if: matrix.use_sccache + run: | + if [ ! -f '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' ]; then + cargo install sccache --no-default-features --features=dist-client,azure --root '${{ runner.tool_cache }}/cargo-sccache' + fi + shell: bash + - name: Setup Rust target + run: | + mkdir -p .cargo + cat << EOF > .cargo/config.toml + [build] + target = "${{ matrix.target }}" + EOF + if: matrix.target + - name: Set sccache port + if: matrix.use_sccache && matrix.random_sccache_port + run: | + netstat -aln | awk ' + $6 == "LISTEN" { + if ($4 ~ "[.:][0-9]+$") { + n = split($4, a, /[:.]/); + port = a[n]; + p[port] = 1 + } + } + END { + for (i = 3000; i < 65000 && p[i]; i++){}; + if (i == 65000) {exit 1}; + print "SCCACHE_SERVER_PORT=" i + } + ' >> $GITHUB_ENV + # echo "SCCACHE_SERVER_PORT=9000" + echo "Setting random sccache port to: $SCCACHE_SERVER_PORT" + shell: bash + - name: Start sccache + if: matrix.use_sccache + run: | + chmod +x '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' + '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' --start-server + '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s + echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV + shell: bash + - name: Build C API + run: | + make build-capi + - name: Build Wasmer binary + run: | + make build-wasmer + - name: Build Wapm binary + run: | + make build-wapm + - name: Install Nightly Rust for Headless + uses: actions-rs/toolchain@v1 + with: + toolchain: 'nightly-2022-02-08' + target: ${{ matrix.target }} + override: true + components: "rust-src" + - name: Build Minimal Wasmer Headless + if: matrix.build != 'linux-musl-x64' + run: | + cargo install xargo + echo "" >> Cargo.toml + echo "[profile.release]" >> Cargo.toml + echo "opt-level = 'z'" >> Cargo.toml + echo "debug = false" >> Cargo.toml + echo "debug-assertions = false" >> Cargo.toml + echo "overflow-checks = false" >> Cargo.toml + echo "lto = true" >> Cargo.toml + echo "panic = 'abort'" >> Cargo.toml + echo "incremental = false" >> Cargo.toml + echo "codegen-units = 1" >> Cargo.toml + echo "rpath = false" >> Cargo.toml + make build-wasmer-headless-minimal + - name: Dist + if: matrix.build != 'macos-arm64' + run: | + make distribution + - name: Dist macos-arm64 + if: matrix.build == 'macos-arm64' + run: | + make distribution + env: + TARGET: aarch64-apple-darwin + TARGET_DIR: target/aarch64-apple-darwin/release + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.artifact_name }} + path: dist + if-no-files-found: error + retention-days: 2 + + linux_aarch64: + name: Linux aarch64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true + - name: Build cross image + run: | + docker build -t wasmer/aarch64 /home/runner/work/wasmer/wasmer/.github/cross-linux-aarch64/ + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Install LLVM + shell: bash + run: | + curl --proto '=https' --tlsv1.2 -sSf "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-aarch64-linux-gnu.tar.xz" -L -o llvm.tar.xz + LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} + mkdir ${LLVM_DIR} + tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} + echo "${LLVM_DIR}/bin" >> $GITHUB_PATH + echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV + env: + LLVM_DIR: .llvm + - name: Build Wasmer binary + run: | + make build-wasmer + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + - name: Build C API + run: | + make build-capi + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + - name: Dist + run: | + make distribution + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --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 + uses: actions/upload-artifact@v2 + with: + name: wasmer-linux-aarch64.tar.gz + path: dist + if-no-files-found: error + retention-days: 2 + + release: + needs: [setup, build, linux_aarch64] + runs-on: ubuntu-latest + if: needs.setup.outputs.DOING_RELEASE == '1' + steps: + - name: Download the Artifacts + uses: actions/download-artifact@v2 + with: + path: artifacts + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ needs.setup.outputs.VERSION }} + release_name: Release ${{ needs.setup.outputs.VERSION }} + draft: true + prerelease: false + - name: Upload Release Asset Windows Installer + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-windows-amd64/WasmerInstaller.exe + asset_name: wasmer-windows.exe + asset_content_type: application/vnd.microsoft.portable-executable + - name: Upload Release Asset Windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-windows-amd64/wasmer.tar.gz + asset_name: wasmer-windows-amd64.tar.gz + asset_content_type: application/gzip + - name: Upload Release Asset Linux amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-linux-amd64/wasmer.tar.gz + asset_name: wasmer-linux-amd64.tar.gz + asset_content_type: application/gzip + - name: Upload Release Asset Linux aarch64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-linux-aarch64/wasmer.tar.gz + asset_name: wasmer-linux-aarch64.tar.gz + asset_content_type: application/gzip + - name: Upload Release Asset Linux amd64 (musl) + id: upload-release-asset-linux-musl-amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-linux-musl-amd64/wasmer.tar.gz + asset_name: wasmer-linux-musl-amd64.tar.gz + asset_content_type: application/gzip + - name: Upload Release Asset Mac amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-darwin-amd64/wasmer.tar.gz + asset_name: wasmer-darwin-amd64.tar.gz + asset_content_type: application/gzip + - name: Upload Release Asset Mac arm64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/wasmer-darwin-arm64/wasmer.tar.gz + asset_name: wasmer-darwin-arm64.tar.gz + asset_content_type: application/gzip diff --git a/.github/workflows/build_linux_aarch64.yml b/.github/workflows/build_linux_aarch64.yml deleted file mode 100644 index 2623c754430..00000000000 --- a/.github/workflows/build_linux_aarch64.yml +++ /dev/null @@ -1,75 +0,0 @@ -on: [push] - -name: linux-aarch64 build - -jobs: - linux_aarch64: - name: Linux aarch64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - override: true - - name: Build cross image - run: | - #cargo install cross - docker build -t wasmer/aarch64 /home/runner/work/wasmer/wasmer/.github/cross-linux-aarch64/ - #cat << EOF > ./Cross.toml - #[target.aarch64-unknown-linux-gnu] - #image = "wasmer/aarch64" - #EOF - env: - CROSS_DOCKER_IN_DOCKER: true - - name: Install LLVM - shell: bash - run: | - sudo apt-get update -y - sudo apt-get install -yq tree - curl --proto '=https' --tlsv1.2 -sSf "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-aarch64-linux-gnu.tar.xz" -L -o llvm.tar.xz - LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }} - mkdir ${LLVM_DIR} - tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR} - echo "${LLVM_DIR}/bin" >> $GITHUB_PATH - echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV - env: - LLVM_DIR: .llvm - - name: Build Wasmer binary - run: | - make build-wasmer - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: --target aarch64-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - - name: Build C API - run: | - make build-capi - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: --target aarch64-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - - name: Dist - run: | - #tree target/ - make distribution - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: --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 - uses: actions/upload-artifact@v2 - with: - name: wasmer.tar.gz - path: dist - if-no-files-found: error - retention-days: 1 diff --git a/.github/workflows/test-sys.yaml b/.github/workflows/test-sys.yaml index db68cd29e2c..84c2b444384 100644 --- a/.github/workflows/test-sys.yaml +++ b/.github/workflows/test-sys.yaml @@ -42,18 +42,16 @@ jobs: include: - build: linux-x64 os: ubuntu-18.04 + target: x86_64-unknown-linux-gnu llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz' - artifact_name: 'wasmer-linux-amd64' - cross_compilation_artifact_name: 'cross_compiled_from_linux' run_test: true run_test_capi: true run_integration_tests: true use_sccache: true - build: macos-x64 os: macos-11 + target: x86_64-apple-darwin llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz' - artifact_name: 'wasmer-darwin-amd64' - cross_compilation_artifact_name: 'cross_compiled_from_mac' run_test: true run_test_capi: true use_sccache: true @@ -62,24 +60,22 @@ jobs: - build: macos-arm64 os: macos-11.0 target: aarch64-apple-darwin - artifact_name: 'wasmer-darwin-arm64' use_sccache: true run_test: false run_test_capi: false - build: windows-x64 os: windows-2019 + target: x86_64-pc-windows-msvc # llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/windows-amd64.tar.gz' llvm_choco_version: 13.0.0 - artifact_name: 'wasmer-windows-amd64' - cross_compilation_artifact_name: 'cross_compiled_from_win' run_integration_tests: true use_sccache: true run_test: true run_test_capi: false # We can't run yet the capi tests on Windows - build: linux-musl-x64 + target: x86_64-unknown-linux-musl os: ubuntu-latest container: alpine:latest - artifact_name: 'wasmer-linux-musl-amd64' run_test: true run_test_capi: false # It can't run the capi tests because of a cc linker issue (`wasm_engine_new` is redefined) run_integration_tests: false @@ -88,7 +84,6 @@ jobs: env: SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} - TARGET: ${{ matrix.target }} steps: - uses: actions/checkout@v2 - name: Set up libstdc++ on Linux @@ -199,246 +194,29 @@ jobs: echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV shell: bash - name: Test + if: matrix.run_test && matrix.target != 'x86_64-pc-windows-msvc' run: | make test - if: matrix.run_test + env: + TARGET: ${{ matrix.target }} + TARGET_DIR: target/${{ matrix.target }}/release + CARGO_TARGET: --target ${{ matrix.target }} - name: Test C API + if: matrix.run_test_capi && matrix.target != 'x86_64-pc-windows-msvc' run: | make test-capi - if: matrix.run_test_capi - - name: Build C API - run: | - make build-capi - - name: Build Wasmer binary - run: | - make build-wasmer - - name: Build Wapm binary - if: needs.setup.outputs.DOING_RELEASE == '1' - run: | - make build-wapm - - name: Install Nightly Rust for Headless - uses: actions-rs/toolchain@v1 - with: - toolchain: 'nightly-2022-02-08' - target: ${{ matrix.target }} - override: true - components: "rust-src" - - name: Build Minimal Wasmer Headless - if: matrix.build != 'linux-musl-x64' - run: | - cargo install xargo - echo "" >> Cargo.toml - echo "[profile.release]" >> Cargo.toml - echo "opt-level = 'z'" >> Cargo.toml - echo "debug = false" >> Cargo.toml - echo "debug-assertions = false" >> Cargo.toml - echo "overflow-checks = false" >> Cargo.toml - echo "lto = true" >> Cargo.toml - echo "panic = 'abort'" >> Cargo.toml - echo "incremental = false" >> Cargo.toml - echo "codegen-units = 1" >> Cargo.toml - echo "rpath = false" >> Cargo.toml - make build-wasmer-headless-minimal - - name: Dist - if: matrix.build != 'macos-arm64' - run: | - make distribution - - name: Dist macos-arm64 - if: matrix.build == 'macos-arm64' - run: | - make distribution env: - TARGET: aarch64-apple-darwin - TARGET_DIR: target/aarch64-apple-darwin/release - - name: Run integration tests (Windows) - shell: cmd - run: | - call refreshenv - set WASMER_DIR=%CD%\package - make test-integration - if: matrix.run_integration_tests && matrix.os == 'windows-2019' - - name: Run integration tests (Unix) - run: | - export WASMER_DIR=`pwd`/package - make test-integration - if: matrix.run_integration_tests && matrix.os != 'windows-2019' - - name: Run iOS integration tests - run: | - rustup target add aarch64-apple-ios x86_64-apple-ios - cargo install cargo-lipo - make test-integration-ios - if: matrix.run_ios_tests - - name: Cross compile from Linux - if: matrix.build == 'linux-x64' - shell: bash - run: | - ls target/release - alias wasmer=target/release/wasmer - ./target/release/wasmer compile --target=x86_64-apple-darwin lib/c-api/examples/assets/qjs.wasm -o qjs_mac_from_linux.wjit - #./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/examples/assets/qjs.wasm -o qjs_win_from_linux.wjit - mkdir cross - cp qjs_mac_from_linux.wjit cross - #cp qjs_win_from_linux.wjit cross - cp target/release/wasmer cross - - name: Cross compile from Mac - if: matrix.os == 'macos-11' - shell: bash - run: | - ls target/release - alias wasmer=target/release/wasmer - ./target/release/wasmer compile --target=x86_64-unknown-linux-gnu lib/c-api/examples/assets/qjs.wasm -o qjs_linux_from_mac.wjit - #./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/examples/assets/qjs.wasm -o qjs_win_from_mac.wjit - mkdir cross - cp qjs_linux_from_mac.wjit cross - #cp qjs_win_from_mac.wjit cross - cp target/release/wasmer cross - #- name: Cross compile from Windows - # if: matrix.os == 'windows-2019' - # shell: bash - # run: | - # alias wasmer=target/release/wasmer - # ./target/release/wasmer compile --target=x86_64-unknown-linux-gnu tests/integration/cli/assets/qjs.wasm -o qjs_linux_from_win.wjit - # ./target/release/wasmer compile --target=x86_64-apple-darwin tests/integration/cli/assets/qjs.wasm -o qjs_mac_from_win.wjit - # mkdir cross - # cp qjs_linux_from_win.wjit cross - # cp qjs_mac_from_win.wjit cross - # cp target/release/wasmer.exe cross - - name: Upload Cross Compiled Artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.cross_compilation_artifact_name }} - path: cross - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.artifact_name }} - path: dist - if-no-files-found: error - retention-days: 1 - - test-cross-compile-on-linux: - name: Test cross-compile on linux - needs: [setup, test] - runs-on: ubuntu-latest - steps: - - name: Download Wasmer - uses: actions/download-artifact@v2 - with: - path: artifacts - - name: Run it + TARGET: ${{ matrix.target }} + TARGET_DIR: target/${{ matrix.target }}/release + CARGO_TARGET: --target ${{ matrix.target }} + - name: Test + if: matrix.run_test && matrix.target == 'x86_64-pc-windows-msvc' run: | - cp artifacts/cross_compiled_from_linux/wasmer . - chmod +x wasmer - OUTPUT=$(./wasmer run artifacts/cross_compiled_from_mac/qjs_linux_from_mac.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));") - [[ "$OUTPUT" == '"Hello, World"' ]] - #wasmer run artifacts/cross/cross_compiled_from_win/qjs_linux_from_win.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));" - - test-cross-compile-on-mac: - name: Test cross-compile on macos - needs: [setup, test] - runs-on: macos-11 - steps: - - name: Download Wasmer - uses: actions/download-artifact@v2 - with: - path: artifacts - - name: Run it + make test + - name: Test C API + if: matrix.run_test_capi && matrix.target == 'x86_64-pc-windows-msvc' run: | - cp artifacts/cross_compiled_from_mac/wasmer . - chmod +x wasmer - OUTPUT=$(./wasmer run artifacts/cross_compiled_from_linux/qjs_mac_from_linux.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));") - [[ "$OUTPUT" == '"Hello, World"' ]] - #wasmer run artifacts/cross/cross_compiled_from_win/qjs_mac_from_win.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));" - - #test-cross-compile-on-win: - # needs: [setup, test] - # runs-on: windows-2019 - # steps: - # - name: Download Wasmer - # uses: actions/download-artifact@v2 - # with: - # path: artifacts - # - name: Run it - # shell: bash - # run: | - # alias wasmer=artifacts/cross/cross_compiled_from_win/wasmer.exe - # wasmer run artifacts/cross/cross_compiled_from_linux/win_from_linux.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));" - # wasmer run artifacts/cross/cross_compiled_from_mac/win_from_mac.wjit -- --eval "function greet(name) { return JSON.stringify('Hello, ' + name); }; print(greet('World'));" - - release: - needs: [setup, test, test-cross-compile-on-linux, test-cross-compile-on-mac] #, test-cross-compile-on-win] - runs-on: ubuntu-latest - if: needs.setup.outputs.DOING_RELEASE == '1' - steps: - - name: Download the Artifacts - uses: actions/download-artifact@v2 - with: - path: artifacts - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ needs.setup.outputs.VERSION }} - release_name: Release ${{ needs.setup.outputs.VERSION }} - draft: true - prerelease: false - - name: Upload Release Asset Windows Installer - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-windows-amd64/WasmerInstaller.exe - asset_name: wasmer-windows.exe - asset_content_type: application/vnd.microsoft.portable-executable - - name: Upload Release Asset Windows - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-windows-amd64/wasmer.tar.gz - asset_name: wasmer-windows-amd64.tar.gz - asset_content_type: application/gzip - - name: Upload Release Asset Linux amd64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-linux-amd64/wasmer.tar.gz - asset_name: wasmer-linux-amd64.tar.gz - asset_content_type: application/gzip - - name: Upload Release Asset Linux amd64 (musl) - id: upload-release-asset-linux-musl-amd64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-linux-musl-amd64/wasmer.tar.gz - asset_name: wasmer-linux-musl-amd64.tar.gz - asset_content_type: application/gzip - - name: Upload Release Asset Mac amd64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-darwin-amd64/wasmer.tar.gz - asset_name: wasmer-darwin-amd64.tar.gz - asset_content_type: application/gzip - - name: Upload Release Asset Mac arm64 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: artifacts/wasmer-darwin-arm64/wasmer.tar.gz - asset_name: wasmer-darwin-arm64.tar.gz - asset_content_type: application/gzip + make test-capi audit: name: Audit diff --git a/CHANGELOG.md b/CHANGELOG.md index 392387994c9..b384f3c6738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ## **Unreleased** +### Added +- [#2862](https://github.com/wasmerio/wasmer/pull/2862) Added CI builds for linux-aarch64 target. + ### Changed - #2864 wasmer-cli: remove wasi-experimental-io-devices from default builds