Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Event/wpi

Event/wpi #258

name: Robot Workflow
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
jobs:
formatblack:
name: Style Check Code with Black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check files using the black formatter
uses: rickstaa/action-black@v1
id: action_black
with:
black_args: "."
- name: Annotate diff changes using reviewdog
if: steps.action_black.outputs.is_formatted == 'true'
uses: reviewdog/action-suggester@v1
with:
tool_name: blackfmt
- name: Fail if actions taken
if: steps.action_black.outputs.is_formatted == 'true'
run: exit 1
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "Black formatter reported errors in {{ EVENT_PAYLOAD.pull_request.html_url }} !"
run_simulator:
name: Run the WPIlib Simulator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('rio/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd rio && pipenv install --deploy --dev
- name: Timeout the simulator
run: |
cd rio && timeout 20 pipenv run python -m robotpy sim --nogui || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "<@614313406345904148> Simulator failed in {{ EVENT_PAYLOAD.pull_request.html_url }} !"
unit_test:
name: pyfrc Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('rio/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd rio && pipenv install --deploy --dev
- name: Run unit tests
run: |
cd rio && pipenv run python -m robotpy test -- -vs || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
- name: Discord notification
if: ${{ failure() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "<@614313406345904148> Unit tests failed in {{ EVENT_PAYLOAD.pull_request.html_url }} !"