Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneHopkins11 committed Feb 23, 2024
2 parents 38b423f + 471c8f1 commit dd334e1
Show file tree
Hide file tree
Showing 29 changed files with 709 additions and 105 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Required for reviewing all commits
* @garrettsummerfi3ld
39 changes: 31 additions & 8 deletions .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a basic workflow to build robot code.
name: Build
name: Continuous Integration

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch.
Expand All @@ -15,8 +15,9 @@ concurrency:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# This job will build the robot code
build:
name: Build
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -34,12 +35,34 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Grant execute permission for gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew
uses: gradle/actions/setup-gradle@v3

# Runs a single command using the runners shell
- name: Compile and run tests on robot code
run: ./gradlew build
run: ./gradlew build

# This job will run through tests on the robot code
test:
name: Test
# 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 represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Declares the repository safe and not under dubious ownership.
- name: Add repository to git safe directories
run: git config --global --add safe.directory $GITHUB_WORKSPACE

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

# Runs a single command using the runners shell
- name: Run tests on robot code
run: ./gradlew test
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
- uses: actions/checkout@v4

# Runs an action from the Gradle org to validate the Gradle wrapper, see
# https://github.com/gradle/wrapper-validation-action/tree/v1/?tab=readme-ov-file#the-gradle-wrapper-problem-in-open-source
# https://github.com/gradle/wrapper-validation-action?tab=readme-ov-file#the-gradle-wrapper-problem-in-open-source
# for more details as to why this is important.
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/wrapper-validation-action@v2
15 changes: 9 additions & 6 deletions .github/workflows/syntax-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
pull_request:
branches: [ main ]

# Set permissions for the workflow
permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
Expand All @@ -19,11 +23,14 @@ jobs:
spotless:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# If the action is triggered by Dependabot, do not run these checks
if: ${{ github.actor != 'dependabot[bot]' }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 0

# Setup Java 17
Expand All @@ -34,11 +41,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Grant execute permission for gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew
uses: gradle/actions/setup-gradle@v3

# Runs our formatter for easier code review
- name: Run spotlessApply
Expand All @@ -48,4 +51,4 @@ jobs:
- name: Create commit of formatted code
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[Spotless] Apply formatting"
commit_message: "[Spotless] Apply formatting"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,6 @@ logs/

# Folder that has CTRE Phoenix Sim device config storage
ctre_sim/

# Build Constants for Git infomation
src/main/java/frc/robot/BuildConstants.java
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The source code for our 2024 FRC Robot for Cresendo. Prepackaged with GitHub Act

| Action | Status |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Build | [![Build](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/build.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/build.yml) |
| Qodana | [![Qodana](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/qodana.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/qodana.yml) |
| CodeQL | [![CodeQL Scanning](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/codeql.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/codeql.yml) |
| Spotless | [![Syntax Check](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/syntax-check.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/syntax-check.yml) |
| Gradle Validation | [![Validate Gradle Wrapper](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/gradle-wrapper-validation.yml) |
| CI | [![CI](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/ci.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/ci.yml) |
| Qodana | [![Qodana](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/qodana.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/qodana.yml) |
| CodeQL | [![CodeQL Scanning](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/codeql.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/codeql.yml) |
| Spotless | [![Syntax Check](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/syntax-check.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/syntax-check.yml) |
| Gradle Validation | [![Validate Gradle Wrapper](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/OakvilleDynamics/2024-Robot/actions/workflows/gradle-wrapper-validation.yml) |

## How to use

Expand All @@ -32,5 +32,5 @@ The source code for our 2024 FRC Robot for Cresendo. Prepackaged with GitHub Act

## Requirements

- WPILib 2024.1.1
- WPILib 2024.3.1
- Internet connection (for Gradle to download dependencies)
47 changes: 42 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.2.1"
id 'com.diffplug.spotless' version '6.25.0'
id "edu.wpi.first.GradleRIO" version "2024.3.1"
id "com.diffplug.spotless" version "6.25.0"
id "com.peterabeles.gversion" version "1.10.2"
}

sourceCompatibility = JavaVersion.VERSION_17
Expand Down Expand Up @@ -45,6 +46,20 @@ wpi.java.debugJni = false

// Set this to true to enable desktop support.
def includeDesktopSupport = true
repositories {
maven {
url = uri("https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit")
credentials {
username = "Mechanical-Advantage-Bot"
password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051"
}
}
mavenLocal()
}

configurations.all {
exclude group: "edu.wpi.first.wpilibj"
}

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 5.
Expand All @@ -66,9 +81,13 @@ dependencies {
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'

// AdvantageKit
def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
annotationProcessor "org.littletonrobotics.akit.junction:junction-autolog:$akitJson.version"
}

test {
Expand Down Expand Up @@ -103,6 +122,24 @@ tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

task(checkAkitInstall, dependsOn: "classes", type: JavaExec) {
mainClass = "org.littletonrobotics.junction.CheckInstall"
classpath = sourceSets.main.runtimeClasspath
}
compileJava.finalizedBy checkAkitInstall

project.compileJava.dependsOn(createVersionFile)
gversion {
srcDir = "src/main/java/"
classPackage = "frc.robot"
className = "BuildConstants"
dateFormat = "yyyy-MM-dd HH:mm:ss z"
timeZone = "America/Chicago" // Use preferred time zone
indent = " "
}
compileJava.dependsOn 'spotlessApply'


spotless {
java {
target fileTree('.') {
Expand Down
16 changes: 8 additions & 8 deletions src/main/deploy/swerve/modules/backleft.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"location": {
"front": -14.25,
"left": 14.25
"front": -13.5,
"left": 13.5
},
"absoluteEncoderOffset": 55.020,
"absoluteEncoderOffset": 276.15234375,
"drive": {
"type": "sparkmax",
"id": 7,
"id": 41,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 8,
"id": 42,
"canbus": null
},
"conversionFactor": {
Expand All @@ -20,11 +20,11 @@
},
"encoder": {
"type": "cancoder",
"id": 9,
"id": 43,
"canbus": null
},
"inverted": {
"drive": true,
"angle": true
"drive": false,
"angle": false
}
}
14 changes: 7 additions & 7 deletions src/main/deploy/swerve/modules/backright.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"location": {
"front": -14.25,
"left": -14.25
"front": -13.5,
"left": -13.5
},
"absoluteEncoderOffset": 298.740,
"absoluteEncoderOffset": 299.267578125,
"drive": {
"type": "sparkmax",
"id": 10,
"id": 11,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 11,
"id": 12,
"canbus": null
},
"conversionFactor": {
Expand All @@ -20,11 +20,11 @@
},
"encoder": {
"type": "cancoder",
"id": 12,
"id": 13,
"canbus": null
},
"inverted": {
"drive": false,
"angle": true
"angle": false
}
}
16 changes: 8 additions & 8 deletions src/main/deploy/swerve/modules/frontleft.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"location": {
"front": 14.25,
"left": 14.25
"front": 13.5,
"left": 13.5
},
"absoluteEncoderOffset": 185.977,
"absoluteEncoderOffset": 357.978515625,
"drive": {
"type": "sparkmax",
"id": 1,
"id": 31,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 2,
"id": 32,
"canbus": null
},
"conversionFactor": {
Expand All @@ -20,11 +20,11 @@
},
"encoder": {
"type": "cancoder",
"id": 3,
"id": 33,
"canbus": null
},
"inverted": {
"drive": true,
"angle": true
"drive": false,
"angle": false
}
}
14 changes: 7 additions & 7 deletions src/main/deploy/swerve/modules/frontright.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"location": {
"front": 14.25,
"left": -14.25
"front": 13.5,
"left": -13.5
},
"absoluteEncoderOffset": 88.330,
"absoluteEncoderOffset": 52.91015625,
"drive": {
"type": "sparkmax",
"id": 4,
"id": 21,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 5,
"id": 22,
"canbus": null
},
"conversionFactor": {
Expand All @@ -20,11 +20,11 @@
},
"encoder": {
"type": "cancoder",
"id": 6,
"id": 23,
"canbus": null
},
"inverted": {
"drive": false,
"angle": true
"angle": false
}
}
4 changes: 2 additions & 2 deletions src/main/deploy/swerve/modules/physicalproperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"optimalVoltage": 12,
"wheelGripCoefficientOfFriction": 1.19,
"currentLimit": {
"drive": 40,
"angle": 35
"drive": 25,
"angle": 30
},
"conversionFactor": {
"angle": 16.8,
Expand Down
Loading

0 comments on commit dd334e1

Please sign in to comment.