This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
Update most dependencies #452
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests and release builds | |
env: | |
RUST_BACKTRACE: 1 | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Make release' | |
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 | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
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 'v[0-9]\+\.[0-9]\+\.[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: | |
build: [linux, macos-x86_64, macos-aarch64, windows] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
artifact_name: 'wapm-linux-amd64' | |
- build: macos-x86_64 | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
artifact_name: 'wapm-darwin-amd64' | |
- build: macos-aarch64 | |
os: macos-latest | |
rust: stable | |
target: aarch64-apple-darwin | |
artifact_name: 'wapm-darwin-aarch64' | |
- build: windows | |
os: windows-latest | |
rust: stable | |
artifact_name: 'wapm-windows-amd64' | |
#- build: linux-musl-x64 | |
# os: ubuntu-latest | |
# container: alpine:latest | |
# rust: stable | |
# artifact_name: 'wapm-linux-musl-amd64' | |
# env: | |
# CARGO_SCCACHE_VERSION: 0.2.10 | |
# SCCACHE_AZURE_BLOB_CONTAINER: ${{ secrets.SCCACHE_AZURE_BLOB_CONTAINER }} | |
# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust ${{ matrix.rust }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
override: true | |
- name: Configure cargo data directory | |
# After this point, all cargo registry and crate data is stored in | |
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files | |
# that are needed during the build process. Additionally, this works | |
# around a bug in the 'cache' action that causes directories outside of | |
# the workspace dir to be saved/restored incorrectly. | |
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV | |
# - name: Install sccache | |
# run: | | |
# echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" | |
# cargo install sccache --version ${{ env.CARGO_SCCACHE_VERSION }} --root ${{ runner.tool_cache }}/cargo-sccache | |
# - name: Start sccache | |
# run: | | |
# ${{ runner.tool_cache }}/cargo-sccache/bin/sccache --start-server | |
# ${{ runner.tool_cache }}/cargo-sccache/bin/sscache -s | |
# echo "::set-env name=RUSTC_WRAPPER::${{ runner.tool_cache }}/cargo-sccache/bin/sccache" | |
- name: Setup Rust target | |
if: matrix.target | |
run: | | |
mkdir -p .cargo | |
cat << EOF > .cargo/config.toml | |
[build] | |
target = "${{ matrix.target }}" | |
EOF | |
#- 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 Cmake (Windows) | |
if: matrix.os == 'windows-latest' | |
run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' | |
- name: Install cmake (macOS) | |
if: matrix.target == 'x86_64-apple-darwin' | |
shell: bash | |
run: | | |
set -ex | |
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz | |
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz | |
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin" | |
export PATH=$CMAKE_BIN_PATH:$PATH | |
- name: Install cmake (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz | |
tar xf cmake-3.4.1-Linux-x86_64.tar.gz | |
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Linux-x86_64/CMake.app/Contents/bin" | |
export PATH=$CMAKE_BIN_PATH:$PATH | |
- name: Tests | |
if: matrix.target != 'aarch64-apple-darwin' | |
run: | | |
cargo test --verbose --features "update-notifications" -- --test-threads=1 | |
- name: Integration Tests | |
if: matrix.target != 'aarch64-apple-darwin' | |
run: | | |
make integration-tests | |
- name: Tests (Wasm Interface) | |
if: matrix.target != 'aarch64-apple-darwin' | |
run: | | |
cargo test --manifest-path lib/wasm-interface/Cargo.toml | |
- name: Check | |
if: matrix.target != 'aarch64-apple-darwin' | |
run: | | |
cargo check --features "telemetry update-notifications" | |
- name: Build binary | |
run: | | |
make release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: dist/wapm-cli.tar.gz | |
if-no-files-found: error | |
retention-days: 3 | |
# - name: Cache | |
# uses: actions/cache@master | |
# with: | |
# # Note: crates from the git repo always get rebuilt | |
# # so we cache only those subdirectories of target/{debug|release} that | |
# # contain the build output for crates that come from the registry. | |
# path: |- | |
# .cargo_home | |
# target/*/.* | |
# target/*/build | |
# target/*/deps | |
# key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }} | |
# restore-keys: | | |
# ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }} | |
- name: Release wapm-toml to crates.io | |
if: (needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != '') && matrix.os == 'ubuntu-latest' | |
continue-on-error: true | |
run: | | |
cargo publish --allow-dirty --manifest-path="wapm-toml/Cargo.toml" --token ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Release to crates.io | |
if: (needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != '') && matrix.os == 'ubuntu-latest' | |
continue-on-error: true | |
run: | | |
cargo publish --allow-dirty --token ${{ secrets.CRATES_IO_TOKEN }} | |
regression_tests: | |
strategy: | |
fail-fast: false | |
needs: [setup, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Wasmer | |
run: | | |
curl https://get.wasmer.io -sSfL | sh | |
- name: Download the Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: Set up for tests | |
run: | | |
rm -f /home/runner/.wasmer/bin/wapm | |
tar -xzf `pwd`/artifacts/wapm-linux-amd64/wapm-cli.tar.gz | |
cp ./bin/wapm /home/runner/.wasmer/bin/wapm | |
chmod +x /home/runner/.wasmer/bin/wapm | |
- name: 'Regression test: multi-part-uploading works' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/chunked-upload.sh | |
./end-to-end-tests/ci/chunked-upload.sh | |
env: | |
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} | |
WAPM_DEV_USERNAME: ${{ secrets.WAPM_DEV_USERNAME }} | |
- name: 'Regression test: direct execution works' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/direct-execution.sh | |
./end-to-end-tests/ci/direct-execution.sh | |
- name: 'Regression test: Install, Uninstall, Run, and List' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/install.sh | |
./end-to-end-tests/ci/install.sh | |
- name: 'Regression test: verification and public key management' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/verification.sh | |
./end-to-end-tests/ci/verification.sh | |
# - name: 'Regression test: pkg_fs works globally and when installed locally' | |
# shell: bash | |
# run: | | |
# chmod +x end-to-end-tests/ci/package-fs-mapping.sh | |
# ./end-to-end-tests/ci/package-fs-mapping.sh | |
- name: 'Regression test: manifest validation rejects invalid manifests' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/manifest-validation.sh | |
./end-to-end-tests/ci/manifest-validation.sh | |
- name: 'Regression test: package fs and command rename' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/validate-global.sh | |
./end-to-end-tests/ci/validate-global.sh | |
- name: 'Regression test: Init a Manifest and Add some dependencies' | |
shell: bash | |
run: | | |
chmod +x end-to-end-tests/ci/init-and-add.sh | |
./end-to-end-tests/ci/init-and-add.sh | |
env: | |
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }} | |
WAPM_DEV_USERNAME: ${{ secrets.WAPM_DEV_USERNAME }} | |
linux_aarch64: | |
name: Linux aarch64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.59 | |
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 wapm binary | |
run: | | |
make release | |
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: --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: 'wapm-linux-aarch64' | |
path: dist/wapm-cli.tar.gz | |
if-no-files-found: error | |
retention-days: 2 | |
release: | |
needs: [setup, test, linux_aarch64] #, regression_tests] | |
runs-on: ubuntu-latest | |
if: needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != '' | |
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 | |
id: upload-release-asset-windows-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/wapm-windows-amd64/wapm-cli.tar.gz | |
asset_name: wapm-cli-windows-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Linux amd64 | |
id: 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/wapm-linux-amd64/wapm-cli.tar.gz | |
asset_name: wapm-cli-linux-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Linux aarch64 | |
id: 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/wapm-linux-aarch64/wapm-cli.tar.gz | |
asset_name: wapm-cli-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/wapm-linux-musl-amd64/wapm-cli.tar.gz | |
# asset_name: wapm-cli-linux-musl-amd64.tar.gz | |
# asset_content_type: application/gzip | |
- name: Upload Release Asset Mac amd64 | |
id: upload-release-asset-mac-darwin-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/wapm-darwin-amd64/wapm-cli.tar.gz | |
asset_name: wapm-cli-darwin-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Release Asset Mac aarch64 | |
id: upload-release-asset-mac-darwin-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/wapm-darwin-aarch64/wapm-cli.tar.gz | |
asset_name: wapm-cli-darwin-aarch64.tar.gz | |
asset_content_type: application/gzip | |
lints: | |
name: Linting and Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Rust Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Check Formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all --verbose --check | |
- name: Clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --workspace --verbose -- -D warnings |