Skip to content

Commit

Permalink
WIP more
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenmk committed Aug 27, 2024
1 parent f94bbea commit 0f3b601
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 27 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build

on:
workflow_dispatch:
workflow_call:
inputs:
build_bl_update:
Expand Down Expand Up @@ -110,8 +111,19 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: firmware
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
- name: Save build context
id: set-output
run: |
echo "ARTIFACT_ID_FIRMWARE=${{ steps.artifact-upload-step.outputs.artifact-id }}" >> $GITHUB_OUTPUT
echo "RUNID_FIRMWARE=${{ github.run_id }}" >> $GITHUB_OUTPUT
echo "VERSION=${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}
80 changes: 53 additions & 27 deletions .github/workflows/on_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,56 @@ name: Target tests

on:
workflow_call:
inputs:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: int
required: true
artifact_id:
type: string
required: true
run_fota_tests:
type: boolean
required: false
default: true
run_dfu_tests:
type: boolean
required: false
default: true
run_connectivity_bridge_tests:
type: boolean
required: false
default: true
workflow_dispatch:
inputs:
build:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: int
required: true
artifact_id:
type: string
required: true
run_fota_tests:
type: boolean
description: Build the firmware before running tests

schedule:
- cron: "0 0 * * *"
push:
branches:
- main
required: true
default: false
run_dfu_tests:
type: boolean
required: true
default: false
run_connectivity_bridge_tests:
type: boolean
required: true
default: false


jobs:
build:
steps:
- name: Build firmware
if: ${{ github.event.inputs.build == 'true'}}
uses: ./.github/workflows/build.yml
secrets: inherit
with:
build_bl_update: true

test:
name: Test
needs: build
target_test:
name: Target Test
runs-on: self-hosted
environment: production
container:
Expand All @@ -44,18 +68,17 @@ jobs:
path: thingy91x-oob

- name: Download artifact
if: ${{ github.event.inputs.build == 'true' }}
uses: actions/download-artifact@v4
with:
name: firmware
path: thingy91x-oob/tests/on_target/artifacts
run-id: ${{ inputs.artifact_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download old artifact
if: ${{ github.event.inputs.build == 'false' }}
run: |
echo ${{ github.event.inputs.build }}
python3 thingy91x-oob/tests/on_target/utils/download_artifacts.py \
${{ secrets.GITHUB_TOKEN }}
# - name: Download artifact
# run: |
# python3 thingy91x-oob/tests/on_target/utils/download_artifacts.py \
# ${{ secrets.GITHUB_TOKEN }}

- name: Set version
shell: bash
Expand Down Expand Up @@ -84,6 +107,7 @@ jobs:
SEGGER: ${{ secrets.SEGGER_DUT_1 }}

- name: Run FOTA tests
if: ${{ inputs.run_fota_tests }}
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m "dut1 and fota" tests --firmware-hex artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
Expand All @@ -93,6 +117,7 @@ jobs:
FINGERPRINT: ${{ secrets.FINGERPRINT_DUT_1 }}

- name: Run DFU tests
if: ${{ inputs.run_dfu_tests }}
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m dut2 tests
Expand All @@ -108,6 +133,7 @@ jobs:
NRF91_BL_UPDATE_ZIP: artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip

- name: Check nRF53 connectivity bridge version
if: ${{ inputs.run_connectivity_bridge_tests }}
working-directory: thingy91x-oob
run: |
python3 ./tests/on_target/utils/thingy91x_dfu.py --check-nrf53-version --serial THINGY91X_${{ secrets.UART_DUT_2 }} 2>&1 >/dev/null | grep "S1: 1"
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Test

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- update-dockerfile-target
jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
build_bl_update: true
test:
uses: ./.github/workflows/on_target.yml
needs: build
secrets: inherit
with:
artifact_fw_version: ${{ jobs.build.outputs.VERSION }}
artifact_run_id: ${{ jobs.build.outputs.RUNID_FIRMWARE }}
artifact_id: ${{ jobs.build.outputs.ARTIFACT_ID_FIRMWARE }}

0 comments on commit 0f3b601

Please sign in to comment.