|
| 1 | +name: Micro Autonomy Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + setup-environment: |
| 14 | + name: Setup Environment |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + outputs: |
| 18 | + docker_matrix: ${{ steps.docker-environment.outputs.docker_matrix }} |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout Repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Generate Docker Environment |
| 25 | + id: docker-environment |
| 26 | + run: | |
| 27 | + # Create static matrix for F1TENTH services (single line JSON) |
| 28 | + matrix='{"include":[{"service":"robot","dockerfile":"docker/robot/robot.Dockerfile","compose_file":"modules/docker-compose.robot.yaml"},{"service":"sim","dockerfile":"docker/sim/sim.Dockerfile","compose_file":"modules/docker-compose.sim.yaml"},{"service":"vis_tools","dockerfile":"docker/vis_tools/foxglove.Dockerfile","compose_file":"modules/docker-compose.vis_tools.yaml"},{"service":"samples","dockerfile":"docker/samples/py_producer.Dockerfile","compose_file":"modules/docker-compose.samples.yaml"}]}' |
| 29 | + echo "docker_matrix=$matrix" >> $GITHUB_OUTPUT |
| 30 | +
|
| 31 | + build-and-unittest: |
| 32 | + name: Build/Test |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: setup-environment |
| 35 | + |
| 36 | + env: |
| 37 | + SAMPLES_PRODUCER_IMAGE: "samples-producer:latest" |
| 38 | + SAMPLES_TRANSFORMER_IMAGE: "samples-transformer:latest" |
| 39 | + SAMPLES_AGGREGATOR_IMAGE: "samples-aggregator:latest" |
| 40 | + ROBOT_IMAGE: "robot:latest" |
| 41 | + INFRASTRUCTURE_FOXGLOVE_IMAGE: "infrastructure-foxglove:latest" |
| 42 | + FOXGLOVE_BRIDGE_PORT: "9090" |
| 43 | + SIM_IMAGE: "sim:latest" |
| 44 | + SIM_AUTODRIVE_IMAGE: "sim-autodrive:latest" |
| 45 | + |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: ${{ fromJSON(needs.setup-environment.outputs.docker_matrix) }} |
| 49 | + |
| 50 | + concurrency: |
| 51 | + group: ${{ matrix.service }}-${{ github.workflow }}-${{ github.ref }} |
| 52 | + cancel-in-progress: true |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Set up Docker Buildx |
| 59 | + uses: docker/setup-buildx-action@v3 |
| 60 | + id: buildx |
| 61 | + |
| 62 | + - name: Build Image from Source |
| 63 | + run: | |
| 64 | + # Build using Docker Compose with all env vars available |
| 65 | + docker compose -f ${{ matrix.compose_file }} build |
| 66 | + env: |
| 67 | + DOCKER_BUILDKIT: 1 |
| 68 | + COMPOSE_DOCKER_CLI_BUILD: 1 |
| 69 | + BUILDKIT_INLINE_CACHE: 1 |
| 70 | + |
| 71 | + confirm-build-and-unittest-complete: |
| 72 | + name: Check Build/Test Completion |
| 73 | + needs: build-and-unittest |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Ending |
| 77 | + run: | |
| 78 | + echo "all builds and unit tests completed." |
0 commit comments