Skip to content

Commit

Permalink
[CI] Add cachepot
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Aug 22, 2024
1 parent d79c3d6 commit ad171a1
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 103 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/all_checks_osmosis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Test Tube (osmosis)

on:
workflow_call:
inputs:
unittest:
required: false
default: false
type: boolean
proptest:
required: false
default: false
type: boolean
store_deps:
required: false
default: false
type: boolean
workflow_dispatch:

env:
RUSTC_WRAPPER: cachepot

jobs:
test-tube:
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
id: restore-cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/cachepot
~/.cargo
~/go
smart-contracts/osmosis/**/target
key: ${{ runner.os }}-cargo-test3-osmosis-${{github.sha}}
restore-keys: ${{ runner.os }}-cargo-test3-osmosis
- name: Update PATH and RUSTC_WRAPPER
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install cachepot
run: test -e $HOME/.cargo/bin/cachepot && echo "cachepot found -- skipping install" || cargo install --git https://github.com/paritytech/cachepot
- name: Rust lint
run: cargo clippy --features test-tube --all-targets -- -D warnings
working-directory: smart-contracts/osmosis
- if: inputs.unittest
name: Unit tests
run: cargo unit-test
working-directory: smart-contracts/osmosis
- name: Build merkle-incentives
run: cargo test-tube-build
working-directory: smart-contracts/osmosis/contracts/merkle-incentives
- name: Test merkle-incentives
run: cargo test-tube
working-directory: smart-contracts/osmosis/contracts/merkle-incentives
- name: Build dex-router-osmosis
run: cargo test-tube-build
working-directory: smart-contracts/osmosis/contracts/dex-router-osmosis
- name: Test dex-router-osmosis
run: cargo test-tube
working-directory: smart-contracts/osmosis/contracts/dex-router-osmosis
- name: Build cl-vault
run: cargo test-tube-build
working-directory: smart-contracts/osmosis/contracts/cl-vault
- name: Test cl-vault
run: cargo test-tube
working-directory: smart-contracts/osmosis/contracts/cl-vault
- if: inputs.proptest
name: Run prop-test
run: cargo prop-test
env:
PROPTEST_CASES: 10
working-directory: smart-contracts/osmosis/contracts/cl-vault
- name: Store dependencies
if: inputs.store_deps
uses: actions/cache/save@v4
with:
path: |
~/.cache/cachepot
~/.cargo
~/go
smart-contracts/${{ inputs.workspace }}/**/target
key: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}-${{github.sha}}

20 changes: 17 additions & 3 deletions .github/workflows/cargo_build_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,29 @@ jobs:
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.cache/cachepot
~/.cargo
~/go
smart-contracts/${{ inputs.workspace }}/**/target
key: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}-${{github.sha}}
restore-keys: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}
- name: Install cachepot
run: test -e $HOME/.cargo/bin/cachepot && echo "cachepot found -- skipping install" || cargo install --git https://github.com/paritytech/cachepot
- name: Rust check
run: cargo check
run: cargo check --all-targets --features test-tube
working-directory: smart-contracts/${{ inputs.workspace }}
env:
RUSTC_WRAPPER: cachepot
- name: Store dependencies
uses: actions/cache/save@v4
with:
path: |
~/.cache/cachepot
~/.cargo
~/go
smart-contracts/${{ inputs.workspace }}/**/target
key: ${{ runner.os }}-cargo-${{ inputs.workspace }}-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo-${{ inputs.workspace }}
key: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}-${{github.sha}}
16 changes: 0 additions & 16 deletions .github/workflows/cargo_build_cache_osmosis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/cl_vault_osmosis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
push:
branches:
- main
- feat/cachepot-ci
paths:
- 'smart-contracts/osmosis/contracts/cl-vault/Cargo.toml'
- 'smart-contracts/osmosis/contracts/cl-vault/**.rs'
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/rust_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
default: true
type: boolean

env:
RUSTC_WRAPPER: "cachepot"

jobs:
checks:
runs-on: ubuntu-latest
Expand All @@ -26,18 +29,24 @@ jobs:
uses: actions/cache/restore@v4
with:
path: |
~/.cache/cachepot
~/.cargo
~/go
smart-contracts/${{ inputs.workspace }}/**/target
key: ${{ runner.os }}-cargo-${{ inputs.workspace }}-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo-${{ inputs.workspace }}
key: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}-${{github.sha}}
restore-keys: ${{ runner.os }}-cargo-test3-${{ inputs.workspace }}
- name: Update PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# - name: Rust lint
# run: cargo lint
# working-directory: smart-contracts/${{ inputs.workspace }}/${{ inputs.target }}
- name: Rust lint
run: cargo lint
working-directory: smart-contracts/${{ inputs.workspace }}/${{ inputs.target }}
run: cargo clippy --features test-tube --all-targets -- -D warnings
working-directory: smart-contracts/osmosis
- name: Rust format check
run: cargo fmt --all -- --check
working-directory: smart-contracts/${{ inputs.workspace }}/${{ inputs.target }}
- name: Run unit-tests
if: inputs.unit_tests
- if: inputs.unit_tests
name: Run unit-tests
run: cargo unit-test
working-directory: smart-contracts/${{ inputs.workspace }}/${{ inputs.target }}
44 changes: 44 additions & 0 deletions .github/workflows/test_tube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test Tube (osmosis)

on:
pull_request:
branches:
- main
paths:
- 'smart-contracts/osmosis/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/osmosis/contracts/dex-router-osmosis/**.rs'
- 'smart-contracts/osmosis/contracts/cl-vault/Cargo.toml'
- 'smart-contracts/osmosis/contracts/cl-vault/**.rs'
- 'smart-contracts/osmosis/contracts/merkle-incentives/Cargo.toml'
- 'smart-contracts/osmosis/contracts/merkle-incentives/**.rs'
- '.github/workflows/dex_router_osmosis.yml'
- '.github/workflows/cl_vault_osmosis.yml'
- '.github/workflows/merkle_incentives_osmosis.yml'
- '.github/workflows/test_tube_osmosis.yml'
push:
branches:
- main
paths:
- 'smart-contracts/osmosis/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/osmosis/contracts/dex-router-osmosis/**.rs'
- 'smart-contracts/osmosis/contracts/cl-vault/Cargo.toml'
- 'smart-contracts/osmosis/contracts/cl-vault/**.rs'
- 'smart-contracts/osmosis/contracts/merkle-incentives/Cargo.toml'
- 'smart-contracts/osmosis/contracts/merkle-incentives/**.rs'
- '.github/workflows/dex_router_osmosis.yml'
- '.github/workflows/cl_vault_osmosis.yml'
- '.github/workflows/merkle_incentives_osmosis.yml'
- '.github/workflows/test_tube_osmosis.yml'
workflow_dispatch:

jobs:
post-merge:
uses: ./.github/workflows/all_checks_osmosis.yml
if: github.event_name == 'push'
with:
unittest: true
proptest: true
store_deps: true
pre-commit:
uses: ./.github/workflows/all_checks_osmosis.yml
if: github.event_name == 'pull_request'
78 changes: 0 additions & 78 deletions .github/workflows/test_tube_osmosis.yml

This file was deleted.

0 comments on commit ad171a1

Please sign in to comment.