diff --git a/.github/workflows/builds_and_tests.yml b/.github/workflows/builds_and_tests.yml new file mode 100644 index 000000000..806045bd7 --- /dev/null +++ b/.github/workflows/builds_and_tests.yml @@ -0,0 +1,105 @@ +name: Builds and Tests + +on: [pull_request] + +jobs: + sanity: + runs-on: ubuntu-latest + steps: + - name: Install Git + run: sudo apt install -y git + - name: Git config + run: git config --global url."https://${{ secrets.ACCESS_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.50.0 + target: wasm32-unknown-unknown + profile: minimal + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Cache cargo + uses: actions/cache@v2 + with: + path: ~/.cargo + key: cargocache-v2-sanity-rust:1.50.0-${{ hashFiles('Cargo.lock') }} + - name: Install shellcheck + run: sudo apt install shellcheck + - name: Show version information + run: rustc --version; cargo --version; rustup --version + - name: Add Rust components + run: rustup component add clippy rustfmt + - name: Check formatting + run: cargo fmt -- --check + - name: Run linter + run: cargo clippy -- -D warnings + - name: Run unit tests + run: cargo test + - name: Build docs + run: cargo doc --no-deps + - name: Test docs + run: | + sed -i '/^crate-type = \["cdylib"\]/d' Cargo.toml + cargo test --doc + - name: Run shellcheck + run: find . -name "*.sh" -exec shellcheck {} + + + build_shared_library: + runs-on: ubuntu-latest + steps: + - name: Install Git + run: sudo apt install -y git + - name: Git config + run: git config --global url."https://${{ secrets.ACCESS_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.50.0 + target: wasm32-unknown-unknown + profile: minimal + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Cache cargo + uses: actions/cache@v2 + with: + path: ~/.cargo + key: cargocache-v2-build_shared_library-rust:1.50.0-${{ hashFiles('Cargo.lock') }} + - name: Show version information + run: rustc --version; cargo --version; rustup --version + - name: Create release build of libwasmvm + run: make build-rust + - name: Upload libwasmvm + uses: actions/upload-artifact@v2 + with: + name: libwasmvm + path: ./api/libwasmvm.so + + test: + needs: build_shared_library + runs-on: ubuntu-latest + env: + GORACE: "halt_on_error=1" + BUILD_VERSION: $(echo $GITHUB_SHA | cut -c 1-10) + steps: + - name: set up + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + id: go + - name: Checkout + uses: actions/checkout@v2 + - name: Download libwasmvm + uses: actions/download-artifact@v2 + with: + name: libwasmvm + path: /tmp/builds + - name: Copy libwasmvm + run: cp /tmp/builds/libwasmvm.so ./api + - name: Go integration tests + run: make test + - name: Go tests with cgo and race condition safety checks + run: make test-safety + - name: Make build-go + run: make build-go