Skip to content

Commit

Permalink
feat: simulation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
poorphd committed Jul 20, 2023
1 parent 6538c23 commit 9382184
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 132 deletions.
242 changes: 121 additions & 121 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,121 @@
#name: Sims
# Sims workflow runs multiple types of simulations (nondeterminism, import-export, after-import)
# This workflow will run on all Pull Requests, if a .go, .mod or .sum file have been changed
# Temporary disable until it is fixed
#on:
# pull_request:
# push:
# branches:
# - main
# - develop
#
#jobs:
# build:
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, 'skip-sims')"
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2.1.3
# with:
# go-version: 1.18
# - name: Display go version
# run: go version
# - run: make build
#
# install-runsim:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - uses: actions/setup-go@v2.1.3
# with:
# go-version: 1.18
# - name: Display go version
# run: go version
# - name: Install runsim
# run: export GO111MODULE="on" && go install github.com/cosmos/tools/cmd/runsim@v1.0.0
# - uses: actions/cache@v2.1.6
# with:
# path: ~/go/bin
# key: ${{ runner.os }}-go-runsim-binary
#
# test-sim-nondeterminism:
# runs-on: ubuntu-latest
# needs: [build, install-runsim]
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2.1.3
# with:
# go-version: 1.18
# - name: Display go version
# run: go version
# - uses: technote-space/get-diff-action@v4
# with:
# PATTERNS: |
# **/**.go
# go.mod
# go.sum
# - uses: actions/cache@v2.1.6
# with:
# path: ~/go/bin
# key: ${{ runner.os }}-go-runsim-binary
# if: env.GIT_DIFF
# - name: test-sim-nondeterminism
# run: |
# make test-sim-nondeterminism
# if: env.GIT_DIFF
#
# test-sim-import-export:
# runs-on: ubuntu-latest
# needs: [build, install-runsim]
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2.1.3
# with:
# go-version: 1.18
# - name: Display go version
# run: go version
# - uses: technote-space/get-diff-action@v4
# with:
# SUFFIX_FILTER: |
# **/**.go
# go.mod
# go.sum
# SET_ENV_NAME_INSERTIONS: 1
# SET_ENV_NAME_LINES: 1
# - uses: actions/cache@v2.1.6
# with:
# path: ~/go/bin
# key: ${{ runner.os }}-go-runsim-binary
# if: env.GIT_DIFF
# - name: test-sim-import-export
# run: |
# make test-sim-import-export
# if: env.GIT_DIFF
#
# test-sim-after-import:
# runs-on: ubuntu-latest
# needs: [build, install-runsim]
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2.1.3
# with:
# go-version: 1.18
# - name: Display go version
# run: go version
# - uses: technote-space/get-diff-action@v4
# with:
# SUFFIX_FILTER: |
# **/**.go
# go.mod
# go.sum
# SET_ENV_NAME_INSERTIONS: 1
# SET_ENV_NAME_LINES: 1
# - uses: actions/cache@v2.1.6
# with:
# path: ~/go/bin
# key: ${{ runner.os }}-go-runsim-binary
# if: env.GIT_DIFF
# - name: test-sim-after-import
# run: |
# make test-sim-after-import
# if: env.GIT_DIFF
name: Sims
Sims workflow runs multiple types of simulations (nondeterminism, import-export, after-import)
This workflow will run on all Pull Requests, if a .go, .mod or .sum file have been changed
Temporary disable until it is fixed
on:
pull_request:
push:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
with:
go-version: 1.18
- name: Display go version
run: go version
- run: make build

install-runsim:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v2.1.3
with:
go-version: 1.18
- name: Display go version
run: go version
- name: Install runsim
run: export GO111MODULE="on" && go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v2.1.6
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary

test-sim-nondeterminism:
runs-on: ubuntu-latest
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
with:
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/cache@v2.1.6
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: env.GIT_DIFF
- name: test-sim-nondeterminism
run: |
make test-sim-nondeterminism
if: env.GIT_DIFF

test-sim-import-export:
runs-on: ubuntu-latest
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
with:
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
**/**.go
go.mod
go.sum
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- uses: actions/cache@v2.1.6
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: env.GIT_DIFF
- name: test-sim-import-export
run: |
make test-sim-import-export
if: env.GIT_DIFF

test-sim-after-import:
runs-on: ubuntu-latest
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.3
with:
go-version: 1.18
- name: Display go version
run: go version
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
**/**.go
go.mod
go.sum
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- uses: actions/cache@v2.1.6
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: env.GIT_DIFF
- name: test-sim-after-import
run: |
make test-sim-after-import
if: env.GIT_DIFF
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ test-rpc-pending:
test-sim-nondeterminism:
@echo "Running non-determinism test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=10 -BlockSize=100 -Commit=true -Period=1 -v -timeout 1h
-NumBlocks=20 -BlockSize=100 -Commit=true -Period=1 -v -timeout 10m

test-sim-nondeterminism-long:
@echo "Running non-determinism test..."
@echo "Running non-determinism-long test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=1 -v -timeout 1h
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=1 -v -timeout 10h

test-sim-custom-genesis-fast:
@echo "Running custom genesis simulation..."
Expand All @@ -386,21 +386,21 @@ test-sim-custom-genesis-fast:

test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
$(eval SEED := $(shell awk 'BEGIN{srand(); for (i=1; i<=5; i++) {n=int(10000*rand())+1; printf "%d%s", n, (i==5 ? "" : ",")}}'))
@$(BINDIR)/runsim -Jobs=1 -SimAppPkg=$(SIMAPP) -Seeds="$(SEED)" -ExitOnFail 10 1 TestAppImportExport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -Seeds=1,10,100,1000 -ExitOnFail 50 5 TestAppImportExport

test-sim-import-export-long: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport
@echo "Running application simulation-import-export-long. This may take several minutes..."
$(eval SEED := $(shell awk 'BEGIN{srand(); for (i=1; i<=50; i++) {n=int(10000*rand())+1; printf "%d%s", n, (i==50 ? "" : ",")}}'))
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -Seeds="$(SEED)" -ExitOnFail 500 5 TestAppImportExport

test-sim-after-import: runsim
@echo "Running application simulation-after-import. This may take several minutes..."
$(eval SEED := $(shell awk 'BEGIN{srand(); for (i=1; i<=5; i++) {n=int(10000*rand())+1; printf "%d%s", n, (i==5 ? "" : ",")}}'))
@$(BINDIR)/runsim -Jobs=1 -SimAppPkg=$(SIMAPP) -Seeds="$(SEED)" -ExitOnFail 10 1 TestAppSimulationAfterImport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -Seeds=1,10,100,1000 -ExitOnFail 50 5 TestAppSimulationAfterImport

test-sim-after-import-long: runsim
@echo "Running application simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport
@echo "Running application simulation-after-import-long. This may take several minutes..."
$(eval SEED := $(shell awk 'BEGIN{srand(); for (i=1; i<=50; i++) {n=int(10000*rand())+1; printf "%d%s", n, (i==50 ? "" : ",")}}'))
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -Seeds="$(SEED)" -ExitOnFail 500 5 TestAppSimulationAfterImport

test-sim-custom-genesis-multi-seed: runsim
@echo "Running multi-seed custom genesis simulation..."
Expand Down

0 comments on commit 9382184

Please sign in to comment.