From ad45efb6d9d2be1522fa2b894b3b6aad05936299 Mon Sep 17 00:00:00 2001 From: rbaron Date: Wed, 30 Nov 2022 21:06:08 +0100 Subject: [PATCH] Cleanup actions --- .github/actions/build_and_upload/action.yml | 30 +++++++ .github/workflows/b-parasite.yml | 86 ++++----------------- 2 files changed, 44 insertions(+), 72 deletions(-) create mode 100644 .github/actions/build_and_upload/action.yml diff --git a/.github/actions/build_and_upload/action.yml b/.github/actions/build_and_upload/action.yml new file mode 100644 index 0000000..a3d8ebb --- /dev/null +++ b/.github/actions/build_and_upload/action.yml @@ -0,0 +1,30 @@ +name: 'Build and upload artifact' +description: 'Builds a nrf-connect sample for b-parasite' +inputs: + sample-dir: + description: 'Sample directory to build' + required: true + board: + description: 'Board definition to use' + required: true + cmake-extra: + description: 'Extra CMake arguments' + default: '' + output-bin: + description: 'Name of the .hex output' + required: true + +runs: + using: "composite" + steps: + - uses: ./.github/actions/build + image: 'Dockerfile' + with: + sample-dir: ${{ inputs.sample-dir }} + board: ${{ inputs.board }} + cmake-extra: ${{ inputs.cmake-extra }} + output-bin: ${{ inputs.output-bin }} + - uses: actions/upload-artifact@v3 + with: + name: sample-binaries + path: code/nrf-connect/samples/ble/build/zephyr/${{ inputs.output-bin }} \ No newline at end of file diff --git a/.github/workflows/b-parasite.yml b/.github/workflows/b-parasite.yml index 7d7b07d..d4535c2 100644 --- a/.github/workflows/b-parasite.yml +++ b/.github/workflows/b-parasite.yml @@ -17,93 +17,35 @@ jobs: uses: jidicula/clang-format-action@v4.9.0 with: check-path: 'code/nrf-connect' - # Build and upload blinky.hex. - - name: Build the blinky sample - uses: ./.github/actions/build + - uses: ./.github/actions/build with: sample-dir: code/nrf-connect/samples/blinky - output-bin: blinky.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/blinky/build/zephyr/blinky.hex - # Build and upload soil_read_loop.hex. - - name: Build the soil_read_loop sample - uses: ./.github/actions/build + board: bparasite_nrf52840 + output-bin: blinky_nrf52840.hex + - uses: ./.github/actions/build with: sample-dir: code/nrf-connect/samples/soil_read_loop - output-bin: soil_read_loop.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/soil_read_loop/build/zephyr/soil_read_loop.hex - # Build and upload ble_nrf52840_default.hex. - - name: Build the ble sample with default config (nRF52840) - uses: ./.github/actions/build + board: bparasite_nrf52840 + output-bin: soil_read_loop_nrf52840.hex + - uses: ./.github/actions/build_and_upload with: sample-dir: code/nrf-connect/samples/ble board: bparasite_nrf52840 output-bin: ble_nrf52840_default.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52840_default.hex - # Build and upload ble_nrf52833_default.hex. - - name: Build the ble sample with default config (nRF52833) - uses: ./.github/actions/build - with: - sample-dir: code/nrf-connect/samples/ble - board: bparasite_nrf52833 - output-bin: ble_nrf52833_default.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52833_default.hex - # Build and upload ble_nrf52840_bthomev1.hex. - - name: Build ble_nrf52840_bthomev1.hex - uses: ./.github/actions/build + - uses: ./.github/actions/build_and_upload with: sample-dir: code/nrf-connect/samples/ble board: bparasite_nrf52840 cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y output-bin: ble_nrf52840_bthomev1.hex - - uses: actions/upload-artifact@v3 + - uses: ./.github/actions/build_and_upload with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52840_bthomev1.hex - # Build and upload ble_nrf52833_bthomev1.hex. - - name: Build ble_nrf52833_bthomev1.hex - uses: ./.github/actions/build + sample-dir: code/nrf-connect/samples/ble + board: bparasite_nrf52833 + output-bin: ble_nrf52833_default.hex + - uses: ./.github/actions/build_and_upload with: sample-dir: code/nrf-connect/samples/ble board: bparasite_nrf52833 cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y - output-bin: ble_nrf52833_bthomev1.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52833_bthomev1.hex - # Build and upload ble_nrf52840_test_bthomev1_sleep1s.hex - - name: Build the ble sample for testing @ nRF52840 - uses: ./.github/actions/build - with: - sample-dir: code/nrf-connect/samples/ble - board: bparasite_nrf52840 - cmake-extra: -DCONFIG_PRST_SLEEP_DURATION_SEC=1 -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y - output-bin: ble_nrf52840_test_bthomev1_sleep1s.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52840_test_bthomev1_sleep1s.hex - # Build and upload ble_nrf52840_test_bthomev2_sleep1s.hex - - name: Build the ble sample for testing @ nRF52840 - uses: ./.github/actions/build - with: - sample-dir: code/nrf-connect/samples/ble - board: bparasite_nrf52840 - cmake-extra: -DCONFIG_PRST_SLEEP_DURATION_SEC=1 -DCONFIG_PRST_BLE_ENCODING_BTHOME_V2=y - output-bin: ble_nrf52840_test_bthomev2_sleep1s.hex - - uses: actions/upload-artifact@v3 - with: - name: sample-binaries - path: code/nrf-connect/samples/ble/build/zephyr/ble_nrf52840_test_bthomev2_sleep1s.hex \ No newline at end of file + output-bin: ble_nrf52833_bthomev1.hex \ No newline at end of file