From fb007a64835c0d74de040eb51c1d33f2a4b49a54 Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:14:51 +0200 Subject: [PATCH 1/5] [CI] Skip go linter and tests for smart contract changes --- .github/workflows/{build.yml => build_go.yml} | 2 +- .github/workflows/lint_go.yml | 6 +++++- .github/workflows/test_go.yml | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) rename .github/workflows/{build.yml => build_go.yml} (98%) diff --git a/.github/workflows/build.yml b/.github/workflows/build_go.yml similarity index 98% rename from .github/workflows/build.yml rename to .github/workflows/build_go.yml index fbf6d1382..055ca7d3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build_go.yml @@ -1,4 +1,4 @@ -name: Build Quasar (Go) +name: Build (Go) on: pull_request: diff --git a/.github/workflows/lint_go.yml b/.github/workflows/lint_go.yml index 076b03136..2e51950cf 100644 --- a/.github/workflows/lint_go.yml +++ b/.github/workflows/lint_go.yml @@ -1,12 +1,16 @@ -name: Lint Quasar code +name: Lint (Go) on: pull_request: branches: - main + paths-ignore: + - 'smart-contracts/**' push: branches: - main + paths-ignore: + - 'smart-contracts/**' workflow_dispatch: concurrency: diff --git a/.github/workflows/test_go.yml b/.github/workflows/test_go.yml index 9c7e46915..d557a238c 100644 --- a/.github/workflows/test_go.yml +++ b/.github/workflows/test_go.yml @@ -1,12 +1,16 @@ -name: Test Quasar +name: Test (Go) on: pull_request: branches: - main + paths-ignore: + - 'smart-contracts/**' push: branches: - main + paths-ignore: + - 'smart-contracts/**' workflow_dispatch: concurrency: From 739543e0e1c5b9275731e8c97596b10395672abd Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:11:48 +0200 Subject: [PATCH 2/5] Further restrict workflow triggers --- .github/workflows/build_go.yml | 2 ++ .github/workflows/cl_vault.yml | 3 ++- .github/workflows/dex_router_osmosis.yml | 3 ++- .github/workflows/lint_go.yml | 2 ++ .github/workflows/lst_adapter_osmosis.yml | 3 ++- .github/workflows/lst_dex_adapter_osmosis.yml | 3 ++- .github/workflows/merkle_incentives.yml | 3 ++- .github/workflows/range_middleware.yml | 3 ++- .github/workflows/test_go.yml | 2 ++ .github/workflows/token_burner.yml | 3 ++- 10 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_go.yml b/.github/workflows/build_go.yml index 055ca7d3a..8aaf912b3 100644 --- a/.github/workflows/build_go.yml +++ b/.github/workflows/build_go.yml @@ -7,12 +7,14 @@ on: - fix/* paths-ignore: - 'smart-contracts/**' + - '**.md' push: branches: - main - fix/* paths-ignore: - 'smart-contracts/**' + - '**.md' workflow_dispatch: concurrency: diff --git a/.github/workflows/cl_vault.yml b/.github/workflows/cl_vault.yml index a622be662..ac2b3407d 100644 --- a/.github/workflows/cl_vault.yml +++ b/.github/workflows/cl_vault.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/cl-vault/**' + - 'smart-contracts/contracts/cl-vault/Cargo.toml' + - 'smart-contracts/contracts/cl-vault/**.rs' push: branches: - main diff --git a/.github/workflows/dex_router_osmosis.yml b/.github/workflows/dex_router_osmosis.yml index 03b819eb5..34c6f3dd4 100644 --- a/.github/workflows/dex_router_osmosis.yml +++ b/.github/workflows/dex_router_osmosis.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/dex-router-osmosis/**' + - 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml' + - 'smart-contracts/contracts/dex-router-osmosis/**.rs' push: branches: - main diff --git a/.github/workflows/lint_go.yml b/.github/workflows/lint_go.yml index 2e51950cf..06730d1e8 100644 --- a/.github/workflows/lint_go.yml +++ b/.github/workflows/lint_go.yml @@ -6,11 +6,13 @@ on: - main paths-ignore: - 'smart-contracts/**' + - '**.md' push: branches: - main paths-ignore: - 'smart-contracts/**' + - '**.md' workflow_dispatch: concurrency: diff --git a/.github/workflows/lst_adapter_osmosis.yml b/.github/workflows/lst_adapter_osmosis.yml index e663392bd..e6857540c 100644 --- a/.github/workflows/lst_adapter_osmosis.yml +++ b/.github/workflows/lst_adapter_osmosis.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/lst-adapter-osmosis/**' + - 'smart-contracts/contracts/lst-adapter-osmosis/Cargo.toml' + - 'smart-contracts/contracts/lst-adapter-osmosis/**.rs' push: branches: - main diff --git a/.github/workflows/lst_dex_adapter_osmosis.yml b/.github/workflows/lst_dex_adapter_osmosis.yml index 62dd4162a..df32af122 100644 --- a/.github/workflows/lst_dex_adapter_osmosis.yml +++ b/.github/workflows/lst_dex_adapter_osmosis.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/lst-dex-adapter-osmosis/**' + - 'smart-contracts/contracts/lst-dex-adapter-osmosis/Cargo.toml' + - 'smart-contracts/contracts/lst-dex-adapter-osmosis/**.rs' push: branches: - main diff --git a/.github/workflows/merkle_incentives.yml b/.github/workflows/merkle_incentives.yml index b59bb92f3..43a7b7814 100644 --- a/.github/workflows/merkle_incentives.yml +++ b/.github/workflows/merkle_incentives.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/merkle-incentives/**' + - 'smart-contracts/contracts/merkle-incentives/Cargo.toml' + - 'smart-contracts/contracts/merkle-incentives/**.rs' push: branches: - main diff --git a/.github/workflows/range_middleware.yml b/.github/workflows/range_middleware.yml index efa70d174..8c00b4f48 100644 --- a/.github/workflows/range_middleware.yml +++ b/.github/workflows/range_middleware.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/range-middleware/**' + - 'smart-contracts/contracts/range-middleware/Cargo.toml' + - 'smart-contracts/contracts/range-middleware/**.rs' push: branches: - main diff --git a/.github/workflows/test_go.yml b/.github/workflows/test_go.yml index d557a238c..8dd59c466 100644 --- a/.github/workflows/test_go.yml +++ b/.github/workflows/test_go.yml @@ -6,11 +6,13 @@ on: - main paths-ignore: - 'smart-contracts/**' + - '**.md' push: branches: - main paths-ignore: - 'smart-contracts/**' + - '**.md' workflow_dispatch: concurrency: diff --git a/.github/workflows/token_burner.yml b/.github/workflows/token_burner.yml index 4be264919..635f912e9 100644 --- a/.github/workflows/token_burner.yml +++ b/.github/workflows/token_burner.yml @@ -5,7 +5,8 @@ on: branches: - main paths: - - 'smart-contracts/contracts/token-burner/**' + - 'smart-contracts/contracts/token-burner/Cargo.toml' + - 'smart-contracts/contracts/token-burner/**.rs' push: branches: - main From 2fac7298b3c569c0d57fd5d23ef8eb7fcc89dfdc Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:47:16 +0200 Subject: [PATCH 3/5] Trigger cl-vault test-tube on dex-router-osmosis changes --- .github/workflows/cl_vault.yml | 31 +++++++++++++++++-- .github/workflows/rust_basic.yml | 4 +-- .github/workflows/rust_test_tube.yml | 14 +-------- smart-contracts/Cargo.lock | 1 + smart-contracts/contracts/cl-vault/Cargo.toml | 1 + 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cl_vault.yml b/.github/workflows/cl_vault.yml index ac2b3407d..82ab2e62f 100644 --- a/.github/workflows/cl_vault.yml +++ b/.github/workflows/cl_vault.yml @@ -7,6 +7,8 @@ on: paths: - 'smart-contracts/contracts/cl-vault/Cargo.toml' - 'smart-contracts/contracts/cl-vault/**.rs' + - 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml' + - 'smart-contracts/contracts/dex-router-osmosis/**.rs' push: branches: - main @@ -18,6 +20,29 @@ jobs: with: target: 'contracts/cl-vault' test-tube: - uses: ./.github/workflows/rust_test_tube.yml - with: - contract: 'cl-vault' + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Restore dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo + ~/go + **/target + key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo + - name: Build dex-router-osmosis + run: cargo test-tube-build + working-directory: smart-contracts/contracts/dex-router-osmosis + - name: Build cl-vault + run: cargo test-tube-build + working-directory: smart-contracts/contracts/cl-vault + - name: Run test-tube tests + run: cargo test-tube + env: + PROPTEST_CASES: 10 + working-directory: smart-contracts/contracts/cl-vault diff --git a/.github/workflows/rust_basic.yml b/.github/workflows/rust_basic.yml index b79ad1d9b..9627c22bc 100644 --- a/.github/workflows/rust_basic.yml +++ b/.github/workflows/rust_basic.yml @@ -17,8 +17,8 @@ jobs: uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | - **/**.rs - **/Cargo.lock + ${{inputs.contract}}/**.rs + ${{inputs.contract}}/Cargo.toml - name: Install Rust if: env.GIT_DIFF uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/rust_test_tube.yml b/.github/workflows/rust_test_tube.yml index eef3eabbc..9e0cfe096 100644 --- a/.github/workflows/rust_test_tube.yml +++ b/.github/workflows/rust_test_tube.yml @@ -13,17 +13,9 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v3 - - name: Get git diff - uses: technote-space/get-diff-action@v6.1.2 - with: - PATTERNS: | - **/**.rs - **/Cargo.lock - 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: | @@ -32,13 +24,9 @@ jobs: **/target key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo - - name: Build test-tube tests - if: env.GIT_DIFF + - name: Build ${{ inputs.contract }} run: cargo test-tube-build working-directory: smart-contracts/contracts/${{ inputs.contract }} - name: Run test-tube tests - if: env.GIT_DIFF run: cargo test-tube - env: - PROPTEST_CASES: 10 working-directory: smart-contracts/contracts/${{ inputs.contract }} diff --git a/smart-contracts/Cargo.lock b/smart-contracts/Cargo.lock index d0bdec7f8..35e9464e6 100644 --- a/smart-contracts/Cargo.lock +++ b/smart-contracts/Cargo.lock @@ -1726,6 +1726,7 @@ name = "cl-vault" version = "0.3.0" dependencies = [ "apollo-cw-asset", + "const_format", "cosmwasm-schema 1.5.4", "cosmwasm-std", "cw-storage-plus 1.2.0", diff --git a/smart-contracts/contracts/cl-vault/Cargo.toml b/smart-contracts/contracts/cl-vault/Cargo.toml index c5b53890b..31d353bb4 100644 --- a/smart-contracts/contracts/cl-vault/Cargo.toml +++ b/smart-contracts/contracts/cl-vault/Cargo.toml @@ -37,6 +37,7 @@ num_enum = { workspace = true } apollo-cw-asset = { workspace = true } dex-router-osmosis = {workspace = true} cw-vault-multi-standard = {git = "https://github.com/quasar-finance/cw-vault-standard", branch ="master", features = ["lockup", "force-unlock"]} +const_format = { workspace = true } [dev-dependencies] osmosis-test-tube = { workspace = true } From bdefce728cac273d54d4f30fedb8fa8e61c667b2 Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:00:07 +0200 Subject: [PATCH 4/5] remove test trigger --- smart-contracts/Cargo.lock | 1 - smart-contracts/contracts/cl-vault/Cargo.toml | 2 -- 2 files changed, 3 deletions(-) diff --git a/smart-contracts/Cargo.lock b/smart-contracts/Cargo.lock index 35e9464e6..d0bdec7f8 100644 --- a/smart-contracts/Cargo.lock +++ b/smart-contracts/Cargo.lock @@ -1726,7 +1726,6 @@ name = "cl-vault" version = "0.3.0" dependencies = [ "apollo-cw-asset", - "const_format", "cosmwasm-schema 1.5.4", "cosmwasm-std", "cw-storage-plus 1.2.0", diff --git a/smart-contracts/contracts/cl-vault/Cargo.toml b/smart-contracts/contracts/cl-vault/Cargo.toml index 31d353bb4..a1cd67dba 100644 --- a/smart-contracts/contracts/cl-vault/Cargo.toml +++ b/smart-contracts/contracts/cl-vault/Cargo.toml @@ -37,8 +37,6 @@ num_enum = { workspace = true } apollo-cw-asset = { workspace = true } dex-router-osmosis = {workspace = true} cw-vault-multi-standard = {git = "https://github.com/quasar-finance/cw-vault-standard", branch ="master", features = ["lockup", "force-unlock"]} -const_format = { workspace = true } - [dev-dependencies] osmosis-test-tube = { workspace = true } proptest = { workspace = true } From ee978cfa7444a2933fc34f6177cf48c86a019d6c Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:01:46 +0200 Subject: [PATCH 5/5] Add empty line back --- smart-contracts/contracts/cl-vault/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/smart-contracts/contracts/cl-vault/Cargo.toml b/smart-contracts/contracts/cl-vault/Cargo.toml index a1cd67dba..c5b53890b 100644 --- a/smart-contracts/contracts/cl-vault/Cargo.toml +++ b/smart-contracts/contracts/cl-vault/Cargo.toml @@ -37,6 +37,7 @@ num_enum = { workspace = true } apollo-cw-asset = { workspace = true } dex-router-osmosis = {workspace = true} cw-vault-multi-standard = {git = "https://github.com/quasar-finance/cw-vault-standard", branch ="master", features = ["lockup", "force-unlock"]} + [dev-dependencies] osmosis-test-tube = { workspace = true } proptest = { workspace = true }