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] 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]