Skip to content

Commit

Permalink
Merge pull request #12 from team401/8-fix-ci-artifacts
Browse files Browse the repository at this point in the history
Fix CI and JitPack
  • Loading branch information
jkleiber authored Aug 21, 2024
2 parents f4dbc85 + 2a8158f commit 0b63e4c
Show file tree
Hide file tree
Showing 10 changed files with 442 additions and 87 deletions.
75 changes: 20 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ jobs:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
# - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
# artifact-name: Arm32
# build-options: "-Ponlylinuxarm32"
# - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
# artifact-name: Arm64
# build-options: "-Ponlylinuxarm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: ""
Expand All @@ -28,11 +22,18 @@ jobs:
with:
submodules: true
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}

- name: Fetch history and metadata
run: git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}

- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build --max-workers 1 ${{ matrix.build-options }}

- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
Expand All @@ -45,66 +46,30 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2022
- os: windows-latest
artifact-name: Win64
architecture: x64
- os: macos-12
artifact-name: macOS
architecture: x64
- os: ubuntu-latest
artifact-name: ubuntu
architecture: x64
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Fetch all history and metadata
run: git fetch --prune --unshallow
- uses: actions/setup-java@v3

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: '17'
distribution: 'temurin'
architecture: ${{ matrix.architecture }}

- name: Build with Gradle
run: ./gradlew build -Pbuildalldesktop
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs

combine:
name: Combine
needs: [build-docker, build-host]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v3
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Combine
# if: |
# !startsWith(github.ref, 'refs/tags/v')
run: ./gradlew publish -Pthirdparty
working-directory: combiner
# - name: Combine (Release)
# if: |
# github.repository_owner == 'wpilibsuite' &&
# startsWith(github.ref, 'refs/tags/v')
# run: |
# ./gradlew publish -Pthirdparty
# working-directory: combiner
# env:
# RUN_AZURE_ARTIFACTORY_RELEASE: 'TRUE'
# ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
# ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v3
with:
name: Maven
path: ~/releases
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ bin/


# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode

# Ignore Gradle build output directory
build

# Ignore Gradle build output directory
build

# Ignore auto-generated WPILib stuff.
wpi_interface/src/main/java/frc/robot/BuildConstants.java
4 changes: 2 additions & 2 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enableCppIntellisense": true,
"currentLanguage": "cpp",
"projectYear": "intellisense",
"teamNumber": 9999
}
"teamNumber": 401
}
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
allprojects {
version = '0.0'
group = 'com.github.team401'
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'

publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}
}
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ plugins {
}

rootProject.name = 'coppercore'
include('geometry, wpi_interface')
include('geometry', 'wpi_interface')
95 changes: 69 additions & 26 deletions wpi_interface/build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,84 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.7/userguide/building_java_projects.html in the Gradle documentation.
*/
import java.text.SimpleDateFormat

plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id "java"
id "maven-publish"
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.24.0"
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

// Set this to true to enable desktop support.
def includeDesktopSupport = true

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 5.
dependencies {
// Use JUnit Jupiter for testing.
testImplementation libs.junit.jupiter
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2024.3.2'
implementation 'edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:2024.3.2'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
}

// This dependency is exported to consumers, that is to say found on their compile classpath.
api libs.commons.math3
test {
useJUnitPlatform()
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
}

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation libs.guava
// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
project.compileJava.dependsOn(createVersionFile)
gversion {
srcDir = "src/main/java/"
classPackage = "frc.robot"
className = "BuildConstants"
dateFormat = "yyyy-MM-dd HH:mm:ss z"
timeZone = "America/New_York"
indent = " "
}

repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://frcmaven.wpi.edu/artifactory/release/'
}
gradlePluginPortal()
}

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
spotless {
// optional: limit format enforcement to just the files changed by this feature branch
ratchetFrom 'origin/main'

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '.gitattributes', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// Allow ignoring certain parts in formatting.
toggleOffOn()
// apply a specific flavor of google-java-format
googleJavaFormat('1.19.2').aosp().reflowLongStrings()
// fix formatting of type annotations
formatAnnotations()
}
}

// Automatically format code on build.
compileJava.dependsOn 'spotlessApply'
Loading

0 comments on commit 0b63e4c

Please sign in to comment.