Skip to content

Commit

Permalink
[CI] Add cachepot -- part 1: generate cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Aug 22, 2024
1 parent 0a5b5a8 commit 2441db6
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 97 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/all_checks_osmosis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Test Tube (osmosis)

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

env:
RUSTC_WRAPPER: cachepot
CARGO_TARGET_DIR: ~/target

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
~/target
key: ${{ runner.os }}-cargo-osmosis-${{github.sha}}
restore-keys: ${{ runner.os }}-cargo-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
env:
RUSTC_WRAPPER: ""
- name: Rust lint
run: cargo clippy --features test-tube --all-targets -- -D warnings
working-directory: smart-contracts/osmosis
- 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
~/target
key: ${{ runner.os }}-cargo-osmosis-${{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-${{ inputs.workspace }}-${{github.sha}}
restore-keys: ${{ runner.os }}-cargo-${{ 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-${{ inputs.workspace }}-${{github.sha}}
16 changes: 0 additions & 16 deletions .github/workflows/cargo_build_cache_osmosis.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/test_tube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test Tube (osmosis)

on:
pull_request:
branches:
- main
paths:
- 'smart-contracts/osmosis/**/Cargo.toml'
- 'smart-contracts/osmosis/**.rs'
- '.github/workflows/test_tube.yml'
- '.github/workflows/all_checks_osmosis.yml'
push:
branches:
- main
paths:
- 'smart-contracts/osmosis/**/Cargo.toml'
- 'smart-contracts/osmosis/**.rs'
- '.github/workflows/test_tube.yml'
- '.github/workflows/all_checks_osmosis.yml'
workflow_dispatch:

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

This file was deleted.

0 comments on commit 2441db6

Please sign in to comment.