mirror of
https://github.com/wasmerio/wasmer.git
synced 2025-09-07 01:14:53 +00:00

See https://github.com/wasmerio/wasmer/issues/2822 For some reason these libraries get linked into the final release binary, which should not be the default (since these dependencies are only needed for the experimental-io extension).
247 lines
8.7 KiB
YAML
247 lines
8.7 KiB
YAML
name: Runtime tests
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'staging'
|
|
- 'trying'
|
|
paths:
|
|
- 'lib/**'
|
|
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]+*'
|
|
pull_request:
|
|
paths:
|
|
- 'lib/**'
|
|
|
|
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
|
|
|
|
test:
|
|
name: Test on ${{ matrix.build }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: setup
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
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'
|
|
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'
|
|
run_test: true
|
|
run_test_capi: true
|
|
use_sccache: true
|
|
run_integration_tests: true
|
|
run_ios_tests: true
|
|
- build: macos-arm64
|
|
os: macos-11.0
|
|
target: aarch64-apple-darwin
|
|
use_sccache: true
|
|
run_test: false
|
|
run_test_capi: false
|
|
- build: windows-x64
|
|
os: windows-2019
|
|
#target: x86_64-pc-windows-msvc commented because of bug in rust setup action
|
|
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/windows-amd64.tar.gz'
|
|
llvm_choco_version: 13.0.0
|
|
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
|
|
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
|
|
use_sccache: false
|
|
container: ${{ matrix.container }}
|
|
env:
|
|
SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob
|
|
SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
|
|
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: Set up base deps on musl
|
|
if: matrix.build == 'linux-musl-x64'
|
|
run: |
|
|
apk add build-base bash musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++
|
|
- 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: Test
|
|
if: matrix.run_test && matrix.os != 'windows-2019'
|
|
run: |
|
|
make 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.os != 'windows-2019'
|
|
run: |
|
|
make test-capi
|
|
env:
|
|
TARGET: ${{ matrix.target }}
|
|
TARGET_DIR: target/${{ matrix.target }}/release
|
|
CARGO_TARGET: --target ${{ matrix.target }}
|
|
- name: Test
|
|
if: matrix.run_test && matrix.os == 'windows-2019'
|
|
run: |
|
|
make test
|
|
- name: Test C API
|
|
if: matrix.run_test_capi && matrix.os == 'windows-2019'
|
|
run: |
|
|
make test-capi
|
|
|
|
audit:
|
|
name: Audit
|
|
env:
|
|
CARGO_AUDIT_VERSION: 0.16.0
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/cache@master
|
|
with:
|
|
path: ${{ runner.tool_cache }}/cargo-audit
|
|
key: cargo-audit-bin-${{ env.CARGO_AUDIT_VERSION }}
|
|
- run: |
|
|
echo "'${{ runner.tool_cache }}/cargo-audit/bin'" >> $GITHUB_PATH
|
|
- run: |
|
|
cargo install cargo-audit --version ${{ env.CARGO_AUDIT_VERSION }} --root '${{ runner.tool_cache }}/cargo-audit'
|
|
cargo audit
|
|
|
|
test-wasm-build:
|
|
name: Test wasm build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: |
|
|
rustup target add wasm32-wasi
|
|
make build-wasmer-wasm
|