From 472e809e490be2fb1a7888449b2b7c95173a922c Mon Sep 17 00:00:00 2001 From: judsonjames Date: Mon, 8 Jan 2024 21:14:26 -0500 Subject: [PATCH 01/23] Added manual partition management to ensure OrangePi can use temp folder --- scripts/generatePiImage.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index b068a2ea48..13c7e43431 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -34,8 +34,29 @@ fi echo "Unziped image: " $IMAGE_FILE " -- mounting" TMP=$(mktemp -d) LOOP=$(sudo losetup --show -fP "${IMAGE_FILE}") +PARTITION="${LOOP}p2" + +echo "Confirming that loop partition exists" +if ! lsblk | grep -q "$(basename $PARTITION)"; then + echo "Loop device was not found in lsblk output." + sudo parted $LOOP mklabel msdos + + sudo parted $LOOP mkpart primary ext4 0% 50% + sudo mkfs.ext4 "${LOOP}p1" + + sudo parted $LOOP mkpart primary ext4 50% 100% + sudo mkfs.ext4 $PARTITION + + if ! lsblk | grep -q "$(basename $PARTITION)"; then + echo "Failed to create partition. Exiting." + exit 1 + fi + + echo "Created loop device partition" +fi + echo "Image mounted! Copying jar..." -sudo mount ${LOOP}p2 $TMP +sudo mount $PARTITION $TMP pushd . cd $TMP/opt/photonvision sudo cp $NEW_JAR photonvision.jar From c70e5ca216e6254bcaaa470965cf1030b63134b6 Mon Sep 17 00:00:00 2001 From: Judson James Date: Mon, 8 Jan 2024 21:27:48 -0500 Subject: [PATCH 02/23] Create orangepi-image-generation.yml --- .../workflows/orangepi-image-generation.yml | 332 ++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 .github/workflows/orangepi-image-generation.yml diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml new file mode 100644 index 0000000000..0b627bbd95 --- /dev/null +++ b/.github/workflows/orangepi-image-generation.yml @@ -0,0 +1,332 @@ +name: Build + +on: + push: + branches: [ fixes/orangepi-image-generation ] + tags: + - 'v*' + pull_request: + branches: [ fixes/orangepi-image-generation ] + +jobs: + build-client: + name: "PhotonClient Build" + defaults: + run: + working-directory: photon-client + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Dependencies + run: npm ci + - name: Build Production Client + run: npm run build + - uses: actions/upload-artifact@v4 + with: + name: built-client + path: photon-client/dist/ + build-examples: + name: "Build Examples" + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags --force + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + # Need to publish to maven local first, so that C++ sim can pick it up + # Still haven't figured out how to make the vendordep file be copied before trying to build examples + - name: Publish photonlib to maven local + run: | + chmod +x gradlew + ./gradlew publishtomavenlocal -x check + - name: Build Java examples + working-directory: photonlib-java-examples + run: | + chmod +x gradlew + ./gradlew copyPhotonlib -x check + ./gradlew build -x check --max-workers 2 + - name: Build C++ examples + working-directory: photonlib-cpp-examples + run: | + chmod +x gradlew + ./gradlew copyPhotonlib -x check + ./gradlew build -x check --max-workers 2 + build-gradle: + name: "Gradle Build" + runs-on: ubuntu-22.04 + steps: + # Checkout code. + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags --force + - name: Install Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - name: Install mrcal deps + run: sudo apt-get update && sudo apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5 + - name: Gradle Build + run: | + chmod +x gradlew + ./gradlew build -x check --max-workers 2 + - name: Gradle Tests + run: ./gradlew testHeadless -i --max-workers 1 --stacktrace + - name: Gradle Coverage + run: ./gradlew jacocoTestReport --max-workers 1 + - name: Publish Coverage Report + uses: codecov/codecov-action@v3 + with: + file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml + - name: Publish Core Coverage Report + uses: codecov/codecov-action@v3 + with: + file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml + build-offline-docs: + name: "Build Offline Docs" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + repository: 'PhotonVision/photonvision-docs.git' + ref: master + - uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 + pip install -r requirements.txt + - name: Build the docs + run: | + make html + - uses: actions/upload-artifact@master + with: + name: built-docs + path: build/html + build-photonlib-host: + env: + MACOSX_DEPLOYMENT_TARGET: 12 + strategy: + fail-fast: false + matrix: + include: + - os: windows-2022 + artifact-name: Win64 + architecture: x64 + - os: macos-12 + artifact-name: macOS + architecture: x64 + - os: ubuntu-22.04 + artifact-name: Linux + + name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: git fetch --tags --force + - run: | + chmod +x gradlew + ./gradlew photon-lib:build --max-workers 1 + - run: ./gradlew photon-lib:publish photon-targeting:publish + name: Publish + env: + ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} + if: github.event_name == 'push' + build-photonlib-docker: + strategy: + fail-fast: false + matrix: + include: + - container: wpilib/roborio-cross-ubuntu:2024-22.04 + artifact-name: Athena + - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 + artifact-name: Raspbian + - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 + artifact-name: Aarch64 + + runs-on: ubuntu-22.04 + container: ${{ matrix.container }} + name: "Photonlib - Build Docker - ${{ matrix.artifact-name }}" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Config Git + run: | + git config --global --add safe.directory /__w/photonvision/photonvision + - name: Build PhotonLib + run: | + chmod +x gradlew + ./gradlew photon-lib:build --max-workers 1 + - name: Publish + run: | + chmod +x gradlew + ./gradlew photon-lib:publish photon-targeting:publish + env: + ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} + if: github.event_name == 'push' + build-package: + needs: [build-client, build-gradle, build-offline-docs] + + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + artifact-name: Win64 + architecture: x64 + arch-override: none + - os: macos-latest + artifact-name: macOS + architecture: x64 + arch-override: none + - os: ubuntu-latest + artifact-name: Linux + architecture: x64 + arch-override: none + - os: macos-latest + artifact-name: macOSArm + architecture: x64 + arch-override: macarm64 + - os: ubuntu-latest + artifact-name: LinuxArm32 + architecture: x64 + arch-override: linuxarm32 + - os: ubuntu-latest + artifact-name: LinuxArm64 + architecture: x64 + arch-override: linuxarm64 + + runs-on: ${{ matrix.os }} + name: "Build fat JAR - ${{ matrix.artifact-name }}" + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: | + rm -rf photon-server/src/main/resources/web/* + mkdir -p photon-server/src/main/resources/web/docs + if: ${{ (matrix.os) != 'windows-latest' }} + - run: | + del photon-server\src\main\resources\web\*.* + mkdir photon-server\src\main\resources\web\docs + if: ${{ (matrix.os) == 'windows-latest' }} + - uses: actions/download-artifact@v4 + with: + name: built-client + path: photon-server/src/main/resources/web/ + - uses: actions/download-artifact@v4 + with: + name: built-docs + path: photon-server/src/main/resources/web/docs + - run: | + chmod +x gradlew + ./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }} + if: ${{ (matrix.arch-override != 'none') }} + - run: | + chmod +x gradlew + ./gradlew photon-server:shadowJar --max-workers 2 + if: ${{ (matrix.arch-override == 'none') }} + - uses: actions/upload-artifact@v4 + with: + name: jar-${{ matrix.artifact-name }} + path: photon-server/build/libs + 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 + - 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 + - os: ubuntu-latest + artifact-name: LinuxArm64 + image_suffix: orangepi5 + image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.img.xz + + 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 }} + # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. + - name: Generate image + run: | + chmod +x scripts/generatePiImage.sh + ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - 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 + if: github.event_name == 'push' + # Upload all jars and xz archives + - uses: softprops/action-gh-release@v1 + with: + files: | + **/*.xz + **/*.jar + if: startsWith(github.ref, 'refs/tags/v') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6ec7c5eaa33e5b2f41af72c56cc88a5bfb94bee7 Mon Sep 17 00:00:00 2001 From: Judson James Date: Mon, 8 Jan 2024 21:53:09 -0500 Subject: [PATCH 03/23] Temporarily force images to be build --- .github/workflows/orangepi-image-generation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 0b627bbd95..f584debb54 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -263,7 +263,7 @@ jobs: build-image: needs: [build-package] - if: ${{ github.event_name != 'pull_request' }} + # if: ${{ github.event_name != 'pull_request' }} strategy: fail-fast: false From 682b770e95b5d7f68607a386e3bb095421009ddf Mon Sep 17 00:00:00 2001 From: judsonjames Date: Mon, 8 Jan 2024 23:36:38 -0500 Subject: [PATCH 04/23] Add functions for pushd and popd since OPi5 image doesn't have them --- scripts/generatePiImage.sh | 59 ++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index 13c7e43431..468e7fdff9 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -6,6 +6,32 @@ fi # 1st arg should be the release to download the image template from. The release ought to only have one # artifact for a "xz" image. +# These are workarounds for the OrangePi. The current image does not use `pushd`, `popd` or `dirs`. +DIR_STACK="" + +opi_pushd() { + if [ $# -eq 0 ]; then + echo "Directory stack:" + for dir in ${DIR_STACK[@]}; do + echo "- $dir" + done + else + DIR_STACK="$DIR_STACK $PWD" + cd "$1" + fi +} + +opi_popd() { + if [ -z $DIR_STACK ]; then + echo "No directories" + else + LAST_ITEM=$(echo "$my_list" | awk '{print $NF}') + POPPED_LIST="${DIR_STACK% *}" + cd "$LAST_ITEM" + DIR_STACK=$POPPED_LIST + fi +} + NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) echo "Using jar: " $NEW_JAR echo "Downloading image from" $1 @@ -41,15 +67,15 @@ if ! lsblk | grep -q "$(basename $PARTITION)"; then echo "Loop device was not found in lsblk output." sudo parted $LOOP mklabel msdos - sudo parted $LOOP mkpart primary ext4 0% 50% - sudo mkfs.ext4 "${LOOP}p1" + sudo parted $LOOP mkpart primary ext4 0% 50% > /dev/null 2>&1 + sudo mkfs.ext4 "${LOOP}p1" > /dev/null 2>&1 - sudo parted $LOOP mkpart primary ext4 50% 100% - sudo mkfs.ext4 $PARTITION + sudo parted $LOOP mkpart primary ext4 50% 100% > /dev/null 2>&1 + sudo mkfs.ext4 $PARTITION > /dev/null 2>&1 if ! lsblk | grep -q "$(basename $PARTITION)"; then echo "Failed to create partition. Exiting." - exit 1 + exit 1 fi echo "Created loop device partition" @@ -57,13 +83,30 @@ fi echo "Image mounted! Copying jar..." sudo mount $PARTITION $TMP + + +DIR_STACK="" +if ! command -v pushd > /dev/null 2>&1; then + alias pushd='opi_pushd' +fi + +if ! command -v popd > /dev/null 2>&1; then + alias popd='opi_popd' +fi + pushd . -cd $TMP/opt/photonvision + +DEST_PV_LOCATION=$TMP/opt/photonvision + +sudo mkdir -p $DEST_PV_LOCATION +cd $DEST_PV_LOCATION sudo cp $NEW_JAR photonvision.jar echo "Jar updated! Creating service..." -cd $TMP/etc/systemd/system/multi-user.target.wants +DEST_TARGET_WANTS=$TMP/etc/systemd/system/multi-user.target.wants +sudo mkdir -p $DEST_TARGET_WANTS +cd $DEST_TARGET_WANTS sudo bash -c "printf \ \"[Unit] Description=Service that runs PhotonVision @@ -89,4 +132,4 @@ NEW_IMAGE=$(basename "${NEW_JAR/.jar/_$2.img}") echo "Renaming image " $IMAGE_FILE " -> " $NEW_IMAGE mv $IMAGE_FILE $NEW_IMAGE xz -T0 -v -z $NEW_IMAGE -mv $NEW_IMAGE.xz $(basename "${NEW_JAR/.jar/-image_$2.xz}") +mv $NEW_IMAGE.xz $(basename "${NEW_JAR/.jar/-image_$2.xz}") \ No newline at end of file From ef81a7c44fac28a36272e9169ad05484a4e83e39 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 00:09:13 -0500 Subject: [PATCH 05/23] Add logging to help figure out what's silently failing in CI --- scripts/generatePiImage.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index 468e7fdff9..8c8233079a 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -12,12 +12,14 @@ DIR_STACK="" opi_pushd() { if [ $# -eq 0 ]; then echo "Directory stack:" - for dir in ${DIR_STACK[@]}; do + for dir in $DIR_STACK; do echo "- $dir" done else DIR_STACK="$DIR_STACK $PWD" - cd "$1" + cd "$1" || return + # debugging only + echo "Added ${1} to the directory stack" fi } @@ -27,6 +29,11 @@ opi_popd() { else LAST_ITEM=$(echo "$my_list" | awk '{print $NF}') POPPED_LIST="${DIR_STACK% *}" + + # debugging only + echo "Removed ${LAST_ITEM} from the directory stack." + echo "Reassigning the DIR_STACK to `$POPPED_LIST`" + cd "$LAST_ITEM" DIR_STACK=$POPPED_LIST fi @@ -64,7 +71,7 @@ PARTITION="${LOOP}p2" echo "Confirming that loop partition exists" if ! lsblk | grep -q "$(basename $PARTITION)"; then - echo "Loop device was not found in lsblk output." + echo "Loop device was not found in lsblk output. Creating it now." sudo parted $LOOP mklabel msdos sudo parted $LOOP mkpart primary ext4 0% 50% > /dev/null 2>&1 From 22788b7705fb38aba0bca6e010ccbadee34ec86f Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 00:20:15 -0500 Subject: [PATCH 06/23] Update ARM builds to use ARM Builder --- .github/workflows/orangepi-image-generation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index f584debb54..cb715701fd 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -294,7 +294,8 @@ jobs: with: name: jar-${{ matrix.artifact-name }} # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - name: Generate image + - uses: pguyot/arm-runner-action@v2 + name: Generate image run: | chmod +x scripts/generatePiImage.sh ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} From af873140ca6e65fc94083efea608f4458b127575 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 00:24:39 -0500 Subject: [PATCH 07/23] Fix arm-runner-action syntax --- .github/workflows/orangepi-image-generation.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index cb715701fd..21d38eb32e 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -296,9 +296,10 @@ jobs: # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - uses: pguyot/arm-runner-action@v2 name: Generate image - run: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + with: + commands: | + chmod +x scripts/generatePiImage.sh + ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - uses: actions/upload-artifact@v4 name: Upload image with: From 3eaf33680f22d87ab88965a92d216c56b31ca3a3 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 00:50:07 -0500 Subject: [PATCH 08/23] Logging --- .github/workflows/orangepi-image-generation.yml | 10 ++++------ scripts/generatePiImage.sh | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 21d38eb32e..f584debb54 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -294,12 +294,10 @@ jobs: with: name: jar-${{ matrix.artifact-name }} # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - uses: pguyot/arm-runner-action@v2 - name: Generate image - with: - commands: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - name: Generate image + run: | + chmod +x scripts/generatePiImage.sh + ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - uses: actions/upload-artifact@v4 name: Upload image with: diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index 8c8233079a..8050a30ead 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -92,12 +92,13 @@ echo "Image mounted! Copying jar..." sudo mount $PARTITION $TMP -DIR_STACK="" if ! command -v pushd > /dev/null 2>&1; then + echo "Overwriting pushd because it doesn't exist." alias pushd='opi_pushd' fi if ! command -v popd > /dev/null 2>&1; then + echo "Overwriting popd because it doesn't exist." alias popd='opi_popd' fi From e76035bcba15ce5c5638e86e814890c2b93b9644 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 01:09:45 -0500 Subject: [PATCH 09/23] Testing ARM Runner with base commands --- .../workflows/orangepi-image-generation.yml | 11 +++-- scripts/generatePiImage.sh | 44 +++++++++---------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index f584debb54..4ddffb87cc 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -294,10 +294,13 @@ jobs: with: name: jar-${{ matrix.artifact-name }} # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - name: Generate image - run: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - uses: pguyot/arm-runner-action@v2 + name: Generate image + with: + base_image: ${{ matrix.image_url }} + commands: | + chmod +x scripts/generatePiImage.sh + ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - uses: actions/upload-artifact@v4 name: Upload image with: diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index 8050a30ead..d6ee8e507a 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -69,38 +69,38 @@ TMP=$(mktemp -d) LOOP=$(sudo losetup --show -fP "${IMAGE_FILE}") PARTITION="${LOOP}p2" -echo "Confirming that loop partition exists" -if ! lsblk | grep -q "$(basename $PARTITION)"; then - echo "Loop device was not found in lsblk output. Creating it now." - sudo parted $LOOP mklabel msdos +# echo "Confirming that loop partition exists" +# if ! lsblk | grep -q "$(basename $PARTITION)"; then +# echo "Loop device was not found in lsblk output. Creating it now." +# sudo parted $LOOP mklabel msdos - sudo parted $LOOP mkpart primary ext4 0% 50% > /dev/null 2>&1 - sudo mkfs.ext4 "${LOOP}p1" > /dev/null 2>&1 +# sudo parted $LOOP mkpart primary ext4 0% 50% > /dev/null 2>&1 +# sudo mkfs.ext4 "${LOOP}p1" > /dev/null 2>&1 - sudo parted $LOOP mkpart primary ext4 50% 100% > /dev/null 2>&1 - sudo mkfs.ext4 $PARTITION > /dev/null 2>&1 +# sudo parted $LOOP mkpart primary ext4 50% 100% > /dev/null 2>&1 +# sudo mkfs.ext4 $PARTITION > /dev/null 2>&1 - if ! lsblk | grep -q "$(basename $PARTITION)"; then - echo "Failed to create partition. Exiting." - exit 1 - fi +# if ! lsblk | grep -q "$(basename $PARTITION)"; then +# echo "Failed to create partition. Exiting." +# exit 1 +# fi - echo "Created loop device partition" -fi +# echo "Created loop device partition" +# fi echo "Image mounted! Copying jar..." sudo mount $PARTITION $TMP -if ! command -v pushd > /dev/null 2>&1; then - echo "Overwriting pushd because it doesn't exist." - alias pushd='opi_pushd' -fi +# if ! command -v pushd > /dev/null 2>&1; then +# echo "Overwriting pushd because it doesn't exist." +# alias pushd='opi_pushd' +# fi -if ! command -v popd > /dev/null 2>&1; then - echo "Overwriting popd because it doesn't exist." - alias popd='opi_popd' -fi +# if ! command -v popd > /dev/null 2>&1; then +# echo "Overwriting popd because it doesn't exist." +# alias popd='opi_popd' +# fi pushd . From 0a10ae9c85f2b71b86a1796618bbb6607c86f76a Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 01:23:56 -0500 Subject: [PATCH 10/23] Testing ARM Runner with DietPi --- .github/workflows/orangepi-image-generation.yml | 2 +- scripts/generatePiImage.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 4ddffb87cc..514b905ff2 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -1,4 +1,4 @@ -name: Build +name: "OPi Test Build" on: push: diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index d6ee8e507a..f3d7bb188e 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -27,7 +27,7 @@ opi_popd() { if [ -z $DIR_STACK ]; then echo "No directories" else - LAST_ITEM=$(echo "$my_list" | awk '{print $NF}') + LAST_ITEM=$(echo "$DIR_STACK" | awk '{print $NF}') POPPED_LIST="${DIR_STACK% *}" # debugging only From 410767bb7ff8b53f9bfeec4af25019ee810057d1 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 01:42:10 -0500 Subject: [PATCH 11/23] Testing ARM Runner with Minimal Install Script --- .../workflows/orangepi-image-generation.yml | 6 ++-- scripts/arm_runner_installer.sh | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 scripts/arm_runner_installer.sh diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 514b905ff2..977e813bab 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -299,8 +299,10 @@ jobs: with: base_image: ${{ matrix.image_url }} commands: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + chmod +x scripts/arm_runner_installer.sh + ./scripts/arm_runner_installer.sh + # chmod +x scripts/generatePiImage.sh + # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - uses: actions/upload-artifact@v4 name: Upload image with: diff --git a/scripts/arm_runner_installer.sh b/scripts/arm_runner_installer.sh new file mode 100644 index 0000000000..e53d6dcc35 --- /dev/null +++ b/scripts/arm_runner_installer.sh @@ -0,0 +1,30 @@ +### +# Alternative ARM Runner installer to setup PhotonVision service files and JAR. +### + +NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) +echo "Using jar: " $NEW_JAR + +DEST_PV_LOCATION=/etc/photonvision +sudo mkdir -p $DEST_PV_LOCATION +sudo cp $NEW_JAR ${DEST_PV_LOCATION}/photonvision.jar + +TARGET_WANTS=/etc/systemd/system/multi-user.target.wants +sudo mkdir -p $TARGET_WANTS +cd $TARGET_WANTS +sudo bash -c "printf \ +\"[Unit] +Description=Service that runs PhotonVision + +[Service] +WorkingDirectory=/opt/photonvision +ExecStart=/usr/bin/java -Xmx512m -jar /opt/photonvision/photonvision.jar +ExecStop=/bin/systemctl kill photonvision +Type=simple +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=multi-user.target\" > photonvision.service" + +echo "Service created!" \ No newline at end of file From dcc1d720203dcb4071292c7067cc8a7248ebe3b4 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 02:05:09 -0500 Subject: [PATCH 12/23] Add Compression step to get .xz images --- scripts/arm_runner_installer.sh | 1 + scripts/generatePiImage.sh | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/arm_runner_installer.sh b/scripts/arm_runner_installer.sh index e53d6dcc35..eb31833b07 100644 --- a/scripts/arm_runner_installer.sh +++ b/scripts/arm_runner_installer.sh @@ -1,6 +1,7 @@ ### # Alternative ARM Runner installer to setup PhotonVision service files and JAR. ### +echo "[INFO] Using ARM Runner minimal instruction set" NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) echo "Using jar: " $NEW_JAR diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index f3d7bb188e..d47ba23781 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -92,15 +92,15 @@ echo "Image mounted! Copying jar..." sudo mount $PARTITION $TMP -# if ! command -v pushd > /dev/null 2>&1; then -# echo "Overwriting pushd because it doesn't exist." -# alias pushd='opi_pushd' -# fi +if ! command -v pushd > /dev/null 2>&1; then + echo "Overwriting pushd because it doesn't exist." + alias pushd='opi_pushd' +fi -# if ! command -v popd > /dev/null 2>&1; then -# echo "Overwriting popd because it doesn't exist." -# alias popd='opi_popd' -# fi +if ! command -v popd > /dev/null 2>&1; then + echo "Overwriting popd because it doesn't exist." + alias popd='opi_popd' +fi pushd . From 5f18d0e4d3f9762756c8a149d752dcaac17f2e21 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 02:23:46 -0500 Subject: [PATCH 13/23] Attempt to fix CPU lookup for OrangePi --- .github/workflows/orangepi-image-generation.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 977e813bab..e14fb08204 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -273,14 +273,17 @@ jobs: 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 - 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 - os: ubuntu-latest artifact-name: LinuxArm64 image_suffix: orangepi5 image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.img.xz + cpu: cortex-a8 runs-on: ${{ matrix.os }} name: "Build image - ${{ matrix.image_url }}" @@ -296,13 +299,22 @@ jobs: # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - uses: pguyot/arm-runner-action@v2 name: Generate image + id: generate_image with: base_image: ${{ matrix.image_url }} + image_additional_mb: 8196 + cpu: ${{ matrix.cpu }} commands: | chmod +x scripts/arm_runner_installer.sh ./scripts/arm_runner_installer.sh # chmod +x scripts/generatePiImage.sh # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - name: Compress image + run: | + new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) + new_image_name=$(basename "${new_jar/.jar/_$2.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: From 6d35346044123442b72b7548b263abee2df0051f Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 02:50:19 -0500 Subject: [PATCH 14/23] Re-enforce logging and reduce size of final XZ images --- .github/workflows/orangepi-image-generation.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index e14fb08204..b455a05d67 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -302,7 +302,7 @@ jobs: id: generate_image with: base_image: ${{ matrix.image_url }} - image_additional_mb: 8196 + optimize_image: yes cpu: ${{ matrix.cpu }} commands: | chmod +x scripts/arm_runner_installer.sh @@ -312,7 +312,8 @@ jobs: - name: Compress image run: | new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) - new_image_name=$(basename "${new_jar/.jar/_$2.img}") + new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}") + echo "[INFO] installed the following version :: $new_jar" mv ${{ steps.generate_image.outputs.image }} $new_image_name sudo xz -T 0 -v $new_image_name - uses: actions/upload-artifact@v4 From c72da436e1fe9612c0e6a759720b6153df63b175 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 03:11:20 -0500 Subject: [PATCH 15/23] Re-re-enlarge OPi build to make passing build --- .github/workflows/orangepi-image-generation.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index b455a05d67..0d4259a7db 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -274,16 +274,19 @@ jobs: 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: orangepi5 image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.img.xz cpu: cortex-a8 + image_additional_mb: 4096 runs-on: ${{ matrix.os }} name: "Build image - ${{ matrix.image_url }}" @@ -302,6 +305,7 @@ jobs: id: generate_image with: base_image: ${{ matrix.image_url }} + image_additional_mb: 4096 optimize_image: yes cpu: ${{ matrix.cpu }} commands: | From 28400cd0961f5921255111ddd473a420c88e3c1b Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 03:38:13 -0500 Subject: [PATCH 16/23] Fix where the PhotonVision JAR lives --- scripts/arm_runner_installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/arm_runner_installer.sh b/scripts/arm_runner_installer.sh index eb31833b07..33339a579d 100644 --- a/scripts/arm_runner_installer.sh +++ b/scripts/arm_runner_installer.sh @@ -4,9 +4,9 @@ echo "[INFO] Using ARM Runner minimal instruction set" NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) -echo "Using jar: " $NEW_JAR +echo "Using jar: " $(basename $NEW_JAR) -DEST_PV_LOCATION=/etc/photonvision +DEST_PV_LOCATION=/opt/photonvision sudo mkdir -p $DEST_PV_LOCATION sudo cp $NEW_JAR ${DEST_PV_LOCATION}/photonvision.jar From af47c7633af1b63d6c133a261d7992fcfa519f0f Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 04:13:23 -0500 Subject: [PATCH 17/23] Revert unneeded files. Cleanup repo before review. --- .github/workflows/build.yml | 26 +- .../workflows/orangepi-image-generation.yml | 354 ------------------ .../{arm_runner_installer.sh => armrunner.sh} | 5 +- scripts/generatePiImage.sh | 78 +--- 4 files changed, 27 insertions(+), 436 deletions(-) delete mode 100644 .github/workflows/orangepi-image-generation.yml rename scripts/{arm_runner_installer.sh => armrunner.sh} (91%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f8606189d..48750bef58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -273,14 +273,20 @@ jobs: 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: orangepi5 image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.img.xz + cpu: cortex-a8 + image_additional_mb: 4096 runs-on: ${{ matrix.os }} name: "Build image - ${{ matrix.image_url }}" @@ -293,11 +299,23 @@ jobs: - uses: actions/download-artifact@v4 with: name: jar-${{ matrix.artifact-name }} - # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - name: Generate image + - uses: pguyot/arm-runner-action@v2 + name: Generate image + id: generate_image + with: + base_image: ${{ matrix.image_url }} + image_additional_mb: 4096 + optimize_image: yes + cpu: ${{ matrix.cpu }} + commands: | + chmod +x scripts/arm_runner_installer.sh + ./scripts/arm_runner_installer.sh + - name: Compress image run: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + 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: diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml deleted file mode 100644 index 0d4259a7db..0000000000 --- a/.github/workflows/orangepi-image-generation.yml +++ /dev/null @@ -1,354 +0,0 @@ -name: "OPi Test Build" - -on: - push: - branches: [ fixes/orangepi-image-generation ] - tags: - - 'v*' - pull_request: - branches: [ fixes/orangepi-image-generation ] - -jobs: - build-client: - name: "PhotonClient Build" - defaults: - run: - working-directory: photon-client - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install Dependencies - run: npm ci - - name: Build Production Client - run: npm run build - - uses: actions/upload-artifact@v4 - with: - name: built-client - path: photon-client/dist/ - build-examples: - name: "Build Examples" - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags --force - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - # Need to publish to maven local first, so that C++ sim can pick it up - # Still haven't figured out how to make the vendordep file be copied before trying to build examples - - name: Publish photonlib to maven local - run: | - chmod +x gradlew - ./gradlew publishtomavenlocal -x check - - name: Build Java examples - working-directory: photonlib-java-examples - run: | - chmod +x gradlew - ./gradlew copyPhotonlib -x check - ./gradlew build -x check --max-workers 2 - - name: Build C++ examples - working-directory: photonlib-cpp-examples - run: | - chmod +x gradlew - ./gradlew copyPhotonlib -x check - ./gradlew build -x check --max-workers 2 - build-gradle: - name: "Gradle Build" - runs-on: ubuntu-22.04 - steps: - # Checkout code. - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags --force - - name: Install Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - name: Install mrcal deps - run: sudo apt-get update && sudo apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5 - - name: Gradle Build - run: | - chmod +x gradlew - ./gradlew build -x check --max-workers 2 - - name: Gradle Tests - run: ./gradlew testHeadless -i --max-workers 1 --stacktrace - - name: Gradle Coverage - run: ./gradlew jacocoTestReport --max-workers 1 - - name: Publish Coverage Report - uses: codecov/codecov-action@v3 - with: - file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml - - name: Publish Core Coverage Report - uses: codecov/codecov-action@v3 - with: - file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml - build-offline-docs: - name: "Build Offline Docs" - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - repository: 'PhotonVision/photonvision-docs.git' - ref: master - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 - pip install -r requirements.txt - - name: Build the docs - run: | - make html - - uses: actions/upload-artifact@master - with: - name: built-docs - path: build/html - build-photonlib-host: - env: - MACOSX_DEPLOYMENT_TARGET: 12 - strategy: - fail-fast: false - matrix: - include: - - os: windows-2022 - artifact-name: Win64 - architecture: x64 - - os: macos-12 - artifact-name: macOS - architecture: x64 - - os: ubuntu-22.04 - artifact-name: Linux - - name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - run: git fetch --tags --force - - run: | - chmod +x gradlew - ./gradlew photon-lib:build --max-workers 1 - - run: ./gradlew photon-lib:publish photon-targeting:publish - name: Publish - env: - ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} - if: github.event_name == 'push' - build-photonlib-docker: - strategy: - fail-fast: false - matrix: - include: - - container: wpilib/roborio-cross-ubuntu:2024-22.04 - artifact-name: Athena - - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 - artifact-name: Raspbian - - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 - artifact-name: Aarch64 - - runs-on: ubuntu-22.04 - container: ${{ matrix.container }} - name: "Photonlib - Build Docker - ${{ matrix.artifact-name }}" - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Config Git - run: | - git config --global --add safe.directory /__w/photonvision/photonvision - - name: Build PhotonLib - run: | - chmod +x gradlew - ./gradlew photon-lib:build --max-workers 1 - - name: Publish - run: | - chmod +x gradlew - ./gradlew photon-lib:publish photon-targeting:publish - env: - ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} - if: github.event_name == 'push' - build-package: - needs: [build-client, build-gradle, build-offline-docs] - - strategy: - fail-fast: false - matrix: - include: - - os: windows-latest - artifact-name: Win64 - architecture: x64 - arch-override: none - - os: macos-latest - artifact-name: macOS - architecture: x64 - arch-override: none - - os: ubuntu-latest - artifact-name: Linux - architecture: x64 - arch-override: none - - os: macos-latest - artifact-name: macOSArm - architecture: x64 - arch-override: macarm64 - - os: ubuntu-latest - artifact-name: LinuxArm32 - architecture: x64 - arch-override: linuxarm32 - - os: ubuntu-latest - artifact-name: LinuxArm64 - architecture: x64 - arch-override: linuxarm64 - - runs-on: ${{ matrix.os }} - name: "Build fat JAR - ${{ matrix.artifact-name }}" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - run: | - rm -rf photon-server/src/main/resources/web/* - mkdir -p photon-server/src/main/resources/web/docs - if: ${{ (matrix.os) != 'windows-latest' }} - - run: | - del photon-server\src\main\resources\web\*.* - mkdir photon-server\src\main\resources\web\docs - if: ${{ (matrix.os) == 'windows-latest' }} - - uses: actions/download-artifact@v4 - with: - name: built-client - path: photon-server/src/main/resources/web/ - - uses: actions/download-artifact@v4 - with: - name: built-docs - path: photon-server/src/main/resources/web/docs - - run: | - chmod +x gradlew - ./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }} - if: ${{ (matrix.arch-override != 'none') }} - - run: | - chmod +x gradlew - ./gradlew photon-server:shadowJar --max-workers 2 - if: ${{ (matrix.arch-override == 'none') }} - - uses: actions/upload-artifact@v4 - with: - name: jar-${{ matrix.artifact-name }} - path: photon-server/build/libs - 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: orangepi5 - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.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 }} - # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - uses: pguyot/arm-runner-action@v2 - name: Generate image - id: generate_image - with: - base_image: ${{ matrix.image_url }} - image_additional_mb: 4096 - optimize_image: yes - cpu: ${{ matrix.cpu }} - commands: | - chmod +x scripts/arm_runner_installer.sh - ./scripts/arm_runner_installer.sh - # chmod +x scripts/generatePiImage.sh - # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - - name: Compress image - run: | - new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) - new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}") - echo "[INFO] installed the following version :: $new_jar" - 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 - if: github.event_name == 'push' - # Upload all jars and xz archives - - uses: softprops/action-gh-release@v1 - with: - files: | - **/*.xz - **/*.jar - if: startsWith(github.ref, 'refs/tags/v') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/arm_runner_installer.sh b/scripts/armrunner.sh similarity index 91% rename from scripts/arm_runner_installer.sh rename to scripts/armrunner.sh index 33339a579d..5f7b01ad24 100644 --- a/scripts/arm_runner_installer.sh +++ b/scripts/armrunner.sh @@ -1,8 +1,7 @@ ### -# Alternative ARM Runner installer to setup PhotonVision service files and JAR. +# Alternative ARM Runner installer to setup PhotonVision service files and JAR +# for ARM based builds such as Raspberry Pi, Orange Pi, etc. ### -echo "[INFO] Using ARM Runner minimal instruction set" - NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) echo "Using jar: " $(basename $NEW_JAR) diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index d47ba23781..d99e0effb8 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -6,39 +6,6 @@ fi # 1st arg should be the release to download the image template from. The release ought to only have one # artifact for a "xz" image. -# These are workarounds for the OrangePi. The current image does not use `pushd`, `popd` or `dirs`. -DIR_STACK="" - -opi_pushd() { - if [ $# -eq 0 ]; then - echo "Directory stack:" - for dir in $DIR_STACK; do - echo "- $dir" - done - else - DIR_STACK="$DIR_STACK $PWD" - cd "$1" || return - # debugging only - echo "Added ${1} to the directory stack" - fi -} - -opi_popd() { - if [ -z $DIR_STACK ]; then - echo "No directories" - else - LAST_ITEM=$(echo "$DIR_STACK" | awk '{print $NF}') - POPPED_LIST="${DIR_STACK% *}" - - # debugging only - echo "Removed ${LAST_ITEM} from the directory stack." - echo "Reassigning the DIR_STACK to `$POPPED_LIST`" - - cd "$LAST_ITEM" - DIR_STACK=$POPPED_LIST - fi -} - NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) echo "Using jar: " $NEW_JAR echo "Downloading image from" $1 @@ -67,54 +34,15 @@ fi echo "Unziped image: " $IMAGE_FILE " -- mounting" TMP=$(mktemp -d) LOOP=$(sudo losetup --show -fP "${IMAGE_FILE}") -PARTITION="${LOOP}p2" - -# echo "Confirming that loop partition exists" -# if ! lsblk | grep -q "$(basename $PARTITION)"; then -# echo "Loop device was not found in lsblk output. Creating it now." -# sudo parted $LOOP mklabel msdos - -# sudo parted $LOOP mkpart primary ext4 0% 50% > /dev/null 2>&1 -# sudo mkfs.ext4 "${LOOP}p1" > /dev/null 2>&1 - -# sudo parted $LOOP mkpart primary ext4 50% 100% > /dev/null 2>&1 -# sudo mkfs.ext4 $PARTITION > /dev/null 2>&1 - -# if ! lsblk | grep -q "$(basename $PARTITION)"; then -# echo "Failed to create partition. Exiting." -# exit 1 -# fi - -# echo "Created loop device partition" -# fi - echo "Image mounted! Copying jar..." -sudo mount $PARTITION $TMP - - -if ! command -v pushd > /dev/null 2>&1; then - echo "Overwriting pushd because it doesn't exist." - alias pushd='opi_pushd' -fi - -if ! command -v popd > /dev/null 2>&1; then - echo "Overwriting popd because it doesn't exist." - alias popd='opi_popd' -fi - +sudo mount ${LOOP}p2 $TMP pushd . - -DEST_PV_LOCATION=$TMP/opt/photonvision - -sudo mkdir -p $DEST_PV_LOCATION -cd $DEST_PV_LOCATION +cd $TMP/opt/photonvision sudo cp $NEW_JAR photonvision.jar echo "Jar updated! Creating service..." -DEST_TARGET_WANTS=$TMP/etc/systemd/system/multi-user.target.wants -sudo mkdir -p $DEST_TARGET_WANTS -cd $DEST_TARGET_WANTS +cd $TMP/etc/systemd/system/multi-user.target.wants sudo bash -c "printf \ \"[Unit] Description=Service that runs PhotonVision From eb17d4ea9a24645246c56c551717d6306f26ea82 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 04:51:30 -0500 Subject: [PATCH 18/23] Add newline at end of scripts for WPILib formatting --- scripts/armrunner.sh | 2 +- scripts/generatePiImage.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/armrunner.sh b/scripts/armrunner.sh index 5f7b01ad24..6745cdce2a 100644 --- a/scripts/armrunner.sh +++ b/scripts/armrunner.sh @@ -27,4 +27,4 @@ RestartSec=1 [Install] WantedBy=multi-user.target\" > photonvision.service" -echo "Service created!" \ No newline at end of file +echo "Service created!" diff --git a/scripts/generatePiImage.sh b/scripts/generatePiImage.sh index d99e0effb8..b068a2ea48 100755 --- a/scripts/generatePiImage.sh +++ b/scripts/generatePiImage.sh @@ -68,4 +68,4 @@ NEW_IMAGE=$(basename "${NEW_JAR/.jar/_$2.img}") echo "Renaming image " $IMAGE_FILE " -> " $NEW_IMAGE mv $IMAGE_FILE $NEW_IMAGE xz -T0 -v -z $NEW_IMAGE -mv $NEW_IMAGE.xz $(basename "${NEW_JAR/.jar/-image_$2.xz}") \ No newline at end of file +mv $NEW_IMAGE.xz $(basename "${NEW_JAR/.jar/-image_$2.xz}") From ce283bdd6ce3c6cb19469a6df63bf425b5f1c229 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 04:57:33 -0500 Subject: [PATCH 19/23] Fix white space issues for WPILib formatting --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48750bef58..6e0f122eca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -302,7 +302,7 @@ jobs: - uses: pguyot/arm-runner-action@v2 name: Generate image id: generate_image - with: + with: base_image: ${{ matrix.image_url }} image_additional_mb: 4096 optimize_image: yes From da4f45d9121f306f2d30016516f7ba3280c75f6d Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 12:13:20 -0500 Subject: [PATCH 20/23] Add image_additional_mb parameter and remove servicefile from arm-runner --- .github/workflows/build.yml | 2 +- scripts/armrunner.sh | 24 +++--------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e0f122eca..b4f17e5ad5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -304,7 +304,7 @@ jobs: id: generate_image with: base_image: ${{ matrix.image_url }} - image_additional_mb: 4096 + image_additional_mb: ${{ matrix.image_additional_mb }} optimize_image: yes cpu: ${{ matrix.cpu }} commands: | diff --git a/scripts/armrunner.sh b/scripts/armrunner.sh index 6745cdce2a..4e59e345aa 100644 --- a/scripts/armrunner.sh +++ b/scripts/armrunner.sh @@ -1,6 +1,8 @@ ### -# Alternative ARM Runner installer to setup PhotonVision service files and JAR +# Alternative ARM Runner installer to setup PhotonVision JAR # for ARM based builds such as Raspberry Pi, Orange Pi, etc. +# This assumes that the image provided to arm-runner-action contains +# the servicefile needed to auto-launch PhotonVision. ### NEW_JAR=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) echo "Using jar: " $(basename $NEW_JAR) @@ -8,23 +10,3 @@ echo "Using jar: " $(basename $NEW_JAR) DEST_PV_LOCATION=/opt/photonvision sudo mkdir -p $DEST_PV_LOCATION sudo cp $NEW_JAR ${DEST_PV_LOCATION}/photonvision.jar - -TARGET_WANTS=/etc/systemd/system/multi-user.target.wants -sudo mkdir -p $TARGET_WANTS -cd $TARGET_WANTS -sudo bash -c "printf \ -\"[Unit] -Description=Service that runs PhotonVision - -[Service] -WorkingDirectory=/opt/photonvision -ExecStart=/usr/bin/java -Xmx512m -jar /opt/photonvision/photonvision.jar -ExecStop=/bin/systemctl kill photonvision -Type=simple -Restart=on-failure -RestartSec=1 - -[Install] -WantedBy=multi-user.target\" > photonvision.service" - -echo "Service created!" From 7d7edb35a5daa8280845c06d526dd9fb4c61560d Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 14:39:26 -0500 Subject: [PATCH 21/23] Re-test image creation after PR fixes --- .../workflows/orangepi-image-generation.yml | 354 ++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 .github/workflows/orangepi-image-generation.yml diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml new file mode 100644 index 0000000000..0d4259a7db --- /dev/null +++ b/.github/workflows/orangepi-image-generation.yml @@ -0,0 +1,354 @@ +name: "OPi Test Build" + +on: + push: + branches: [ fixes/orangepi-image-generation ] + tags: + - 'v*' + pull_request: + branches: [ fixes/orangepi-image-generation ] + +jobs: + build-client: + name: "PhotonClient Build" + defaults: + run: + working-directory: photon-client + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Dependencies + run: npm ci + - name: Build Production Client + run: npm run build + - uses: actions/upload-artifact@v4 + with: + name: built-client + path: photon-client/dist/ + build-examples: + name: "Build Examples" + runs-on: ubuntu-22.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags --force + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + # Need to publish to maven local first, so that C++ sim can pick it up + # Still haven't figured out how to make the vendordep file be copied before trying to build examples + - name: Publish photonlib to maven local + run: | + chmod +x gradlew + ./gradlew publishtomavenlocal -x check + - name: Build Java examples + working-directory: photonlib-java-examples + run: | + chmod +x gradlew + ./gradlew copyPhotonlib -x check + ./gradlew build -x check --max-workers 2 + - name: Build C++ examples + working-directory: photonlib-cpp-examples + run: | + chmod +x gradlew + ./gradlew copyPhotonlib -x check + ./gradlew build -x check --max-workers 2 + build-gradle: + name: "Gradle Build" + runs-on: ubuntu-22.04 + steps: + # Checkout code. + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags --force + - name: Install Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - name: Install mrcal deps + run: sudo apt-get update && sudo apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5 + - name: Gradle Build + run: | + chmod +x gradlew + ./gradlew build -x check --max-workers 2 + - name: Gradle Tests + run: ./gradlew testHeadless -i --max-workers 1 --stacktrace + - name: Gradle Coverage + run: ./gradlew jacocoTestReport --max-workers 1 + - name: Publish Coverage Report + uses: codecov/codecov-action@v3 + with: + file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml + - name: Publish Core Coverage Report + uses: codecov/codecov-action@v3 + with: + file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml + build-offline-docs: + name: "Build Offline Docs" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + repository: 'PhotonVision/photonvision-docs.git' + ref: master + - uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 + pip install -r requirements.txt + - name: Build the docs + run: | + make html + - uses: actions/upload-artifact@master + with: + name: built-docs + path: build/html + build-photonlib-host: + env: + MACOSX_DEPLOYMENT_TARGET: 12 + strategy: + fail-fast: false + matrix: + include: + - os: windows-2022 + artifact-name: Win64 + architecture: x64 + - os: macos-12 + artifact-name: macOS + architecture: x64 + - os: ubuntu-22.04 + artifact-name: Linux + + name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: git fetch --tags --force + - run: | + chmod +x gradlew + ./gradlew photon-lib:build --max-workers 1 + - run: ./gradlew photon-lib:publish photon-targeting:publish + name: Publish + env: + ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} + if: github.event_name == 'push' + build-photonlib-docker: + strategy: + fail-fast: false + matrix: + include: + - container: wpilib/roborio-cross-ubuntu:2024-22.04 + artifact-name: Athena + - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 + artifact-name: Raspbian + - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 + artifact-name: Aarch64 + + runs-on: ubuntu-22.04 + container: ${{ matrix.container }} + name: "Photonlib - Build Docker - ${{ matrix.artifact-name }}" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Config Git + run: | + git config --global --add safe.directory /__w/photonvision/photonvision + - name: Build PhotonLib + run: | + chmod +x gradlew + ./gradlew photon-lib:build --max-workers 1 + - name: Publish + run: | + chmod +x gradlew + ./gradlew photon-lib:publish photon-targeting:publish + env: + ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} + if: github.event_name == 'push' + build-package: + needs: [build-client, build-gradle, build-offline-docs] + + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + artifact-name: Win64 + architecture: x64 + arch-override: none + - os: macos-latest + artifact-name: macOS + architecture: x64 + arch-override: none + - os: ubuntu-latest + artifact-name: Linux + architecture: x64 + arch-override: none + - os: macos-latest + artifact-name: macOSArm + architecture: x64 + arch-override: macarm64 + - os: ubuntu-latest + artifact-name: LinuxArm32 + architecture: x64 + arch-override: linuxarm32 + - os: ubuntu-latest + artifact-name: LinuxArm64 + architecture: x64 + arch-override: linuxarm64 + + runs-on: ${{ matrix.os }} + name: "Build fat JAR - ${{ matrix.artifact-name }}" + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: | + rm -rf photon-server/src/main/resources/web/* + mkdir -p photon-server/src/main/resources/web/docs + if: ${{ (matrix.os) != 'windows-latest' }} + - run: | + del photon-server\src\main\resources\web\*.* + mkdir photon-server\src\main\resources\web\docs + if: ${{ (matrix.os) == 'windows-latest' }} + - uses: actions/download-artifact@v4 + with: + name: built-client + path: photon-server/src/main/resources/web/ + - uses: actions/download-artifact@v4 + with: + name: built-docs + path: photon-server/src/main/resources/web/docs + - run: | + chmod +x gradlew + ./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }} + if: ${{ (matrix.arch-override != 'none') }} + - run: | + chmod +x gradlew + ./gradlew photon-server:shadowJar --max-workers 2 + if: ${{ (matrix.arch-override == 'none') }} + - uses: actions/upload-artifact@v4 + with: + name: jar-${{ matrix.artifact-name }} + path: photon-server/build/libs + 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: orangepi5 + image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.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 }} + # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. + - uses: pguyot/arm-runner-action@v2 + name: Generate image + id: generate_image + with: + base_image: ${{ matrix.image_url }} + image_additional_mb: 4096 + optimize_image: yes + cpu: ${{ matrix.cpu }} + commands: | + chmod +x scripts/arm_runner_installer.sh + ./scripts/arm_runner_installer.sh + # chmod +x scripts/generatePiImage.sh + # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - name: Compress image + run: | + new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) + new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}") + echo "[INFO] installed the following version :: $new_jar" + 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 + if: github.event_name == 'push' + # Upload all jars and xz archives + - uses: softprops/action-gh-release@v1 + with: + files: | + **/*.xz + **/*.jar + if: startsWith(github.ref, 'refs/tags/v') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4af9acbe4edaadf0bf3edc8aa8bfbcdf5c5bef38 Mon Sep 17 00:00:00 2001 From: judsonjames Date: Tue, 9 Jan 2024 14:51:38 -0500 Subject: [PATCH 22/23] Fix script name in test build workflow --- .github/workflows/orangepi-image-generation.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml index 0d4259a7db..73b79ce61a 100644 --- a/.github/workflows/orangepi-image-generation.yml +++ b/.github/workflows/orangepi-image-generation.yml @@ -303,14 +303,14 @@ jobs: - uses: pguyot/arm-runner-action@v2 name: Generate image id: generate_image - with: + with: base_image: ${{ matrix.image_url }} image_additional_mb: 4096 optimize_image: yes cpu: ${{ matrix.cpu }} commands: | - chmod +x scripts/arm_runner_installer.sh - ./scripts/arm_runner_installer.sh + chmod +x scripts/armrunner.sh + ./scripts/armrunner.sh # chmod +x scripts/generatePiImage.sh # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - name: Compress image From fa0a59a5388bdd134e452fb5c7944c17ecdb38ee Mon Sep 17 00:00:00 2001 From: amquake Date: Fri, 12 Jan 2024 20:28:24 -0800 Subject: [PATCH 23/23] Delete .github/workflows/orangepi-image-generation.yml --- .../workflows/orangepi-image-generation.yml | 354 ------------------ 1 file changed, 354 deletions(-) delete mode 100644 .github/workflows/orangepi-image-generation.yml diff --git a/.github/workflows/orangepi-image-generation.yml b/.github/workflows/orangepi-image-generation.yml deleted file mode 100644 index 73b79ce61a..0000000000 --- a/.github/workflows/orangepi-image-generation.yml +++ /dev/null @@ -1,354 +0,0 @@ -name: "OPi Test Build" - -on: - push: - branches: [ fixes/orangepi-image-generation ] - tags: - - 'v*' - pull_request: - branches: [ fixes/orangepi-image-generation ] - -jobs: - build-client: - name: "PhotonClient Build" - defaults: - run: - working-directory: photon-client - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install Dependencies - run: npm ci - - name: Build Production Client - run: npm run build - - uses: actions/upload-artifact@v4 - with: - name: built-client - path: photon-client/dist/ - build-examples: - name: "Build Examples" - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags --force - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - # Need to publish to maven local first, so that C++ sim can pick it up - # Still haven't figured out how to make the vendordep file be copied before trying to build examples - - name: Publish photonlib to maven local - run: | - chmod +x gradlew - ./gradlew publishtomavenlocal -x check - - name: Build Java examples - working-directory: photonlib-java-examples - run: | - chmod +x gradlew - ./gradlew copyPhotonlib -x check - ./gradlew build -x check --max-workers 2 - - name: Build C++ examples - working-directory: photonlib-cpp-examples - run: | - chmod +x gradlew - ./gradlew copyPhotonlib -x check - ./gradlew build -x check --max-workers 2 - build-gradle: - name: "Gradle Build" - runs-on: ubuntu-22.04 - steps: - # Checkout code. - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags --force - - name: Install Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - name: Install mrcal deps - run: sudo apt-get update && sudo apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5 - - name: Gradle Build - run: | - chmod +x gradlew - ./gradlew build -x check --max-workers 2 - - name: Gradle Tests - run: ./gradlew testHeadless -i --max-workers 1 --stacktrace - - name: Gradle Coverage - run: ./gradlew jacocoTestReport --max-workers 1 - - name: Publish Coverage Report - uses: codecov/codecov-action@v3 - with: - file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml - - name: Publish Core Coverage Report - uses: codecov/codecov-action@v3 - with: - file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml - build-offline-docs: - name: "Build Offline Docs" - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - repository: 'PhotonVision/photonvision-docs.git' - ref: master - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 - pip install -r requirements.txt - - name: Build the docs - run: | - make html - - uses: actions/upload-artifact@master - with: - name: built-docs - path: build/html - build-photonlib-host: - env: - MACOSX_DEPLOYMENT_TARGET: 12 - strategy: - fail-fast: false - matrix: - include: - - os: windows-2022 - artifact-name: Win64 - architecture: x64 - - os: macos-12 - artifact-name: macOS - architecture: x64 - - os: ubuntu-22.04 - artifact-name: Linux - - name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - run: git fetch --tags --force - - run: | - chmod +x gradlew - ./gradlew photon-lib:build --max-workers 1 - - run: ./gradlew photon-lib:publish photon-targeting:publish - name: Publish - env: - ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} - if: github.event_name == 'push' - build-photonlib-docker: - strategy: - fail-fast: false - matrix: - include: - - container: wpilib/roborio-cross-ubuntu:2024-22.04 - artifact-name: Athena - - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 - artifact-name: Raspbian - - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 - artifact-name: Aarch64 - - runs-on: ubuntu-22.04 - container: ${{ matrix.container }} - name: "Photonlib - Build Docker - ${{ matrix.artifact-name }}" - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Config Git - run: | - git config --global --add safe.directory /__w/photonvision/photonvision - - name: Build PhotonLib - run: | - chmod +x gradlew - ./gradlew photon-lib:build --max-workers 1 - - name: Publish - run: | - chmod +x gradlew - ./gradlew photon-lib:publish photon-targeting:publish - env: - ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} - if: github.event_name == 'push' - build-package: - needs: [build-client, build-gradle, build-offline-docs] - - strategy: - fail-fast: false - matrix: - include: - - os: windows-latest - artifact-name: Win64 - architecture: x64 - arch-override: none - - os: macos-latest - artifact-name: macOS - architecture: x64 - arch-override: none - - os: ubuntu-latest - artifact-name: Linux - architecture: x64 - arch-override: none - - os: macos-latest - artifact-name: macOSArm - architecture: x64 - arch-override: macarm64 - - os: ubuntu-latest - artifact-name: LinuxArm32 - architecture: x64 - arch-override: linuxarm32 - - os: ubuntu-latest - artifact-name: LinuxArm64 - architecture: x64 - arch-override: linuxarm64 - - runs-on: ${{ matrix.os }} - name: "Build fat JAR - ${{ matrix.artifact-name }}" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install Java 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - run: | - rm -rf photon-server/src/main/resources/web/* - mkdir -p photon-server/src/main/resources/web/docs - if: ${{ (matrix.os) != 'windows-latest' }} - - run: | - del photon-server\src\main\resources\web\*.* - mkdir photon-server\src\main\resources\web\docs - if: ${{ (matrix.os) == 'windows-latest' }} - - uses: actions/download-artifact@v4 - with: - name: built-client - path: photon-server/src/main/resources/web/ - - uses: actions/download-artifact@v4 - with: - name: built-docs - path: photon-server/src/main/resources/web/docs - - run: | - chmod +x gradlew - ./gradlew photon-server:shadowJar --max-workers 2 -PArchOverride=${{ matrix.arch-override }} - if: ${{ (matrix.arch-override != 'none') }} - - run: | - chmod +x gradlew - ./gradlew photon-server:shadowJar --max-workers 2 - if: ${{ (matrix.arch-override == 'none') }} - - uses: actions/upload-artifact@v4 - with: - name: jar-${{ matrix.artifact-name }} - path: photon-server/build/libs - 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: orangepi5 - image_url: https://github.com/PhotonVision/photon-image-modifier/releases/download/v2024.0.4/photonvision_opi5.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 }} - # TODO- replace with the arm-runner action and run this inside of the chroot. but this works for now. - - uses: pguyot/arm-runner-action@v2 - name: Generate image - id: generate_image - with: - base_image: ${{ matrix.image_url }} - image_additional_mb: 4096 - optimize_image: yes - cpu: ${{ matrix.cpu }} - commands: | - chmod +x scripts/armrunner.sh - ./scripts/armrunner.sh - # chmod +x scripts/generatePiImage.sh - # ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - - name: Compress image - run: | - new_jar=$(realpath $(find . -name photonvision\*-linuxarm64.jar)) - new_image_name=$(basename "${new_jar/.jar/_${{ matrix.image_suffix }}.img}") - echo "[INFO] installed the following version :: $new_jar" - 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 - if: github.event_name == 'push' - # Upload all jars and xz archives - - uses: softprops/action-gh-release@v1 - with: - files: | - **/*.xz - **/*.jar - if: startsWith(github.ref, 'refs/tags/v') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}