Continuous Simulation #9922
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
name: Continuous Simulation | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '* * * * *' | |
workflow_dispatch: | |
jobs: | |
simualation_test: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.3' | |
- name: Run simulation | |
id: run_simulation | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set +e | |
export CPU_PROFILE=0 | |
export HEAP_PROFILE=0 | |
export REPLICA_DEBUG=-1 | |
export CLIENT_DEBUG=-1 | |
export SIMULATOR_DEBUG=0 | |
SEED=$(python3 -c 'import random; rng = random.SystemRandom(); print(rng.randint(0, 2**64-1))') | |
timeout 3h go run ./cmd/simulator ${SEED} | |
exit_code=$? | |
if [ $exit_code -eq 0 ]; then | |
echo "Simulation finished successfully" | |
else | |
issue="" | |
if [ $exit_code -eq 124 ]; then | |
echo "Simulation timed out for seed ${SEED}" | |
issue="Simulation timed out for seed \`${SEED}\`" | |
else | |
echo "Simulation failed for seed ${SEED}" | |
issue="Simulation failed for seed \`${SEED}\`" | |
fi | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/tangledbytes/go-vsr/issues \ | |
-d "{\"title\":\"${issue}\",\"labels\":[\"auto-simulation\"]}" | |
exit 1 | |
fi |