From 713f668a4f9bf9120b7ed95722cba6520f89be10 Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Fri, 12 Jan 2024 18:28:15 -0500 Subject: [PATCH] praise the lord --- .github/actions/build-simulator/action.yaml | 17 +- .github/workflows/eeprom.yaml | 4 +- .github/workflows/executable-workflow.yaml | 88 ++++++++++ .github/workflows/gantry.yaml | 180 ++++++++++---------- 4 files changed, 196 insertions(+), 93 deletions(-) create mode 100644 .github/workflows/executable-workflow.yaml diff --git a/.github/actions/build-simulator/action.yaml b/.github/actions/build-simulator/action.yaml index e5c9e4965..7c0052e93 100644 --- a/.github/actions/build-simulator/action.yaml +++ b/.github/actions/build-simulator/action.yaml @@ -2,14 +2,21 @@ name: Simulate description: Build Target Simulator inputs: - target: - description: simulator target - required: true + sub-target: + description: simulator sub-target + required: false runs: using: composite steps: - - name: Build and test - run: cmake --build ./build-host --target ${{ inputs.target }}-simulator + - if: ${{ !inputs.sub-target }} + name: Build and test + run: cmake --build ./build-host --target ${{ env.TARGET }}-simulator + shell: bash + working-directory: ${{ env.DEFAULT_DIRECTORY }} + + - if: ${{ inputs.sub-target }} + name: Build and test + run: cmake --build ./build-host --target ${{ env.TARGET }}-${{ inputs.sub-target }}-simulator shell: bash working-directory: ${{ env.DEFAULT_DIRECTORY }} diff --git a/.github/workflows/eeprom.yaml b/.github/workflows/eeprom.yaml index dda98fe97..124ccd75b 100644 --- a/.github/workflows/eeprom.yaml +++ b/.github/workflows/eeprom.yaml @@ -43,5 +43,5 @@ jobs: run-non-executable-workflow: uses: ./.github/workflows/non-executable-workflow.yaml with: - target: bootloader - secrets: eeprom + target: eeprom + secrets: inherit diff --git a/.github/workflows/executable-workflow.yaml b/.github/workflows/executable-workflow.yaml new file mode 100644 index 000000000..f77e0d749 --- /dev/null +++ b/.github/workflows/executable-workflow.yaml @@ -0,0 +1,88 @@ +name: Workflow for Executable Targets + +on: + workflow_call: + inputs: + target: + description: Executable target + required: true + type: string + sub-targets: + description: Sub-targets + required: false + type: string + + +env: + ci: 1 + DEFAULT_DIRECTORY: ot3-firmware + TARGET: ${{ inputs.target }} + +defaults: + run: + shell: bash + working-directory: ot3-firmware + +jobs: + cross-compile-check: + name: "Cross-Compile/Check" + runs-on: "ubuntu-20.04" + timeout-minutes: 10 + steps: + - name: Checkout github actions directory + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup + with: + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Cross-Compile/Check + uses: ./actions/.github/actions/cross-compile-check + +# cross-compile-build: +# name: "Cross-Compile/Build" +# needs: cross-compile-check +# strategy: +# matrix: +# build-target: ${{ fromJSON(inputs.sub-targets) }} +# steps: +# uses: ./actions/.github/actions/cross-compile-build +# sub-target: ${{ matrix.build-target || ""}} + + + host-compile-test: + name: "Host-Compile/Test" + runs-on: "ubuntu-20.04" + timeout-minutes: 10 + steps: + - name: Checkout github actions directory + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup + with: + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Host-Compile/Test + uses: ./actions/.github/actions/host-compile-test + + build-simulator: + name: "Build Simulator" + needs: host-build-test + strategy: + matrix: + build-target: ${{ fromJSON(inputs.sub-targets) }} + steps: + uses: ./actions/.github/actions/cross-compile-build + sub-target: ${{ matrix.build-target || ""}} diff --git a/.github/workflows/gantry.yaml b/.github/workflows/gantry.yaml index 3d9e2f9dc..db2cde5d5 100644 --- a/.github/workflows/gantry.yaml +++ b/.github/workflows/gantry.yaml @@ -37,90 +37,98 @@ on: - "gantry@*" workflow_dispatch: -env: - ci: 1 - DEFAULT_DIRECTORY: ot3-firmware - TARGET: gantry - -defaults: - run: - shell: bash - working-directory: ot3-firmware - jobs: - cross-compile-check: - name: "Cross-Compile/Check" - runs-on: "ubuntu-20.04" - timeout-minutes: 20 - steps: - - uses: "actions/checkout@v2" - with: - fetch-depth: 0 - - uses: "actions/cache@v3" - with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=cross . -DCMAKE_BUILD_TYPE=RelWithDebInfo - - name: "Format" - run: cmake --build ./build-cross --target gantry-format-ci - - name: "Build" - run: cmake --build --preset=gantry --target gantry-images gantry-applications - - name: "Lint" - run: cmake --build ./build-cross --target gantry-lint - - host-compile-test: - name: "Host-Compile/Test" - runs-on: "ubuntu-20.04" - timeout-minutes: 10 - steps: - - name: Update and install gcc-10 & g++-10 - run: | - sudo apt update - sudo apt install gcc-10 g++-10 - - - name: Checkout ot3-firmware repository - uses: "actions/checkout@v2" - with: - fetch-depth: 0 - path: ot3-firmware - - - name: Checkout opentrons repository - uses: actions/checkout@v3 - with: - repository: "Opentrons/opentrons" - path: opentrons - - - name: Cache stm32-tools - uses: "actions/cache@v3" - with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - - name: "Configure" - run: cmake --preset=host-gcc10 . - working-directory: ot3-firmware - - - name: 'Build and test' - run: cmake --build ./build-host --target gantry-build-and-test - working-directory: ot3-firmware - - - name: 'Setup state_manager' - run: cmake --build ./build-host/ --target state-manager-setup - working-directory: ot3-firmware - - - name: 'Build X simulator' - run: cmake --build ./build-host --target gantry-x-simulator - working-directory: ot3-firmware - - - name: 'Build Y simulator' - run: cmake --build ./build-host --target gantry-y-simulator - working-directory: ot3-firmware - - - name: "Upload simulator artifacts" - if: github.event_name != 'pull_request' - uses: actions/upload-artifact@v3 - with: - name: "gantry-simulators-${{github.ref_name}}" - path: | - build-host/gantry/simulator/gantry-*-simulator + run-executable-workflow: + uses: ./.github/workflows/executable-workflow.yaml + with: + target: gantry + sub-target: '["x", "y"]' + secrets: inherit +# +#env: +# ci: 1 +# DEFAULT_DIRECTORY: ot3-firmware +# TARGET: gantry +# +#defaults: +# run: +# shell: bash +# working-directory: ot3-firmware +# +#jobs: +# cross-compile-check: +# name: "Cross-Compile/Check" +# runs-on: "ubuntu-20.04" +# timeout-minutes: 20 +# steps: +# - uses: "actions/checkout@v2" +# with: +# fetch-depth: 0 +# - uses: "actions/cache@v3" +# with: +# path: "./stm32-tools" +# key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} +# - name: "Configure" +# run: cmake --preset=cross . -DCMAKE_BUILD_TYPE=RelWithDebInfo +# - name: "Format" +# run: cmake --build ./build-cross --target gantry-format-ci +# - name: "Build" +# run: cmake --build --preset=gantry --target gantry-images gantry-applications +# - name: "Lint" +# run: cmake --build ./build-cross --target gantry-lint +# +# host-compile-test: +# name: "Host-Compile/Test" +# runs-on: "ubuntu-20.04" +# timeout-minutes: 10 +# steps: +# - name: Update and install gcc-10 & g++-10 +# run: | +# sudo apt update +# sudo apt install gcc-10 g++-10 +# +# - name: Checkout ot3-firmware repository +# uses: "actions/checkout@v2" +# with: +# fetch-depth: 0 +# path: ot3-firmware +# +# - name: Checkout opentrons repository +# uses: actions/checkout@v3 +# with: +# repository: "Opentrons/opentrons" +# path: opentrons +# +# - name: Cache stm32-tools +# uses: "actions/cache@v3" +# with: +# path: "./stm32-tools" +# key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} +# +# - name: "Configure" +# run: cmake --preset=host-gcc10 . +# working-directory: ot3-firmware +# +# - name: 'Build and test' +# run: cmake --build ./build-host --target gantry-build-and-test +# working-directory: ot3-firmware +# +# - name: 'Setup state_manager' +# run: cmake --build ./build-host/ --target state-manager-setup +# working-directory: ot3-firmware +# +# - name: 'Build X simulator' +# run: cmake --build ./build-host --target gantry-x-simulator +# working-directory: ot3-firmware +# +# - name: 'Build Y simulator' +# run: cmake --build ./build-host --target gantry-y-simulator +# working-directory: ot3-firmware +# +# - name: "Upload simulator artifacts" +# if: github.event_name != 'pull_request' +# uses: actions/upload-artifact@v3 +# with: +# name: "gantry-simulators-${{github.ref_name}}" +# path: | +# build-host/gantry/simulator/gantry-*-simulator