Skip to content

Python examples

Python examples #114

# This is a faster workflow that parallelizes the jobs in a matrix so
# we can get faster results than waiting for the standard build_all_frc_projects
# powershell script
name: Build all FRC Projects
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- project-name: 'BasicLatencyCompensation'
directory: 'cpp/BasicLatencyCompensation'
- project-name: 'CANcoder'
directory: 'cpp/CANcoder'
- project-name: 'CommandBasedDrive'
directory: 'cpp/CommandBasedDrive'
- project-name: 'CurrentLimits'
directory: 'cpp/CurrentLimits'
- project-name: 'Falcon500ArcadeDrive'
directory: 'cpp/Falcon500ArcadeDrive'
- project-name: 'FusedCANcoder'
directory: 'cpp/FusedCANcoder'
- project-name: 'MotionMagic'
directory: 'cpp/MotionMagic'
- project-name: 'Pigeon2'
directory: 'cpp/Pigeon2'
- project-name: 'PositionClosedLoop'
directory: 'cpp/PositionClosedLoop'
- project-name: 'Simulation'
directory: 'cpp/Simulation'
- project-name: 'VelocityClosedLoop'
directory: 'cpp/VelocityClosedLoop'
- project-name: 'WaitForAll'
directory: 'cpp/WaitForAll'
- project-name: 'BasicLatencyCompensation'
directory: 'java/BasicLatencyCompensation'
- project-name: 'CANcoder'
directory: 'java/CANcoder'
- project-name: 'CommandBasedDrive'
directory: 'java/CommandBasedDrive'
- project-name: 'ControlRequestLimits'
directory: 'java/ControlRequestLimits'
- project-name: 'CurrentLimits'
directory: 'java/CurrentLimits'
- project-name: 'Falcon500ArcadeDrive'
directory: 'java/Falcon500ArcadeDrive'
- project-name: 'FusedCANcoder'
directory: 'java/FusedCANcoder'
- project-name: 'MotionMagic'
directory: 'java/MotionMagic'
- project-name: 'Pigeon2'
directory: 'java/Pigeon2'
- project-name: 'PositionClosedLoop'
directory: 'java/PositionClosedLoop'
- project-name: 'Simulation'
directory: 'java/Simulation'
- project-name: 'SwerveWithPathPlanner'
directory: 'java/SwerveWithPathPlanner'
- project-name: 'VelocityClosedLoop'
directory: 'java/VelocityClosedLoop'
- project-name: 'WaitForAll'
directory: 'java/WaitForAll'
# The type of runner that the job will run on
runs-on: ubuntu-latest
# This grabs the WPILib docker container
container: wpilib/roborio-cross-ubuntu:2024-22.04
steps:
- uses: actions/checkout@v4
# Grant execute permission for gradlew
- name: Grant execute permission for gradlew
run: cd "${{ matrix.directory }}" && chmod +x gradlew
# Runs a single command using the runners shell
- name: Compile and run tests on robot code for project ${{ matrix.project-name }}
run: cd "${{ matrix.directory }}" && ./gradlew build
build-python:
strategy:
fail-fast: false
matrix:
python_version: ['3.9', '3.10', '3.11']
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
project-name: ['ArcadeDrive', 'CANcoder', 'StatusSignals']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install python dependencies
run: |
pip install -U pip
pip install 'robotpy' phoenix6
- name: Test ${{ matrix.project-name }}
run: |
cd "python/${{ matrix.project-name }}" && python3 robot.py test