Add Swerve Setpoint Generator to PPLib Python #1175
Workflow file for this run
This file contains 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: PathPlanner | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: The full version string, i.e. 2024.0.0-alpha-1 or 2024.1.1 | |
required: true | |
env: | |
FLUTTER_VERSION: 3.24.4 | |
jobs: | |
formatting-analysis: | |
name: "[GUI] Check Formatting & Analysis" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/linux | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Generate mocks | |
run: dart run build_runner build | |
- name: Analyze | |
run: flutter analyze | |
- name: Check formatting | |
run: dart format -o none --set-exit-if-changed lib/* test/* | |
test: | |
name: "[GUI] Run Tests" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/linux | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Generate full coverage test | |
run: dart run full_coverage | |
- name: Generate mocks | |
run: dart run build_runner build | |
- name: Run tests | |
run: flutter test --coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: flutter-coverage | |
files: coverage/lcov.info | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2022 | |
build-option: "windows" | |
artifact-path: "build/windows/x64/runner/Release" | |
artifact-name: PathPlanner-Windows | |
- os: macos-15 | |
build-option: "macos" | |
artifact-path: "build/macos/Build/Products/Release/PathPlanner-macOS.zip" | |
artifact-name: PathPlanner-macOS | |
- os: ubuntu-22.04 | |
build-option: "linux" | |
artifact-path: "build/linux/x64/release/bundle" | |
artifact-name: PathPlanner-Linux | |
name: "[GUI] Build - ${{ matrix.artifact-name }}" | |
needs: [formatting-analysis, test] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install flutter deps | |
if: ${{ matrix.build-option == 'linux' }} | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build libgtk-3-dev | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }} | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Set release version env | |
if: ${{ github.event_name == 'workflow_dispatch' && matrix.build-option != 'windows' }} | |
run: echo "VERSION_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
- name: Set dev version env | |
if: ${{ github.event_name != 'workflow_dispatch' && matrix.build-option != 'windows' }} | |
run: echo "VERSION_NAME=0.0.0-dev-${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Set release version env windows just has to be different | |
if: ${{ github.event_name == 'workflow_dispatch' && matrix.build-option == 'windows' }} | |
run: Add-Content -Path ${env:GITHUB_ENV} -Value "VERSION_NAME=${{ github.event.inputs.version }}" | |
- name: Set dev version env windows just has to be different | |
if: ${{ github.event_name != 'workflow_dispatch' && matrix.build-option == 'windows' }} | |
run: Add-Content -Path ${env:GITHUB_ENV} -Value "VERSION_NAME=0.0.0-dev-${{ github.run_number }}" | |
- name: Set pubspec version | |
run: | | |
flutter pub global activate cider | |
dart run cider version "${{ env.VERSION_NAME }}+${{ github.run_number }}" | |
- name: Build app | |
run: flutter build ${{ matrix.build-option }} | |
- name: Copy redist | |
if: ${{ matrix.build-option == 'windows' }} | |
run: | | |
cp windows/redist/msvcp140.dll build/windows/x64/runner/Release | |
cp windows/redist/vcruntime140.dll build/windows/x64/runner/Release | |
cp windows/redist/vcruntime140_1.dll build/windows/x64/runner/Release | |
- name: Zip release (macOS) | |
if: ${{ matrix.build-option == 'macos' }} | |
run: | | |
cd build/macos/Build/Products/Release | |
zip -r PathPlanner-macOS.zip PathPlanner.app --symlinks | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }} | |
path: ${{ matrix.artifact-path }} | |
- name: Create macOS DMG | |
if: ${{ matrix.build-option == 'macos' }} | |
uses: L-Super/create-dmg-actions@v1 | |
with: | |
dmg_name: build/macos/Build/Products/Release/${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }} | |
src_dir: build/macos/Build/Products/Release/PathPlanner.app | |
- name: Upload macOS DMG artifact | |
if: ${{ matrix.build-option == 'macos' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}-dmg | |
path: build/macos/Build/Products/Release/${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}.dmg | |
- name: Create windows installer | |
if: ${{ matrix.build-option == 'windows' }} | |
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 | |
with: | |
path: windows_installer.iss | |
options: /O+ /F"${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}-setup" | |
- name: Upload windows installer artifact | |
if: ${{ matrix.build-option == 'windows' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}-setup | |
path: build/windows/x64/installer/${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}-setup.exe | |
- name: Create MSIX | |
if: ${{ matrix.build-option == 'windows' }} | |
run: flutter pub run msix:create --store | |
- name: Upload MSIX artifact | |
if: ${{ matrix.build-option == 'windows' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact-name }}-v${{ env.VERSION_NAME }}-msix | |
path: ${{ matrix.artifact-path }}/pathplanner.msix |