From 1b67cdbf68f6a55ce2d2d206601dca1920c69676 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:28:27 -0400 Subject: [PATCH 1/8] linting stuff --- .github/workflows/lint-format.yml | 74 +++++++++++++++++++++++++++++ .github/workflows/main.yml | 77 ------------------------------- 2 files changed, 74 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/lint-format.yml diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml new file mode 100644 index 0000000000..57481c1118 --- /dev/null +++ b/.github/workflows/lint-format.yml @@ -0,0 +1,74 @@ +name: Lint and Format + +on: + pull_request: + push: + branches-ignore: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + wpiformat: + name: "wpiformat" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Fetch all history and metadata + run: | + git fetch --prune --unshallow + git checkout -b pr + git branch -f master origin/master + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install wpiformat + run: pip3 install wpiformat + - name: Run + run: wpiformat + - name: Check output + run: git --no-pager diff --exit-code HEAD + - name: Generate diff + run: git diff HEAD > wpiformat-fixes.patch + if: ${{ failure() }} + - uses: actions/upload-artifact@v3 + with: + name: wpiformat fixes + path: wpiformat-fixes.patch + if: ${{ failure() }} + javaformat: + name: "Java Formatting" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + - run: | + chmod +x gradlew + ./gradlew spotlessCheck + + clientformat: + name: "PhotonClient Lint and Formatting" + defaults: + run: + working-directory: photon-client + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 17 + - name: Install Dependencies + run: npm ci + - name: Check Linting + run: npm run lint-ci + - name: Check Formatting + run: npm run format-ci diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94a5e5f075..cae30641c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,33 +45,6 @@ jobs: with: name: built-client path: photon-client/dist/ - photonclient-check-lint: - # Let all steps run within the photon-client dir. - defaults: - run: - working-directory: photon-client - - # The type of runner that the job will run on. - runs-on: ubuntu-22.04 - - steps: - # Checkout code. - - uses: actions/checkout@v3 - - # Setup Node.js - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 17 - - - name: Install Dependencies - run: npm ci - - - name: Check Linting - run: npm run lint-ci - - - name: Check Formatting - run: npm run format-ci photon-build-examples: runs-on: ubuntu-22.04 name: "Build Examples" @@ -196,26 +169,6 @@ jobs: with: name: built-docs path: build/html - photonserver-check-lint: - # The type of runner that the job will run on. - runs-on: ubuntu-22.04 - - steps: - # Checkout code. - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Install Java 17. - - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - # Check server code with Spotless. - - run: | - chmod +x gradlew - ./gradlew spotlessCheck photonlib-build-host: env: MACOSX_DEPLOYMENT_TARGET: 10.14 @@ -284,36 +237,6 @@ jobs: env: ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} if: github.event_name == 'push' - photonlib-wpiformat: - name: "wpiformat" - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Fetch all history and metadata - run: | - git fetch --prune --unshallow - git checkout -b pr - git branch -f master origin/master - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Install wpiformat - run: pip3 install wpiformat - - name: Check index.html not changed - run: git --no-pager diff --exit-code origin/master photon-server/src/main/resources/web/index.html - - name: Run - run: wpiformat - - name: Check output - run: git --no-pager diff --exit-code HEAD - - name: Generate diff - run: git diff HEAD > wpiformat-fixes.patch - if: ${{ failure() }} - - uses: actions/upload-artifact@v3 - with: - name: wpiformat fixes - path: wpiformat-fixes.patch - if: ${{ failure() }} photon-build-package: needs: [photonclient-build, photon-build-all, photonserver-build-offline-docs] From 6ce7536c48f1b879532b58e781e8caa680ba70ad Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:34:29 -0400 Subject: [PATCH 2/8] fix client node version --- .github/workflows/lint-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 57481c1118..45bfc9ed85 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -65,7 +65,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 17 + node-version: 18 - name: Install Dependencies run: npm ci - name: Check Linting From 4117ec4df38c11834f606a428d0e64c83ae9fc6d Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:57:49 -0400 Subject: [PATCH 3/8] Separate check index.html to its own job --- .github/workflows/lint-format.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 45bfc9ed85..1814ffe367 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -54,7 +54,7 @@ jobs: chmod +x gradlew ./gradlew spotlessCheck - clientformat: + client-lint-format: name: "PhotonClient Lint and Formatting" defaults: run: @@ -72,3 +72,10 @@ jobs: run: npm run lint-ci - name: Check Formatting run: npm run format-ci + server-index: + name: "Check server index.html not changed" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Check index.html not changed + run: git --no-pager diff --exit-code origin/master photon-server/src/main/resources/web/index.html From 12304d467baf9c83d9379ebc83e5ae8004585229 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:00:33 -0400 Subject: [PATCH 4/8] fix? --- .github/workflows/lint-format.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 1814ffe367..f3030ec7b0 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -77,5 +77,10 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 + - name: Fetch all history and metadata + run: | + git fetch --prune --unshallow + git checkout -b pr + git branch -f master origin/master - name: Check index.html not changed run: git --no-pager diff --exit-code origin/master photon-server/src/main/resources/web/index.html From 1940766d60e0b0b9ae6ee4a14128d7759f43b09d Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:01:35 -0400 Subject: [PATCH 5/8] Seperate build tasks to build --- .github/workflows/build.yml | 186 ++++++++++++++++++++++++++++++ .github/workflows/main.yml | 223 ------------------------------------ 2 files changed, 186 insertions(+), 223 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..e6b9565622 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,186 @@ +name: Build + +on: + pull_request: + push: + branches-ignore: + - master + +jobs: + build-client: + name: "PhotonClient Build" + defaults: + run: + working-directory: photon-client + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install Dependencies + run: npm ci + - name: Build Production Client + run: npm run build + - uses: actions/upload-artifact@master + 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@v3 + 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 + # 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@v3 + 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: Gradle Build + run: | + chmod +x gradlew + ./gradlew photon-server:build photon-lib: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@v3 + with: + repository: 'PhotonVision/photonvision-docs.git' + ref: master + - uses: actions/setup-python@v4 + 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: 10.14 + strategy: + fail-fast: false + matrix: + include: + - os: windows-2022 + artifact-name: Win64 + architecture: x64 + # Mac builds are broken due to opencv class loading issues -- disable for now + # - os: macos-11 + # artifact-name: macOS + - os: ubuntu-22.04 + artifact-name: Linux + + name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v3 + 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@v3 + 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 + env: + ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} + if: github.event_name == 'push' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cae30641c6..f62abbc845 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,229 +14,6 @@ on: merge_group: jobs: - photonclient-build: - # Let all steps run within the photon-client dir. - defaults: - run: - working-directory: photon-client - - # The type of runner that the job will run on. - runs-on: ubuntu-22.04 - - steps: - # Checkout code. - - uses: actions/checkout@v3 - - # Setup Node.js - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 17 - - # Run npm - - name: Install Dependencies - run: npm ci - - - name: Build Production Client - run: npm run build - - # Upload client artifact. - - uses: actions/upload-artifact@master - with: - name: built-client - path: photon-client/dist/ - photon-build-examples: - runs-on: ubuntu-22.04 - name: "Build Examples" - - steps: - # Checkout code. - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Fetch tags. - - name: Fetch tags - run: git fetch --tags --force - - # Install Java 17. - - name: Install Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - # Need to publish to maven local first, so that C++ sim can pick it up - # Still haven't figure 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 - photon-build-all: - # The type of runner that the job will run on. - runs-on: ubuntu-22.04 - - steps: - # Checkout code. - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Fetch tags. - - name: Fetch tags - run: git fetch --tags --force - - # Install Java 17. - - name: Install Java 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - # Run only build tasks, no checks?? - - name: Gradle Build - run: | - chmod +x gradlew - ./gradlew photon-server:build photon-lib:build -x check --max-workers 2 - - # Run Gradle Tests. - - name: Gradle Tests - run: ./gradlew testHeadless -i --max-workers 1 --stacktrace - - # Generate Coverage Report. - - name: Gradle Coverage - run: ./gradlew jacocoTestReport --max-workers 1 - - # Publish Coverage Report. - - name: Publish Server 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 - photonserver-build-offline-docs: - runs-on: ubuntu-22.04 - - steps: - # Checkout docs. - - uses: actions/checkout@v3 - with: - repository: 'PhotonVision/photonvision-docs.git' - ref: master - - # Install Python. - - uses: actions/setup-python@v4 - 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 - - # Don't check the docs. If a PR was merged to the docs repo, it ought to pass CI. No need to re-check here. - # - name: Check the docs - # run: | - # make linkcheck - # make lint - - - name: Build the docs - run: | - make html - - # Upload docs artifact. - - uses: actions/upload-artifact@master - with: - name: built-docs - path: build/html - photonlib-build-host: - env: - MACOSX_DEPLOYMENT_TARGET: 10.14 - strategy: - fail-fast: false - matrix: - include: - - os: windows-2022 - artifact-name: Win64 - architecture: x64 - # Mac builds are broken due to opencv class loading issues -- disable for now - # - os: macos-11 - # artifact-name: macOS - - os: ubuntu-22.04 - artifact-name: Linux - - runs-on: ${{ matrix.os }} - name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-java@v3 - 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' - photonlib-build-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@v3 - 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 - env: - ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} - if: github.event_name == 'push' photon-build-package: needs: [photonclient-build, photon-build-all, photonserver-build-offline-docs] From 22ccd220734f271eb315c4efb99ac41ebd8b7843 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:08:11 -0400 Subject: [PATCH 6/8] move other build stuff over --- .github/workflows/build.yml | 110 +++++++++++++++++++++++++++++++ .github/workflows/main.yml | 125 ------------------------------------ 2 files changed, 110 insertions(+), 125 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6b9565622..769fabe2be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,3 +184,113 @@ jobs: 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@v3 + with: + fetch-depth: 0 + - name: Install Java 17 + uses: actions/setup-java@v3 + 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@v3 + with: + name: built-client + path: photon-server/src/main/resources/web/ + - uses: actions/download-artifact@v3 + 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@v3 + 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://api.github.com/repos/photonvision/photon-pi-gen/releases/tags/v2023.1.3_arm64 + - os: ubuntu-latest + artifact-name: LinuxArm64 + image_suffix: limelight2 + image_url: https://api.github.com/repos/photonvision/photon-pi-gen/releases/tags/v2023.2.2_limelight-arm64 + + runs-on: ${{ matrix.os }} + name: "Build image - ${{ matrix.image_url }}" + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/download-artifact@v2 + with: + name: jar-${{ matrix.artifact-name }} + - name: Generate image + run: | + chmod +x scripts/generatePiImage.sh + ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} + - uses: actions/upload-artifact@v3 + name: Upload image + with: + name: image-${{ matrix.image_suffix }} + path: photonvision*.xz + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f62abbc845..efbe94e726 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,131 +14,6 @@ on: merge_group: jobs: - photon-build-package: - needs: [photonclient-build, photon-build-all, photonserver-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 - - # The type of runner that the job will run on. - runs-on: ${{ matrix.os }} - name: "Build fat JAR - ${{ matrix.artifact-name }}" - - steps: - # Checkout code. - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Install Java 17. - - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - - # Clear any existing web resources. - - 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' }} - - # Download client artifact to resources folder. - - uses: actions/download-artifact@v3 - with: - name: built-client - path: photon-server/src/main/resources/web/ - - # Download docs artifact to resources folder. - - uses: actions/download-artifact@v3 - with: - name: built-docs - path: photon-server/src/main/resources/web/docs - - # Build fat jar for both pi and everything - - 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') }} - - # Upload final fat jar as artifact. - - uses: actions/upload-artifact@v3 - with: - name: jar-${{ matrix.artifact-name }} - path: photon-server/build/libs - photon-image-generator: - needs: [photon-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://api.github.com/repos/photonvision/photon-pi-gen/releases/tags/v2023.1.3_arm64 - - os: ubuntu-latest - artifact-name: LinuxArm64 - image_suffix: limelight2 - image_url: https://api.github.com/repos/photonvision/photon-pi-gen/releases/tags/v2023.2.2_limelight-arm64 - - runs-on: ${{ matrix.os }} - name: "Build image - ${{ matrix.image_url }}" - - steps: - # Checkout code. - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/download-artifact@v2 - with: - name: jar-${{ matrix.artifact-name }} - - - name: Generate image - run: | - chmod +x scripts/generatePiImage.sh - ./scripts/generatePiImage.sh ${{ matrix.image_url }} ${{ matrix.image_suffix }} - - - uses: actions/upload-artifact@v3 - name: Upload image - with: - name: image-${{ matrix.image_suffix }} - path: photonvision*.xz photon-release: needs: [photon-build-package, photon-image-generator] runs-on: ubuntu-22.04 From 56a03693aee9606e3938aab1b141261e9e26a3a7 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:15:59 -0400 Subject: [PATCH 7/8] Formatting fixes (ironic) --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 769fabe2be..ab2f263fcf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -293,4 +293,3 @@ jobs: with: name: image-${{ matrix.image_suffix }} path: photonvision*.xz - From a57bb8cc2d2177704cc102a312428d1ddcb51948 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:22:22 -0400 Subject: [PATCH 8/8] move release into build --- .github/workflows/build.yml | 27 ++++++++++++++++++++++ .github/workflows/main.yml | 46 ------------------------------------- 2 files changed, 27 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab2f263fcf..8d1b2d9ba9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -293,3 +293,30 @@ jobs: 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@v2 + - 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/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index efbe94e726..0000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,46 +0,0 @@ -# This workflow builds the client (UI), the server, builds the JAR. - -name: CI - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master ] - tags: - - 'v*' - pull_request: - branches: [ master ] - merge_group: - -jobs: - photon-release: - needs: [photon-build-package, photon-image-generator] - 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@v2 - - - 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 }}