From 63d7afce69bd35c3f62e7a962704c07f99da16b5 Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:16:00 -0500 Subject: [PATCH] what are we doing --- .github/actions/build-simulator/action.yaml | 15 ++++++ .github/actions/host-compile-test/action.yaml | 16 ++++++ .github/workflows/bootloader.yaml | 43 ++------------- .github/workflows/can.yaml | 53 ++++++++++-------- .github/workflows/common.yaml | 54 ++++++++++--------- .github/workflows/eeprom.yaml | 51 ++++++++++-------- .github/workflows/gantry.yaml | 3 ++ .../workflows/non-executable-workflow.yaml | 47 ++++++++++++++++ 8 files changed, 174 insertions(+), 108 deletions(-) create mode 100644 .github/actions/build-simulator/action.yaml create mode 100644 .github/actions/host-compile-test/action.yaml create mode 100644 .github/workflows/non-executable-workflow.yaml diff --git a/.github/actions/build-simulator/action.yaml b/.github/actions/build-simulator/action.yaml new file mode 100644 index 000000000..e5c9e4965 --- /dev/null +++ b/.github/actions/build-simulator/action.yaml @@ -0,0 +1,15 @@ +name: Simulate +description: Build Target Simulator + +inputs: + target: + description: simulator target + required: true + +runs: + using: composite + steps: + - name: Build and test + run: cmake --build ./build-host --target ${{ inputs.target }}-simulator + shell: bash + working-directory: ${{ env.DEFAULT_DIRECTORY }} diff --git a/.github/actions/host-compile-test/action.yaml b/.github/actions/host-compile-test/action.yaml new file mode 100644 index 000000000..c3086a6a4 --- /dev/null +++ b/.github/actions/host-compile-test/action.yaml @@ -0,0 +1,16 @@ +name: Host-Compile/Test +description: Build and Test Target + + +runs: + using: composite + steps: + - name: Configure + run: cmake --preset=host-gcc10 . + shell: bash + working-directory: ${{ env.DEFAULT_DIRECTORY }} + + - name: Build and test + run: cmake --build ./build-host --target ${{ env.TARGET }}-build-and-test + shell: bash + working-directory: ${{ env.DEFAULT_DIRECTORY }} diff --git a/.github/workflows/bootloader.yaml b/.github/workflows/bootloader.yaml index c897ff817..bac47423b 100644 --- a/.github/workflows/bootloader.yaml +++ b/.github/workflows/bootloader.yaml @@ -42,43 +42,6 @@ defaults: 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 - - host-compile-test: - name: "Host-Compile/Test" - runs-on: "ubuntu-20.04" - timeout-minutes: 10 - steps: - - run: | - sudo apt update - sudo apt install gcc-10 g++-10 - - 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=host-gcc10 . - - name: 'Build and test' - run: cmake --build ./build-host --target bootloader-build-and-test + run-non-executable-workflow: + uses: ./.github/workflows/non-executable-workflow.yaml + secrets: inherit diff --git a/.github/workflows/can.yaml b/.github/workflows/can.yaml index 509416590..1748e35ad 100644 --- a/.github/workflows/can.yaml +++ b/.github/workflows/can.yaml @@ -30,10 +30,13 @@ on: env: ci: 1 + DEFAULT_DIRECTORY: ot3-firmware + TARGET: can defaults: run: shell: bash + working-directory: ot3-firmware jobs: cross-compile-check: @@ -41,35 +44,39 @@ jobs: runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=cross . -DCMAKE_BUILD_TYPE=debug - - name: "Format" - run: cmake --build ./build-cross --target can-format-ci - - name: "Build" - run: cmake --build ./build-cross --target can + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Cross-Compile/Check + uses: ./actions/.github/actions/cross-compile-check + host-compile-test: name: "Host-Compile/Test" runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - run: | - sudo apt update - sudo apt install gcc-10 g++-10 - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=host-gcc10 . - - name: 'Build and test' - run: cmake --build ./build-host --target can-build-and-test + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Host-Compile/Test + uses: ./actions/.github/actions/host-compile-test \ No newline at end of file diff --git a/.github/workflows/common.yaml b/.github/workflows/common.yaml index c6bda9e19..f0556b650 100644 --- a/.github/workflows/common.yaml +++ b/.github/workflows/common.yaml @@ -29,10 +29,13 @@ on: env: ci: 1 + DEFAULT_DIRECTORY: ot3-firmware + TARGET: common defaults: run: shell: bash + working-directory: ot3-firmware jobs: cross-compile-check: @@ -40,36 +43,39 @@ jobs: runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=cross . -DCMAKE_BUILD_TYPE=debug - - name: "Format" - run: cmake --build ./build-cross --target common-format-ci - # TODO (AL 2021-07-09) - uncomment when adding common-lint is added - - name: "Build" - run: cmake --build ./build-cross --target common + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Cross-Compile/Check + uses: ./actions/.github/actions/cross-compile-check + host-compile-test: name: "Host-Compile/Test" runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - run: | - sudo apt update - sudo apt install gcc-10 g++-10 - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=host-gcc10 . - - name: 'Build and test' - run: cmake --build ./build-host --target common-build-and-test + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Host-Compile/Test + uses: ./actions/.github/actions/host-compile-test diff --git a/.github/workflows/eeprom.yaml b/.github/workflows/eeprom.yaml index 86381231f..3f108f46e 100644 --- a/.github/workflows/eeprom.yaml +++ b/.github/workflows/eeprom.yaml @@ -41,10 +41,13 @@ on: env: ci: 1 + DEFAULT_DIRECTORY: ot3-firmware + TARGET: eeprom defaults: run: shell: bash + working-directory: ot3-firmware jobs: cross-compile-check: @@ -52,33 +55,39 @@ jobs: runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup 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 eeprom-format-ci + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Cross-Compile/Check + uses: ./actions/.github/actions/cross-compile-check + host-compile-test: name: "Host-Compile/Test" runs-on: "ubuntu-20.04" timeout-minutes: 10 steps: - - run: | - sudo apt update - sudo apt install gcc-10 g++-10 - - uses: "actions/checkout@v2" + - name: Checkout github actions directory + uses: actions/checkout@v4 with: - fetch-depth: 0 - - uses: "actions/cache@v3" + sparse-checkout: | + .github/actions + sparse-checkout-cone-mode: false + path: actions + + - name: Setup main + uses: ./actions/.github/actions/main-setup with: - path: "./stm32-tools" - key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} - - name: "Configure" - run: cmake --preset=host-gcc10 . - - name: 'Build and test' - run: cmake --build ./build-host --target eeprom-build-and-test + cache-version: ${{ secrets.CACHE_VERSION }} + + - name: Host-Compile/Test + uses: ./actions/.github/actions/host-compile-test \ No newline at end of file diff --git a/.github/workflows/gantry.yaml b/.github/workflows/gantry.yaml index 51ff7ccd3..3d9e2f9dc 100644 --- a/.github/workflows/gantry.yaml +++ b/.github/workflows/gantry.yaml @@ -39,10 +39,13 @@ on: env: ci: 1 + DEFAULT_DIRECTORY: ot3-firmware + TARGET: gantry defaults: run: shell: bash + working-directory: ot3-firmware jobs: cross-compile-check: diff --git a/.github/workflows/non-executable-workflow.yaml b/.github/workflows/non-executable-workflow.yaml new file mode 100644 index 000000000..cf2b6521f --- /dev/null +++ b/.github/workflows/non-executable-workflow.yaml @@ -0,0 +1,47 @@ +name: Workflow for Non-executable Targets + +on: + workflow_call: + +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 + + 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 \ No newline at end of file