-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
2,067 additions
and
2,440 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 |
---|---|---|
@@ -1,53 +1,71 @@ | ||
# Tests & Code Coverage workflow runs unit tests and uploads a code coverage report | ||
# This workflow is run on pushes to master & every Pull Requests where a .go, .mod, .sum have been changed | ||
|
||
name: Tests & Code Coverage | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- '**' | ||
- "**" | ||
|
||
jobs: | ||
|
||
should_run_test: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- | ||
id: skip_check | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
cancel_others: 'true' # workflow-runs from outdated commits will be cancelled. | ||
concurrent_skipping: 'same_content' | ||
skip_after_successful_duplicate: 'true' | ||
paths: '["**/*.go", "**/*.mod", "**/*.sum"]' | ||
cancel_others: "true" # workflow-runs from outdated commits will be cancelled. | ||
concurrent_skipping: "same_content" | ||
skip_after_successful_duplicate: "true" | ||
paths: '["**/*.go", "**/*.mod", "**/*.sum"]' | ||
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | ||
- | ||
name: Skipping test | ||
- name: Skipping test | ||
run: echo Should I skip tests? ${{ steps.skip_check.outputs.should_skip }} | ||
|
||
test: | ||
needs: should_run_test | ||
if: ${{ needs.should_run_test.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Check out repository code | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- | ||
name: Setup Golang | ||
- name: Setup Golang | ||
uses: actions/setup-go@v2.1.4 | ||
with: | ||
go-version: 1.17 | ||
- | ||
name: Display go version | ||
- name: Display go version | ||
run: go version | ||
- | ||
name: Run all tests | ||
- name: Run all tests | ||
run: go test -mod=readonly -timeout 30m -coverprofile=coverage.txt -tags='norace' -covermode=atomic `go list ./... | grep -v simapp` | ||
- | ||
name: Codecov | ||
- name: Codecov | ||
uses: codecov/codecov-action@v1.5.2 | ||
|
||
liveness-test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.17 | ||
- uses: technote-space/get-diff-action@v6.0.1 | ||
id: git_diff | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
- name: Install Starport | ||
run: | | ||
curl https://get.starport.network/starport@v0.19.5! | bash | ||
if: env.GIT_DIFF | ||
- name: Start Local Network via Starport | ||
run: | | ||
starport chain serve --reset-once -v -c ./starport.ci.yml > starport.out 2>&1 & | ||
if: env.GIT_DIFF | ||
- name: Test Local Network Liveness | ||
run: | | ||
sleep 3m | ||
./contrib/scripts/test_localnet_liveness.sh 100 5 50 localhost | ||
if: env.GIT_DIFF |
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
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
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,47 @@ | ||
package apptesting | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
"github.com/cosmos/cosmos-sdk/simapp" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/osmosis-labs/osmosis/v7/x/gamm/pool-models/balancer" | ||
) | ||
|
||
var gammPoolMakerAcc = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address().Bytes()) | ||
|
||
// Returns a Univ2 pool with the initial liquidity being the provided balances | ||
func (suite *KeeperTestHelper) PrepareUni2PoolWithAssets(asset1, asset2 sdk.Coin) uint64 { | ||
return suite.preparePool( | ||
[]balancer.PoolAsset{ | ||
{ | ||
Weight: sdk.NewInt(1), | ||
Token: asset1, | ||
}, | ||
{ | ||
Weight: sdk.NewInt(1), | ||
Token: asset2, | ||
}, | ||
}, | ||
) | ||
} | ||
|
||
func (suite *KeeperTestHelper) preparePool(assets []balancer.PoolAsset) uint64 { | ||
suite.Require().Len(assets, 2) | ||
|
||
// Add coins for pool creation fee + coins needed to mint balances | ||
fundCoins := sdk.Coins{sdk.NewCoin("uosmo", sdk.NewInt(10000000000))} | ||
for _, a := range assets { | ||
fundCoins = fundCoins.Add(a.Token) | ||
} | ||
err := simapp.FundAccount(suite.App.BankKeeper, suite.Ctx, gammPoolMakerAcc, fundCoins) | ||
suite.Require().NoError(err) | ||
|
||
msg := balancer.NewMsgCreateBalancerPool(gammPoolMakerAcc, balancer.PoolParams{ | ||
SwapFee: sdk.ZeroDec(), | ||
ExitFee: sdk.ZeroDec(), | ||
}, assets, "") | ||
poolId, err := suite.App.GAMMKeeper.CreatePool(suite.Ctx, msg) | ||
suite.NoError(err) | ||
return poolId | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.