forked from CosmWasm/wasmvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add github actions config (CosmWasm#21)
* ci: add github actions for test config * fix: remove working-directory * chore: rename workflow name
- Loading branch information
Showing
1 changed file
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |