diff --git a/.codecov.yml b/.codecov.yml index 9a3b811..b1a7177 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -13,4 +13,4 @@ coverage: enabled: no ignore: - "contracts/loyalty/.*" - - "test/.*" + - "unit-tests" diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 594f97b..1093af0 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -1,8 +1,7 @@ -# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml +name: Compile Lint and Coverage -on: [pull_request] - -name: Basic +on: + pull_request: jobs: compile: @@ -25,28 +24,6 @@ jobs: with: command: wasm args: --locked - env: - RUSTFLAGS: "-C link-arg=-s" - - coverage: - name: Coverage - runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:0.24.0 - options: --security-opt seccomp=unconfined - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Generate code coverage - run: | - cargo tarpaulin --verbose --workspace --timeout 120 --out Xml - - - name: Upload to codecov.io - uses: codecov/codecov-action@v2 - with: - token: ${{secrets.CODECOV_TOKEN}} - fail_ci_if_error: true lint: name: Lint @@ -63,26 +40,19 @@ jobs: override: true components: rustfmt, clippy + - uses: extractions/setup-just@v1 + - name: Run cargo doc uses: actions-rs/cargo@v1 with: command: doc - args: -F library - - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + args: -F library --no-deps - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: just lint - name: Generate Schema - run: sh scripts/schema.sh + run: just schema - name: Schema Changes # fails if any changes not committed @@ -93,3 +63,23 @@ jobs: git status && git --no-pager diff exit 1 fi + + coverage: + name: Coverage + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:0.24.0 + options: --security-opt seccomp=unconfined + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Generate code coverage + run: | + cargo tarpaulin --verbose --workspace --timeout 120 --out Xml --exclude unit-tests + + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 + with: + token: ${{secrets.CODECOV_TOKEN}} + fail_ci_if_error: true diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..fd0c5c4 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,43 @@ +name: E2E Integration Tests + +on: + pull_request: + +jobs: + test: + name: E2E tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install latest nightly toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + targets: wasm32-unknown-unknown + + - name: Rust Dependencies Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + artifacts/ + key: ${{ runner.os }}-cargo-with-artifacts-${{ hashFiles('**/Cargo.lock') }} + + - uses: extractions/setup-just@v1 + + - name: Download artifacts + run: just download-artifacts + + - name: Optimize contracts + run: just optimize + + - name: Run local stargaze chain + run: just deploy-local + + - name: Run e2e tests + run: just e2e-test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index bdb73bd..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release Wasm - -on: - release: - types: [created] - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install cargo-run-script - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-run-script - - name: Run cargo optimize - uses: actions-rs/cargo@v1 - with: - command: run-script - args: optimize - - name: Get release ID - id: get_release - uses: bruceadams/get-release@v1.2.3 - env: - GITHUB_TOKEN: ${{ github.token }} - - name: Upload optimized wasm - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./artifacts/*.wasm - tag: ${{ github.ref }} - overwrite: true - file_glob: true diff --git a/contracts/fair-burn/Cargo.toml b/contracts/fair-burn/Cargo.toml index 1d909a5..5890227 100644 --- a/contracts/fair-burn/Cargo.toml +++ b/contracts/fair-burn/Cargo.toml @@ -20,6 +20,11 @@ exclude = [ [lib] crate-type = ["cdylib", "rlib"] +[[bin]] +name = "schema" +path = "src/bin/schema.rs" +doc = false + [features] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] diff --git a/contracts/royalty-registry/Cargo.toml b/contracts/royalty-registry/Cargo.toml index 300fa53..f338a47 100644 --- a/contracts/royalty-registry/Cargo.toml +++ b/contracts/royalty-registry/Cargo.toml @@ -20,13 +20,17 @@ exclude = [ [lib] crate-type = ["cdylib", "rlib"] +[[bin]] +name = "schema" +path = "src/bin/schema.rs" +doc = false + [features] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] - [dependencies] sg-marketplace-common = { workspace = true } sg-index-query = { workspace = true }