Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/actions/environment-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ runs:
if: runner.os == 'macOS'
run: |
"${GITHUB_WORKSPACE}"/environment_setup/setup_software_mac.sh

- name: Cache Bazel disk cache
uses: actions/cache@v4
with:
path: ~/.cache/thunderbots_bazel_disk_cache
key: bazel-cache-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
restore-keys: |
bazel-cache-${{ runner.os }}-${{ github.job }}-
bazel-cache-${{ runner.os }}-

66 changes: 61 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,64 @@ on:
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 }}
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 ]
Expand Down Expand Up @@ -41,6 +92,8 @@ jobs:


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:
Expand All @@ -60,14 +113,13 @@ jobs:
-//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

- name: Environment Setup
run: |
"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
- uses: ./.github/actions/environment-setup

- name: Raspberry Pi Build
run: |
Expand All @@ -76,6 +128,8 @@ jobs:


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:
Expand Down Expand Up @@ -110,6 +164,8 @@ jobs:
/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:
Expand Down
Loading