Skip to content

Commit 02f4819

Browse files
committed
readded scripts and readme
1 parent 041e3ca commit 02f4819

5 files changed

Lines changed: 90 additions & 0 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Rebellion Template
2+
3+
[![Build and Test](https://github.com/10014Rebellion/rebellion-template/actions/workflows/build.yml/badge.svg)](https://github.com/10014Rebellion/rebellion-template/actions/workflows/build.yml)
4+
<!-- //TODO Update this URL so it points to the right repo -->
5+
6+
## Setting up the environment
7+
8+
### Requirements
9+
10+
- git (w/ git bash on Windows)
11+
- WPILib
12+
13+
### Installing
14+
15+
Open git bash or your sh of choice and run the following commands:
16+
17+
```sh
18+
git clone <the URL of this repository>.git
19+
cd <the name of the repository>
20+
./scripts/install-hooks.sh
21+
```
22+
23+
Then open the root directory of the repository in WPILib VSCode
24+
25+
## Flow
26+
27+
All code changes should happen on a branch, and then a PR should be opened and reviewed by multiple senior members or leads before being merged. Commits should contain a single set of related changes, and commit names should be descriptive of their contents. Err on the side of granularity when committing, as it's easier to clean up later. Push whenever code is in a reasonable state and prior to leaving. Pull often, and keep up with changes on `main` and other branches. Reviews should be thorough, lest you tear your hair out debugging later (do *not* LGTM). No code should go into `main` that hasn't been simulated thoroughly and/or tested on a robot, and no incomplete or in-progress code should be merged. All code should be formatted on build, and should follow WPILib command-based programming best practices.
28+
29+
## Lib Directory
30+
31+
The `lib` directory (`rebellion-template/src/main/java/frc/lib`) contains reusable files and utilities. This should be copy-paste-able between robot projects (relying on nothing outside the `lib` directory) and should be self contained. These files can be moved, added, or removed as needed.
32+
33+
## Github Pages Javadoc
34+
35+
A Github Action will automatically generate Javadocs for the robot project, which will live on the `javadocs` branch and be posted to the project's Github Pages site

scripts/check-gradlew.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
if [ ! -f ./gradlew ]; then
4+
echo "Error: Gradle wrapper not found. Please run this script from the root of the project."
5+
exit 1
6+
elif [ ! -x ./gradlew ]; then
7+
echo "Error: Gradle wrapper is not executable. Please make it executable with 'chmod +x ./gradlew'."
8+
exit 1
9+
fi
10+
11+
exit 0

scripts/hooks/pre-commit

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
./scripts/check-gradlew.sh
4+
if [ $? -ne 0 ]; then
5+
exit 1
6+
fi
7+
8+
echo ""
9+
echo "Checking if spotless needs to be run..."
10+
./gradlew spotlessCheck
11+
if [ $? -ne 0 ]; then
12+
echo "Spotless check failed. Running spotlessApply to fix formatting issues..."
13+
./gradlew spotlessApply
14+
echo "Error: Spotless has fixed the formatting issues. Please review the changes before committing."
15+
exit 1
16+
fi
17+
18+
echo ""
19+
exit 0

scripts/hooks/pre-push

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
./scripts/check-gradlew.sh
4+
if [ $? -ne 0 ]; then
5+
exit 1
6+
fi
7+
8+
echo ""
9+
echo "Building..."
10+
./gradlew assemble -x eventDeploy
11+
if [ $? -ne 0 ]; then
12+
echo "Error: Build failed. Please fix the errors before committing."
13+
exit 1
14+
fi
15+
16+
echo ""
17+
echo "Running tests..."
18+
./gradlew test -x eventDeploy
19+
if [ $? -ne 0 ]; then
20+
echo "Error: Tests failed. Please fix the errors before committing."
21+
exit 1
22+
fi
23+
24+
echo ""
25+
exit 0

src/main/deploy/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)