mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Create combine job and offline vendordep ZIP (#1343)
* Create combine job * Update build.yml * Bump max workers in photonlib * Oops * actually kill entirely * Maybe fix test * Don't run tests * Update OpenCVTest.java * Update build.yml * Use upload-artifact@v4 * Update build.yml * Update build.yml
This commit is contained in:
65
.github/workflows/build.yml
vendored
65
.github/workflows/build.yml
vendored
@@ -55,13 +55,13 @@ jobs:
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew copyPhotonlib -x check
|
||||
./gradlew build -x check --max-workers 2
|
||||
./gradlew build -x check
|
||||
- name: Build C++ examples
|
||||
working-directory: photonlib-cpp-examples
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew copyPhotonlib -x check
|
||||
./gradlew build -x check --max-workers 2
|
||||
./gradlew build -x check
|
||||
build-gradle:
|
||||
name: "Gradle Build"
|
||||
runs-on: ubuntu-22.04
|
||||
@@ -83,11 +83,11 @@ jobs:
|
||||
- name: Gradle Build
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew photon-targeting:build photon-core:build photon-server:build -x check --max-workers 2
|
||||
./gradlew photon-targeting:build photon-core:build photon-server:build -x check
|
||||
- name: Gradle Tests
|
||||
run: ./gradlew testHeadless -i --max-workers 1 --stacktrace
|
||||
run: ./gradlew testHeadless -i --stacktrace
|
||||
- name: Gradle Coverage
|
||||
run: ./gradlew jacocoTestReport --max-workers 1
|
||||
run: ./gradlew jacocoTestReport
|
||||
- name: Publish Coverage Report
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
@@ -115,7 +115,7 @@ jobs:
|
||||
- name: Build the docs
|
||||
run: |
|
||||
make html
|
||||
- uses: actions/upload-artifact@master
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: built-docs
|
||||
path: build/html
|
||||
@@ -150,12 +150,19 @@ jobs:
|
||||
- run: git fetch --tags --force
|
||||
- run: |
|
||||
chmod +x gradlew
|
||||
./gradlew photon-targeting:build photon-lib:build --max-workers 1
|
||||
./gradlew photon-targeting:build photon-lib:build -Pbuildalldesktop -i
|
||||
- run: ./gradlew photon-lib:publish photon-targeting:publish
|
||||
name: Publish
|
||||
env:
|
||||
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
|
||||
if: github.event_name == 'push'
|
||||
# Copy artifacts to build/outputs/maven
|
||||
- run: ./gradlew photon-lib:publish photon-targeting:publish outputVersion -PcopyOfflineArtifacts
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: maven-${{ matrix.artifact-name }}
|
||||
path: build/outputs
|
||||
|
||||
build-photonlib-docker:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -163,10 +170,13 @@ jobs:
|
||||
include:
|
||||
- container: wpilib/roborio-cross-ubuntu:2024-22.04
|
||||
artifact-name: Athena
|
||||
build-options: "-Ponlylinuxathena"
|
||||
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
|
||||
artifact-name: Raspbian
|
||||
build-options: "-Ponlylinuxarm32"
|
||||
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
|
||||
artifact-name: Aarch64
|
||||
build-options: "-Ponlylinuxarm64"
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
container: ${{ matrix.container }}
|
||||
@@ -179,9 +189,10 @@ jobs:
|
||||
run: |
|
||||
git config --global --add safe.directory /__w/photonvision/photonvision
|
||||
- name: Build PhotonLib
|
||||
# We don't need to run tests, since we specify only non-native platforms
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew photon-targeting:build photon-lib:build --max-workers 1
|
||||
./gradlew photon-targeting:build photon-lib:build ${{ matrix.build-options }} -i -x test
|
||||
- name: Publish
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
@@ -189,6 +200,38 @@ jobs:
|
||||
env:
|
||||
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
|
||||
if: github.event_name == 'push'
|
||||
# Copy artifacts to build/outputs/maven
|
||||
- run: ./gradlew photon-lib:publish photon-targeting:publish outputVersion -PcopyOfflineArtifacts
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: maven-${{ matrix.artifact-name }}
|
||||
path: build/outputs
|
||||
|
||||
combine:
|
||||
name: Combine
|
||||
needs: [build-photonlib-docker, build-photonlib-host]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git fetch --tags --force
|
||||
# download all maven-* artifacts to outputs/
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
path: output
|
||||
pattern: maven-*
|
||||
- run: find .
|
||||
- run: zip -r photonlib-$(git describe --tags --match=v*).zip .
|
||||
name: ZIP stuff up
|
||||
working-directory: output
|
||||
- run: ls output
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: photonlib-offline
|
||||
path: output/*.zip
|
||||
|
||||
build-package:
|
||||
needs: [build-client, build-gradle, build-offline-docs]
|
||||
|
||||
@@ -248,11 +291,11 @@ jobs:
|
||||
path: photon-server/src/main/resources/web/docs
|
||||
- run: |
|
||||
chmod +x gradlew
|
||||
./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }}
|
||||
./gradlew photon-server:shadowJar -PArchOverride=${{ matrix.arch-override }}
|
||||
if: ${{ (matrix.arch-override != 'none') }}
|
||||
- run: |
|
||||
chmod +x gradlew
|
||||
./gradlew photon-server:shadowJar --max-workers 2
|
||||
./gradlew photon-server:shadowJar
|
||||
if: ${{ (matrix.arch-override == 'none') }}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -428,6 +471,7 @@ jobs:
|
||||
**/*.xz
|
||||
**/*.jar
|
||||
**/photonlib*.json
|
||||
**/photonlib*.zip
|
||||
if: github.event_name == 'push'
|
||||
# Upload all jars and xz archives
|
||||
- uses: softprops/action-gh-release@v1
|
||||
@@ -436,6 +480,7 @@ jobs:
|
||||
**/*.xz
|
||||
**/*.jar
|
||||
**/photonlib*.json
|
||||
**/photonlib*.zip
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
20
build.gradle
20
build.gradle
@@ -21,6 +21,9 @@ allprojects {
|
||||
wpilibRepositories.addAllDevelopmentRepositories(it)
|
||||
}
|
||||
|
||||
ext.localMavenURL = file("$project.buildDir/outputs/maven")
|
||||
ext.allOutputsFolder = file("$project.buildDir/outputs")
|
||||
|
||||
// Configure the version number.
|
||||
apply from: "versioningHelper.gradle"
|
||||
|
||||
@@ -57,6 +60,23 @@ ext {
|
||||
println("Publishing Photonlib to " + photonMavenURL)
|
||||
}
|
||||
|
||||
task outputVersion() {
|
||||
def versionFile = file("$allOutputsFolder/version.txt")
|
||||
|
||||
description = 'Prints the versions of wpilib to a file for use by the downstream packaging project'
|
||||
group = 'Build'
|
||||
outputs.files(versionFile)
|
||||
|
||||
doFirst {
|
||||
buildDir.mkdir()
|
||||
allOutputsFolder.mkdir()
|
||||
}
|
||||
|
||||
doLast {
|
||||
versionFile.write versionString
|
||||
}
|
||||
}
|
||||
|
||||
spotless {
|
||||
java {
|
||||
target fileTree('.') {
|
||||
|
||||
@@ -13,11 +13,11 @@ evaluationDependsOn ':photon-lib'
|
||||
|
||||
|
||||
def baseArtifactIdCpp = 'documentation'
|
||||
def artifactGroupIdCpp = 'org.photonvision.wpilibc'
|
||||
def artifactGroupIdCpp = 'org.photonvision.cppdocs'
|
||||
def zipBaseNameCpp = '_GROUP_org.photonvision_cpp_ID_documentation_CLS'
|
||||
|
||||
def baseArtifactIdJava = 'documentation'
|
||||
def artifactGroupIdJava = 'org.photonvision.wpilibj'
|
||||
def artifactGroupIdJava = 'org.photonvision.javadocs'
|
||||
def zipBaseNameJava = '_GROUP_org.photonvision_java_ID_documentation_CLS'
|
||||
|
||||
def outputsFolder = file("$project.buildDir/outputs")
|
||||
@@ -284,4 +284,11 @@ publishing {
|
||||
version pubVersion
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
// Just throw everything into build/maven
|
||||
url(localMavenURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,18 @@ task generateVendorJson() {
|
||||
build.mustRunAfter generateVendorJson
|
||||
publish.mustRunAfter generateVendorJson
|
||||
|
||||
task publishVendorJsonToLocalOutputs(type: Copy) {
|
||||
from photonlibFileOutput
|
||||
into "$allOutputsFolder/vendordeps/"
|
||||
|
||||
// Rename to match the name of the JSON we publish to maven to avoid user confusion
|
||||
rename { String fileName ->
|
||||
fileName.replace(".json", "-json-1.0.json")
|
||||
}
|
||||
|
||||
publish.dependsOn it
|
||||
}
|
||||
|
||||
task writeCurrentVersion {
|
||||
def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in")
|
||||
writePhotonVersionFile(versionFileIn, Path.of("$projectDir", "src", "main", "java", "org", "photonvision", "PhotonVersion.java"),
|
||||
@@ -203,7 +215,7 @@ model {
|
||||
|
||||
def vendorJson = artifacts.add('archives', file("$photonlibFileOutput"))
|
||||
|
||||
model {
|
||||
if (!project.hasProperty('copyOfflineArtifacts')) {
|
||||
// Publish the vendordep json
|
||||
publishing {
|
||||
publications {
|
||||
@@ -269,13 +281,16 @@ task combinedHeadersZip(type: Zip) {
|
||||
// Add the uberzip to our maven publications
|
||||
publishing {
|
||||
publications {
|
||||
combinedcpp(MavenPublication) {
|
||||
artifact combinedCppSourcesZip
|
||||
artifact combinedHeadersZip
|
||||
// Don't publish if we're creating an offline zip
|
||||
if (!project.hasProperty('copyOfflineArtifacts')) {
|
||||
combinedcpp(MavenPublication) {
|
||||
artifact combinedCppSourcesZip
|
||||
artifact combinedHeadersZip
|
||||
|
||||
artifactId = "${nativeName}-combinedcpp"
|
||||
groupId artifactGroupId
|
||||
version pubVersion
|
||||
artifactId = "${nativeName}-combinedcpp"
|
||||
groupId artifactGroupId
|
||||
version pubVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"ntServerAddress":"","connectionType":"DHCP","staticIp":"","hostname":"photonvision","runNTServer":false,"shouldManage":false}
|
||||
@@ -1 +0,0 @@
|
||||
[]
|
||||
@@ -1 +0,0 @@
|
||||
{"baseName":"aaaaaa","uniqueName":"aaaaaa","nickname":"aaaaaa","FOV":70.0,"path":"dev/vid","cameraType":"UsbCamera","currentPipelineIndex":0,"camPitch":{"radians":0.0},"calibrations":[], "cameraLEDs":[]}
|
||||
@@ -79,10 +79,16 @@ publishing {
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url(photonMavenURL)
|
||||
credentials {
|
||||
username 'ghactions'
|
||||
password System.getenv("ARTIFACTORY_API_KEY")
|
||||
// If we're trying to copy local outputs, just throw everything into build/maven
|
||||
// The problem here is we can't specify which repo to publish to easily, so we have to choose one or the other
|
||||
if (project.hasProperty('copyOfflineArtifacts')) {
|
||||
url(localMavenURL)
|
||||
} else {
|
||||
url(photonMavenURL)
|
||||
credentials {
|
||||
username 'ghactions'
|
||||
password System.getenv("ARTIFACTORY_API_KEY")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ task cppSourcesZip(type: Zip) {
|
||||
into '/'
|
||||
}
|
||||
|
||||
println("Sources: from $projectDir ")
|
||||
from("$projectDir/src/main/native/cpp") {
|
||||
into '/'
|
||||
}
|
||||
@@ -91,10 +90,16 @@ model {
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url(photonMavenURL)
|
||||
credentials {
|
||||
username 'ghactions'
|
||||
password System.getenv("ARTIFACTORY_API_KEY")
|
||||
// If we're trying to copy local outputs, just throw everything into build/maven
|
||||
// The problem here is we can't specify which repo to publish to easily, so we have to choose one or the other
|
||||
if (project.hasProperty('copyOfflineArtifacts')) {
|
||||
url(localMavenURL)
|
||||
} else {
|
||||
url(photonMavenURL)
|
||||
credentials {
|
||||
username 'ghactions'
|
||||
password System.getenv("ARTIFACTORY_API_KEY")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user