-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Invoke unit-tests only for changed contracts (#663)
- Loading branch information
Showing
9 changed files
with
156 additions
and
44 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,18 @@ | ||
name: Test cl vault | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/cl-vault/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'cl-vault' |
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,18 @@ | ||
name: Test dex router (osmosis) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/dex-router-osmosis/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'dex-router-osmosis' |
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 |
---|---|---|
|
@@ -39,27 +39,4 @@ jobs: | |
run: go version | ||
- name: Go lint | ||
if: env.GIT_DIFF | ||
run: make lint | ||
lint-rust: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Get git diff | ||
uses: technote-space/[email protected] | ||
with: | ||
PATTERNS: | | ||
**/**.rs | ||
Makefile | ||
- name: Install Rust | ||
if: env.GIT_DIFF | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Show versions | ||
if: env.GIT_DIFF | ||
run: rustc -V && cargo -V | ||
- name: Rust lint | ||
if: env.GIT_DIFF | ||
run: cd smart-contracts && RUSTFLAGS="-Dwarnings" cargo clippy --workspace -- -D warnings --A deprecated | ||
- name: Rust format check | ||
if: env.GIT_DIFF | ||
run: cd smart-contracts && cargo fmt --all -- --check | ||
run: make lint |
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,18 @@ | ||
name: Test lst adapter (osmosis) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/lst-adapter-osmosis/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'lst-adapter-osmosis' |
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,18 @@ | ||
name: Test lst dex adapter (osmosis) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/lst-dex-adapter-osmosis/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'lst-dex-adapter-osmosis' |
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,18 @@ | ||
name: Test range middleware | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/range-middleware/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'range-middleware' |
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,46 @@ | ||
name: Unit Test (rust) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
contract: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Get git diff | ||
uses: technote-space/[email protected] | ||
with: | ||
PATTERNS: | | ||
**/**.rs | ||
**/Cargo.toml | ||
- name: Install Rust | ||
if: env.GIT_DIFF | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Restore dependencies | ||
if: env.GIT_DIFF | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo | ||
~/go | ||
**/target | ||
key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.toml') }} | ||
restore-keys: ${{ runner.os }}-cargo | ||
- name: Rust lint | ||
if: env.GIT_DIFF | ||
run: RUSTFLAGS="-Dwarnings" cargo clippy --workspace -- -D warnings --A deprecated | ||
working-directory: smart-contracts/contracts/${{ inputs.contract }} | ||
- name: Rust format check | ||
if: env.GIT_DIFF | ||
run: cargo fmt --all -- --check | ||
working-directory: smart-contracts/contracts/${{ inputs.contract }} | ||
- name: Run unit-tests | ||
if: env.GIT_DIFF | ||
run: cargo unit-test | ||
working-directory: smart-contracts/contracts/${{ inputs.contract }} |
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 |
---|---|---|
|
@@ -41,23 +41,4 @@ jobs: | |
run: make test-cover | ||
- name: Code coverage report | ||
if: env.GIT_DIFF | ||
uses: codecov/[email protected] | ||
test-rust: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Get git diff | ||
uses: technote-space/[email protected] | ||
with: | ||
PATTERNS: | | ||
**/**.rs | ||
- name: Install Rust | ||
if: env.GIT_DIFF | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install just via cargo | ||
if: env.GIT_DIFF | ||
run: cargo install just | ||
- name: Run unit-tests | ||
if: env.GIT_DIFF | ||
run: cd smart-contracts && cargo test --lib | ||
uses: codecov/[email protected] |
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,18 @@ | ||
name: Test token burner | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/token-burner/**' | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
contract: 'token-burner' |