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

Commit

Permalink
Merge pull request #1 from FRC-1721/feat/template
Browse files Browse the repository at this point in the history
Feat/template
  • Loading branch information
Kredcool authored Jan 9, 2024
2 parents 5e1b15f + 46aaea0 commit b20c2d3
Show file tree
Hide file tree
Showing 22 changed files with 2,496 additions and 1 deletion.
111 changes: 111 additions & 0 deletions .github/workflows/robot-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
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 }} !"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,10 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# ===========
# RobotPy/FRC
# ===========

# Joe's not sure what this is for, put it back in the tree only if needed.
networktables.json
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# 1721-Crescendo
[![Robot Workflow](https://github.com/FRC-1721/1721-Crescendo/actions/workflows/robot-workflow.yml/badge.svg)](https://github.com/FRC-1721/1721-Crescendo/actions/workflows/robot-workflow.yml)

# 1721-Crescendo
1 change: 1 addition & 0 deletions rio/.wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"teamNumber": 1721}
46 changes: 46 additions & 0 deletions rio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# FRC 1721 Tidal Force
# 2022

# Because robotpy is so easy to use, this is moreso a
# collection of shortcuts, handy for doing simple scripts
# and macros.

.PHONY: help

help: ## Prints this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

sim: ## Run the simulator
python -m robotpy sim


deploy: ## Deploy to the robot (with console)
python -m robotpy deploy --nc


push: ## Deploy to the robot (push only, no console)
python -m robotpy deploy


download: ## Download robot requirements locally
robotpy-installer download -r robot_requirements.txt


install: ## Install requirements, run download first!
robotpy-installer install -r robot_requirements.txt


info: ## Shortcut to get information about the code already on the bot
python -m robotpy deploy-info

test: ## Run automated tests
python -m robotpy test

download-python: ## Download python (for robot)
robotpy-installer download-python

install-python: ## Install python (for robot)
robotpy-installer install-python

clean: ## Clean the repo
git clean -fdX
19 changes: 19 additions & 0 deletions rio/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
robotpy = {extras = ["rev", "ctre", "commands2", "navx"]}
wpilib = {extras = ["all"]}
pyyaml = "6.0"
black = "*"

[dev-packages]
black = "*"

[requires]
python_version = "3.11"

[pipenv]
allow_prereleases = true
Loading

0 comments on commit b20c2d3

Please sign in to comment.