Skip to content

Commit

Permalink
Test fan out sims
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Apr 24, 2024
1 parent cf73422 commit ef74f39
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 81 deletions.
90 changes: 9 additions & 81 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Sims
# Sims workflow runs multiple types of simulations (nondeterminism, import-export, after-import, multi-seed-short)
# This workflow will run on all Pull Requests, if a .go, .mod or .sum file have been changed
on:
pull_request: # Alex: DO NOT merge
pull_request: # TODO(Alex): DO NOT merge
branches:
- main
- release/**
Expand Down Expand Up @@ -45,7 +45,11 @@ jobs:
test-sim-import-export:
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 60
timeout-minutes: 20
strategy:
max-parallel: 4
matrix:
seed: [1, 2, 4, 7, 32, 123, 124, 582, 1893, 2989]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -57,85 +61,9 @@ jobs:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-import-export
run: |
make test-sim-import-export
test-sim-after-import:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-after-import
run: |
make test-sim-after-import
test-sim-multi-seed-short:
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-multi-seed-short
SIM_SEED: ${{ matrix.seed }}
run: |
make test-sim-multi-seed-short
# sims-notify-success:
# needs:
# [test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
# runs-on: ubuntu-latest
# if: ${{ success() }}
# steps:
# - name: Check out repository
# uses: actions/checkout@v4
# - name: Get previous workflow status
# uses: ./.github/actions/last-workflow-status
# id: last_status
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Notify Slack on success
# if: ${{ steps.last_status.outputs.last_status == 'failure' }}
# uses: rtCamp/action-slack-notify@v2.3.0
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_CHANNEL: sdk-sims
# SLACK_USERNAME: Sim Tests
# SLACK_ICON_EMOJI: ":white_check_mark:"
# SLACK_COLOR: good
# SLACK_MESSAGE: Sims are passing
# SLACK_FOOTER: ""
make test-sim-import-export-matrix
# sims-notify-failure:
# permissions:
# contents: none
# needs:
# [test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
# runs-on: ubuntu-latest
# if: ${{ failure() }}
# steps:
# - name: Notify Slack on failure
# uses: rtCamp/action-slack-notify@v2.3.0
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_CHANNEL: sdk-sims
# SLACK_USERNAME: Sim Tests
# SLACK_ICON_EMOJI: ":skull:"
# SLACK_COLOR: danger
# SLACK_MESSAGE: Sims are failing
# SLACK_FOOTER: ""
# TODO (Alex): do not merge
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ HTTPS_GIT := https://github.com/cosmos/cosmos-sdk.git
DOCKER := $(shell which docker)
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)
NUM_CPUS = $(shell if [[ "$$(uname)" == "Darwin" ]]; then sysctl -n hw.logicalcpu; else nproc; fi)
SIM_SEED ?= 1

# process build tags
build_tags = netgo
Expand Down Expand Up @@ -297,6 +298,11 @@ test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=$(NUM_CPUS) -SimAppPkg=. -ExitOnFail 50 5 TestAppImportExport

test-sim-import-export-matrix:
@echo "Running application import/export simulation. This may take several minutes..."
@cd ${CURRENT_DIR}/simapp && go test -mod=readonly -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=50 -BlockSize=5 -Commit=true -Period=0 -Seed=$(SIM_SEED) -v -timeout 20m -EnableStreaming=true

test-sim-after-import: runsim
@echo "Running application simulation-after-import. This may take several minutes..."
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=$(NUM_CPUS) -SimAppPkg=. -ExitOnFail 50 5 TestAppSimulationAfterImport
Expand Down

0 comments on commit ef74f39

Please sign in to comment.