Tbots CI #8261
This file contains hidden or 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: Tbots CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| schedule: | |
| - cron: '0 8 * * *' # 12 AM PST / 8 AM UTC | |
| workflow_dispatch: | |
| inputs: | |
| clear_cache: | |
| description: 'Clear cache before building' | |
| required: false | |
| type: boolean | |
| default: true | |
| permissions: | |
| actions: write | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-and-clear-cache: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: github.event_name == 'schedule' | |
| with: | |
| fetch-depth: 50 | |
| - name: Check conditions and optionally clear cache | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| SHOULD_RUN=true | |
| if [ "${{ github.event_name }}" == "schedule" ]; then | |
| COMMITS=$(git log --oneline --since="24 hours ago") | |
| if [ -z "$COMMITS" ]; then | |
| echo "No commits in the last 24 hours. Skipping." | |
| SHOULD_RUN=false | |
| else | |
| echo "Commits found in the last 24 hours. Clearing cache..." | |
| gh extension install actions/gh-actions-cache || true | |
| gh actions-cache delete --all --confirm || true | |
| gh cache delete --all || true | |
| fi | |
| elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| if [ "${{ github.event.inputs.clear_cache }}" == "true" ]; then | |
| echo "Manual trigger with clear_cache. Clearing cache..." | |
| gh extension install actions/gh-actions-cache || true | |
| gh actions-cache delete --all --confirm || true | |
| gh cache delete --all || true | |
| fi | |
| fi | |
| echo "should_run=$SHOULD_RUN" >> $GITHUB_OUTPUT | |
| multiplatform-build: | |
| needs: check-and-clear-cache | |
| if: needs.check-and-clear-cache.outputs.should_run == 'true' | |
| strategy: | |
| matrix: | |
| platform: [ ubuntu-24.04-arm ] | |
| name: Ubuntu Alternate Builds | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: Software Build Test | |
| run: | | |
| cd src | |
| bazel build --show_timestamps --copt=-O3 --verbose_failures \ | |
| -- //... -//software:unix_full_system \ | |
| -//software/gameplay_tests/... \ | |
| -//software/ai/hl/... \ | |
| -//software/embedded/... \ | |
| -//toolchains/cc/... \ | |
| -//software:unix_full_system_tar_gen | |
| - name: Raspberry Pi Build Test | |
| run: | | |
| cd src | |
| bazel build //software/embedded:thunderloop_main --copt=-O3 --platforms=//toolchains/cc:robot | |
| - name: Motor Firmware build Test | |
| run: | | |
| cd src | |
| bazel build @mdv6_firmware//:mdv6_firmware_main --platforms=//toolchains/cc:motor_board | |
| motor-firmware: | |
| name: Motor Firmware | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: Build Motor Firmware | |
| run: | | |
| cd src | |
| bazel build @mdv6_firmware//:mdv6_firmware_main --platforms=//toolchains/cc:motor_board | |
| software-tests: | |
| needs: check-and-clear-cache | |
| if: needs.check-and-clear-cache.outputs.should_run == 'true' | |
| name: Software Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: Software Test | |
| run: | | |
| cd src | |
| bazel test --copt=-O3 --show_timestamps --verbose_failures \ | |
| -- //... -//software:unix_full_system \ | |
| -//software/gameplay_tests/... \ | |
| -//software/ai/hl/... \ | |
| -//software/ai/navigator/... \ | |
| -//toolchains/cc/... \ | |
| -//software:unix_full_system_tar_gen | |
| robot-tests: | |
| needs: check-and-clear-cache | |
| if: needs.check-and-clear-cache.outputs.should_run == 'true' | |
| name: Robot Software Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: Raspberry Pi Build | |
| run: | | |
| cd src | |
| bazel build //software/embedded:thunderloop_main --copt=-O3 --platforms=//toolchains/cc:robot | |
| simulated-gameplay-tests: | |
| needs: check-and-clear-cache | |
| if: needs.check-and-clear-cache.outputs.should_run == 'true' | |
| name: Simulated Gameplay Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: Simulated Test Run | |
| # TODO (#2908): reenable once field tests can be ran as simulated | |
| # //software/gameplay_tests/... \ | |
| run: | | |
| cd src | |
| bazel test //software/gameplay_tests:requirements_test | |
| bazel test --copt=-O3 --flaky_test_attempts=3 --show_timestamps \ | |
| --test_arg="--ci_mode" \ | |
| -- //software:unix_full_system \ | |
| -//software/gameplay_tests:requirements_test \ | |
| //software/ai/hl/... \ | |
| //software/ai/navigator/... | |
| - name: Upload simulated test proto logs | |
| # Ensure that simulated test logs get uploaded | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blue-sim-test-proto-logs | |
| path: | | |
| /tmp/tbots/blue/test/*/proto_* | |
| - name: Upload simulated test proto logs | |
| # Ensure that simulated test logs get uploaded | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: yellow-sim-test-proto-logs | |
| path: | | |
| /tmp/tbots/yellow/test/*/proto_* | |
| autorefd-game: | |
| needs: check-and-clear-cache | |
| if: needs.check-and-clear-cache.outputs.should_run == 'true' | |
| name: AutoRef'd Game (3 Minutes) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/environment-setup | |
| - name: AI vs AI (3 minutes) | |
| run: | | |
| cd src | |
| bazel run --run_under="xvfb-run" //software/thunderscope:thunderscope_main --copt=-O3 -- --enable_autoref --ci_mode | |
| - name: Upload AI vs AI logs | |
| # Ensure that simulated test logs get uploaded | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blue-ai-vs-ai-proto-logs | |
| path: | | |
| /tmp/tbots/blue/proto_* | |
| - name: Upload AI vs AI logs | |
| # Ensure that simulated test logs get uploaded | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: yellow-ai-vs-ai-proto-logs | |
| path: | | |
| /tmp/tbots/yellow/proto_* |