Skip to content

Commit

Permalink
Backport maven changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed May 29, 2024
1 parent c89acea commit 60c9ea8
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 125 deletions.
109 changes: 3 additions & 106 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Build

on:
push:
branches: [ master ]
branches:
- master
- backports/*
tags:
- 'v*'
pull_request:
Expand Down Expand Up @@ -336,108 +338,3 @@ jobs:
# our image better have java installed already
commands: |
java -jar ${{ matrix.extraOpts }} *.jar --smoketest
build-image:
needs: [build-package]

if: ${{ github.event_name != 'pull_request' }}

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact-name: LinuxArm64
image_suffix: RaspberryPi
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_raspi.img.xz
cpu: cortex-a7
image_additional_mb: 0
- os: ubuntu-latest
artifact-name: LinuxArm64
image_suffix: limelight2
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_limelight.img.xz
cpu: cortex-a7
image_additional_mb: 0
- os: ubuntu-latest
artifact-name: LinuxArm64
image_suffix: limelight3
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.5/photonvision_limelight3.img.xz
cpu: cortex-a7
image_additional_mb: 0
- os: ubuntu-latest
artifact-name: LinuxArm64
image_suffix: orangepi5
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.10/photonvision_opi5.img.xz
cpu: cortex-a8
image_additional_mb: 4096
- os: ubuntu-latest
artifact-name: LinuxArm64
image_suffix: orangepi5plus
image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.10/photonvision_opi5plus.img.xz
cpu: cortex-a8
image_additional_mb: 4096

runs-on: ${{ matrix.os }}
name: "Build image - ${{ matrix.image_url }}"

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: jar-${{ matrix.artifact-name }}
- uses: pguyot/arm-runner-action@v2
name: Generate image
id: generate_image
with:
base_image: ${{ matrix.image_url }}
image_additional_mb: ${{ matrix.image_additional_mb }}
optimize_image: yes
cpu: ${{ matrix.cpu }}
# We do _not_ wanna copy photon into the image. Bind mount instead
bind_mount_repository: true
commands: |
chmod +x scripts/armrunner.sh
./scripts/armrunner.sh
- name: Compress image
run: |
new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar))
new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}")
mv ${{ steps.generate_image.outputs.image }} $new_image_name
sudo xz -T 0 -v $new_image_name
- uses: actions/upload-artifact@v4
name: Upload image
with:
name: image-${{ matrix.image_suffix }}
path: photonvision*.xz
release:
needs: [build-package, build-image]
runs-on: ubuntu-22.04
steps:
# Download literally every single artifact. This also downloads client and docs,
# but the filtering below won't pick these up (I hope)
- uses: actions/download-artifact@v4
- run: find
# Push to dev release
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'Dev'
rm: true
files: |
**/*.xz
**/*.jar
**/photonlib*.json
if: github.event_name == 'push'
# Upload all jars and xz archives
- uses: softprops/action-gh-release@v1
with:
files: |
**/*.xz
**/*.jar
**/photonlib*.json
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 11 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
maven { url = "https://maven.photonvision.org/repository/internal/" }
maven { url = "https://maven.photonvision.org/repository/snapshots/" }
maven { url = "https://maven.photonvision.org/releases" }
maven { url = "https://maven.photonvision.org/snapshots" }
maven { url = "https://jogamp.org/deployment/maven/" }
}
wpilibRepositories.addAllReleaseRepositories(it)
wpilibRepositories.addAllDevelopmentRepositories(it)
Expand All @@ -27,12 +28,12 @@ ext {
wpilibVersion = "2024.3.2"
wpimathVersion = wpilibVersion
openCVversion = "4.8.0-2"
joglVersion = "2.4.0-rc-20200307"
joglVersion = "2.4.0"
javalinVersion = "5.6.2"
photonGlDriverLibVersion = "dev-v2023.1.0-9-g75fc678"
rknnVersion = "dev-v2024.0.0-64-gc0836a6"
photonGlDriverLibVersion = "dev-v2023.1.0-11-g2b7036f"
rknnVersion = "dev-v2024.0.1-4-g0db16ac"
frcYear = "2024"
mrcalVersion = "dev-v2024.0.0-18-gb903a09";
mrcalVersion = "dev-v2024.0.0-24-gc1efcf0";


pubVersion = versionString
Expand All @@ -50,6 +51,10 @@ ext {
println("Building for platform " + jniPlatform + " wpilib: " + wpilibNativeName)
println("Using Wpilib: " + wpilibVersion)
println("Using OpenCV: " + openCVversion)


photonMavenURL = 'https://maven.photonvision.org/' + (isDev ? 'snapshots' : 'releases');
println("Publishing Photonlib to " + photonMavenURL)
}

spotless {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ protected CameraCalibrationCoefficients calibrateMrcal(
int imageWidth = (int) in.get(0).size.width;
int imageHeight = (int) in.get(0).size.height;

MrCalResult result =
MrCalJNI.calibrateCamera(
corner_locations,
params.boardWidth,
params.boardHeight,
params.squareSize,
imageWidth,
imageHeight,
(fxGuess + fyGuess) / 2.0);
MrCalResult result = null;
// MrCalJNI.calibrateCamera(
// corner_locations,
// params.boardWidth,
// params.boardHeight,
// params.squareSize,
// imageWidth,
// imageHeight,
// (fxGuess + fyGuess) / 2.0);

// intrinsics are fx fy cx cy from mrcal
JsonMatOfDouble cameraMatrixMat =
Expand Down
34 changes: 34 additions & 0 deletions photon-lib/src/generate/native/cpp/PhotonVersion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) Photon Vision.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <string.h>
#include <regex>

/*
* Autogenerated file! Do not manually edit this file. This version is
* regenerated any time the publish task is run, or when this file is deleted.
*/

static const char* dev_ = "dev";

namespace photon {
namespace PhotonVersion {
const char* versionString = "dev-v2024.3.1-22-g38e2fdef";
const char* buildDate = "2024-5-29 10:05:11";
const bool isRelease = strncmp(dev_, versionString, strlen(dev_)) != 0;
}
}
2 changes: 1 addition & 1 deletion photonlib-cpp-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
maven { url = "https://maven.photonvision.org/repository/internal/" }
maven { url = "https://maven.photonvision.org/releases" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion photonlib-java-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
maven { url = "https://maven.photonvision.org/repository/internal/" }
maven { url = "https://maven.photonvision.org/releases" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion shared/javacommon.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ publishing {

repositories {
maven {
url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal'))
url(photonMavenURL)
credentials {
username 'ghactions'
password System.getenv("ARTIFACTORY_API_KEY")
Expand Down
2 changes: 1 addition & 1 deletion shared/javacpp/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ model {

repositories {
maven {
url ('https://maven.photonvision.org/repository/' + (isDev ? 'snapshots' : 'internal'))
url(photonMavenURL)
credentials {
username 'ghactions'
password System.getenv("ARTIFACTORY_API_KEY")
Expand Down

0 comments on commit 60c9ea8

Please sign in to comment.