Skip to content

Commit

Permalink
GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Apr 24, 2024
1 parent 58fdc04 commit cf73422
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 51 deletions.
105 changes: 58 additions & 47 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@ 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:
schedule:
- cron: "0 */2 * * *"
release:
types: [published]
pull_request: # Alex: DO NOT merge
branches:
- main
- release/**
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
paths:
- "**/*.go"
- "go.mod"
- "go.sum"

concurrency:
group: ci-${{ github.ref }}-sims
Expand Down Expand Up @@ -84,47 +95,47 @@ jobs:
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: ""
# 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: ""

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: ""
# 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: ""
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MOCKS_DIR = $(CURDIR)/tests/mocks
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)

# process build tags
build_tags = netgo
Expand Down Expand Up @@ -294,11 +295,11 @@ test-sim-custom-genesis-fast:

test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=`sysctl -n hw.logicalcpu` -SimAppPkg=. -ExitOnFail 50 5 TestAppImportExport
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=$(NUM_CPUS) -SimAppPkg=. -ExitOnFail 50 5 TestAppImportExport

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

test-sim-custom-genesis-multi-seed: runsim
@echo "Running multi-seed custom genesis simulation..."
Expand All @@ -307,11 +308,11 @@ test-sim-custom-genesis-multi-seed: runsim

test-sim-multi-seed-long: runsim
@echo "Running long multi-seed application simulation. This may take awhile!"
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=`sysctl -n hw.logicalcpu` -SimAppPkg=. -ExitOnFail 500 50 TestFullAppSimulation
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=$(NUM_CPUS) -SimAppPkg=. -ExitOnFail 500 50 TestFullAppSimulation

test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation. This may take awhile!"
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=`sysctl -n hw.logicalcpu` -SimAppPkg=. -ExitOnFail 50 10 TestFullAppSimulation
@cd ${CURRENT_DIR}/simapp && $(BINDIR)/runsim -Jobs=$(NUM_CPUS) -SimAppPkg=. -ExitOnFail 50 10 TestFullAppSimulation

test-sim-benchmark-invariants:
@echo "Running simulation invariant benchmarks..."
Expand Down

0 comments on commit cf73422

Please sign in to comment.