Skip to content

Commit

Permalink
feat: add simulation to CI (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rutmanz authored Jan 10, 2024
1 parent e928fcd commit 2e7caed
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Build
name: CI

on:
push:
pull_request:


jobs:
build:
name: Build
name: Build & Simulate
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2024-22.04
steps:
Expand All @@ -16,3 +17,12 @@ jobs:
run: chmod +x gradlew
- name: Build robot code
run: ./gradlew build

# Runs a simulation to spot check crashes
- name: Run simulation to check for runtime errors
run: timeout 1m ./gradlew simulateJava 2>&1 | awk -v rc=0 '/The robot program quit unexpectedly/ { rc=1 } 1; END {exit rc}'
# 1. Run simulation with 1 minute timeout
# 2. Redirect stderr to stdout (just in case)
# 3. Use awk to check for robot crash message and set the return code based on this. (Alternative to grep that doesn't filter the simulation output)
# Stolen from https://github.com/AusTINCANsProgrammingTeam/2022RobotCode/blob/041e469ab0d2047a0c6d66b3d953b5adc3b3e29a/.github/workflows/main.yml#L35-L41

0 comments on commit 2e7caed

Please sign in to comment.