|
| 1 | +inputs: |
| 2 | + bitbake_buildname: |
| 3 | + default: 'build' |
| 4 | + bitbake_prefix: |
| 5 | + default: '' |
| 6 | + bitbake_machine: |
| 7 | + default: 'raspberrypi5' |
| 8 | + bitbake_target: |
| 9 | + default: 'core-image-weston-wpe' |
| 10 | + bitbake_source: |
| 11 | + default: 'source' |
| 12 | + github_token: |
| 13 | + required: true |
| 14 | + repo_release: |
| 15 | + default: 'scarthgap' |
| 16 | +runs: |
| 17 | + using: 'composite' |
| 18 | + steps: |
| 19 | + - name: Print environment |
| 20 | + shell: bash |
| 21 | + run: | |
| 22 | + echo "Environment:" |
| 23 | + echo "======================================================================" |
| 24 | + echo "BITBAKE_BUILDNAME=${{ inputs.bitbake_buildname }}" |
| 25 | + echo "BITBAKE_MACHINE=${{ inputs.bitbake_machine }}" |
| 26 | + echo "BITBAKE_PREFIX=${{ inputs.bitbake_prefix }}" |
| 27 | + echo "BITBAKE_SOURCE=${{ inputs.bitbake_source }}" |
| 28 | + echo "BITBAKE_TARGET=${{ inputs.bitbake_target }}" |
| 29 | + echo "RELEASE=${{ inputs.repo_release }}" |
| 30 | + echo "======================================================================" |
| 31 | + - name: Download timestamp artifact |
| 32 | + uses: actions/download-artifact@v4 |
| 33 | + with: |
| 34 | + pattern: timestamp.txt |
| 35 | + merge-multiple: true |
| 36 | + - name: Get timestamped prefix |
| 37 | + id: timestamp |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + TIMESTAMP=$(cat timestamp.txt) |
| 41 | + echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT |
| 42 | + - name: Prepare the Robot-Framework related PODs in background |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + pushd .ci |
| 46 | + podman rm ci_webserver_1 ci_robot_1 -f |
| 47 | + ./podman-compose.sh up --force-recreate --always-recreate-deps --build -d |
| 48 | + popd |
| 49 | + - name: Flash |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + TIMESTAMP=${{ steps.timestamp.outputs.timestamp }} |
| 53 | + s3cmd get -F s3://yocto/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.wic.bmap |
| 54 | + s3cmd get -F s3://yocto/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/${{ inputs.bitbake_target }}-${{ inputs.bitbake_machine }}.wic.bz2 |
| 55 | + sudo flash ${{ inputs.bitbake_target }} ${{ inputs.bitbake_machine }} |
| 56 | + - name: Test |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + TIMESTAMP=${{ steps.timestamp.outputs.timestamp }} |
| 60 | + GITHUB_PR_SHA=${GITHUB_SHA} |
| 61 | + if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then |
| 62 | + GITHUB_PR_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) |
| 63 | + fi |
| 64 | + cd .ci |
| 65 | + echo "💿️ **Image for [${{ inputs.bitbake_buildname }}](https://wk-contrib.igalia.com/yocto/meta-wpe-image/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/) (ref: ${GITHUB_PR_SHA}).**" > ci-message.txt |
| 66 | + IP=$(sudo manage-devices -c /etc/manage-devices.yml ip ${{ inputs.bitbake_machine }}) |
| 67 | + echo "#!/bin/sh" > setup-env-local.sh |
| 68 | + echo "export TEST_BOARD_IP=${IP}" >> setup-env-local.sh |
| 69 | + if ./run-tests.sh; then |
| 70 | + MESSAGE="Tests passed for \`${{ inputs.bitbake_buildname }}\` on \`${{ inputs.bitbake_target }}\`. Tests results: https://wk-contrib.igalia.com/yocto/meta-wpe-image/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/robot/report.html" |
| 71 | + echo "* ✅️ ${MESSAGE}" >> ci-message.txt |
| 72 | + else |
| 73 | + MESSAGE="Failures were detected in the test results for \`${{ inputs.bitbake_buildname }}\` on \`${{ inputs.bitbake_target }}\`. Tests results: https://wk-contrib.igalia.com/yocto/meta-wpe-image/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/robot/report.html" |
| 74 | + echo "::warning file=.ci/run-tests.sh,title=Robot Framework tests::${MESSAGE}" |
| 75 | + echo "* ⚠️ ${MESSAGE}" >> ci-message.txt |
| 76 | + fi |
| 77 | + s3cmd put -r -F tests_results/robot s3://yocto/${TIMESTAMP}-${{ inputs.bitbake_buildname }}/ |
| 78 | + - name: Comment on the pull request |
| 79 | + uses: mshick/add-pr-comment@v2 |
| 80 | + with: |
| 81 | + message-id: ${{ inputs.bitbake_buildname }}-${{ steps.timestamp.outputs.timestamp }} |
| 82 | + message-path: | |
| 83 | + .ci/ci-message.txt |
| 84 | + - name: Stop DUT and Clean the tests directory |
| 85 | + if: always() |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + sudo manage-devices -c /etc/manage-devices.yml down ${{ inputs.bitbake_machine }} |
| 89 | + rm -rf .ci/setup-env-local.sh .ci/tests_results .ci/ci-message.txt |
0 commit comments