Skip to content

Commit

Permalink
ci: add github actions config (CosmWasm#21)
Browse files Browse the repository at this point in the history
* ci: add github actions for test config

* fix: remove working-directory

* chore: rename workflow name
  • Loading branch information
shiki-tak authored May 28, 2021
1 parent 8f21765 commit f80c2bc
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/builds_and_tests.yml
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

0 comments on commit f80c2bc

Please sign in to comment.