Skip to content

Commit

Permalink
print build input and output containers
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoSairiala committed Jan 25, 2024
1 parent ebd9f38 commit 7180e38
Showing 1 changed file with 89 additions and 6 deletions.
95 changes: 89 additions & 6 deletions .github/workflows/tiiuae-pixhawk-and-saluki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,45 @@ jobs:
enabled: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
secrets: inherit

variables:
runs-on: ubuntu-latest
outputs:
jfrog_upload: ${{ steps.variables.outputs.jfrog_upload }}
saluki_v2_fpga_version: ${{ steps.variables.outputs.saluki_v2_fpga_version }}
saluki_v3_fpga_version: ${{ steps.variables.outputs.saluki_v3_fpga_version }}
saluki_pi_fpga_version: ${{ steps.variables.outputs.saluki_pi_fpga_version }}
steps:
- name: Print input variables
id: variables
run: |
# use saluki-v2-fpga default version if custom is not provided
saluki_v2_fpga_version=${{ env.saluki_v2_fpga_version }}
if [ -n "${{ github.event.inputs.saluki-v2-manual-fpga-version }}" ]; then
saluki_v2_fpga_version=${{ github.event.inputs.saluki-v2-manual-fpga-version }}
fi
# use saluki-v3-fpga default version if custom is not provided
saluki_v3_fpga_version=${{ env.saluki_v3_fpga_version }}
if [ -n "${{ github.event.inputs.saluki-v3-manual-fpga-version }}" ]; then
saluki_v3_fpga_version=${{ github.event.inputs.saluki-v3-manual-fpga-version }}
fi
# use saluki-pi-fpga default version if custom is not provided
saluki_pi_fpga_version=${{ env.saluki_pi_fpga_version }}
if [ -n "${{ github.event.inputs.saluki-pi-manual-fpga-version }}" ]; then
saluki_pi_fpga_version=${{ github.event.inputs.saluki-pi-manual-fpga-version }}
fi
echo "saluki_v2_fpga_version=${saluki_v2_fpga_version}" >> $GITHUB_OUTPUT
echo "saluki_v3_fpga_version=${saluki_v3_fpga_version}" >> $GITHUB_OUTPUT
echo "saluki_pi_fpga_version=${saluki_pi_fpga_version}" >> $GITHUB_OUTPUT
echo "jfrog_upload=${{ github.event.inputs.jfrog-upload }}" >> $GITHUB_OUTPUT
echo "saluki_v2_fpga_version: ${saluki_v2_fpga_version}"
echo "saluki_v3_fpga_version: ${saluki_v3_fpga_version}"
echo "saluki_pi_fpga_version: ${saluki_pi_fpga_version}"
echo "jfrog_upload: ${{ github.event.inputs.jfrog-upload }}"
px4fwupdater:
name: build px4fwupdater
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,6 +137,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- px4fwupdater
- variables
steps:
- name: Checkout px4-firmware
uses: actions/checkout@v3
Expand Down Expand Up @@ -134,15 +174,58 @@ jobs:
tags: ${{ steps.containermeta.outputs.tags }}
labels: ${{ steps.containermeta.outputs.labels }}
build-args: |
"saluki_pi_fpga_version=${{ env.saluki_pi_fpga_version }}"
"saluki_v2_fpga_version=${{ env.saluki_v2_fpga_version }}"
"saluki_v3_fpga_version=${{ env.saluki_v3_fpga_version }}"
"saluki_pi_fpga_version=${{ needs.variables.outputs.saluki_pi_fpga_version }}"
"saluki_v2_fpga_version=${{ needs.variables.outputs.saluki_v2_fpga_version }}"
"saluki_v3_fpga_version=${{ needs.variables.outputs.saluki_v3_fpga_version }}"
- name: Build overview
run: |
echo "### Build overview:" >> $GITHUB_STEP_SUMMARY
echo "Build version: ${{ steps.containermeta.outputs.tags }}"
echo "Build labels: ${{ steps.containermeta.outputs.labels }}"
echo "Build args:"
echo " saluki_pi_fpga_version: ${{ needs.variables.outputs.saluki_pi_fpga_version }}"
echo " saluki_v2_fpga_version: ${{ needs.variables.outputs.saluki_v2_fpga_version }}"
echo " saluki_v3_fpga_version: ${{ needs.variables.outputs.saluki_v3_fpga_version }}"
# in case more than one tag is generated, use the one which mentions commit sha
if (( $(echo "${{ steps.containermeta.outputs.tags }}" | wc -l) > 1 )); then
container_name=$(echo "${{ steps.containermeta.outputs.tags }}" | grep ':sha-' | head -n 1)
else
container_name="${{ steps.containermeta.outputs.tags }}"
fi
echo "Container name: $container_name"
# display mermaid flowchart
echo '```mermaid' >> $GITHUB_STEP_SUMMARY
echo "flowchart LR" >> $GITHUB_STEP_SUMMARY
# inputs
echo "FPGA-V2[(${{ needs.variables.outputs.saluki_v2_fpga_version }})]" >> $GITHUB_STEP_SUMMARY
echo "FPGA-V3[(${{ needs.variables.outputs.saluki_v3_fpga_version }})]" >> $GITHUB_STEP_SUMMARY
echo "FPGA-PI[(${{ needs.variables.outputs.saluki_pi_fpga_version }})]" >> $GITHUB_STEP_SUMMARY
echo "PX4-SHA[saluki-fpga\n$GITHUB_REF]" >> $GITHUB_STEP_SUMMARY
# build
echo "BUILD[PX4 build]" >> $GITHUB_STEP_SUMMARY
# outputs
echo "OUTPUT[(${container_name})]" >> $GITHUB_STEP_SUMMARY
# links
echo "FPGA-V2 --> BUILD" >> $GITHUB_STEP_SUMMARY
echo "FPGA-V3 --> BUILD" >> $GITHUB_STEP_SUMMARY
echo "FPGA-PI --> BUILD" >> $GITHUB_STEP_SUMMARY
echo "PX4-SHA --> BUILD" >> $GITHUB_STEP_SUMMARY
echo "BUILD --> OUTPUT" >> $GITHUB_STEP_SUMMARY
# end mermaid flowchart
echo '```' >> $GITHUB_STEP_SUMMARY
upload-px4fwupdater-uae:
name: upload px4fwupdater to UAE docker registry
runs-on: ubuntu-latest
needs:
- px4fwupdater
- variables
steps:
- name: Checkout px4-firmware
uses: actions/checkout@v3
Expand Down Expand Up @@ -186,9 +269,9 @@ jobs:
tags: ${{ steps.containermeta.outputs.tags }}
labels: ${{ steps.containermeta.outputs.labels }}
build-args: |
"saluki_pi_fpga_version=${{ inputs.saluki-pi-manual-fpga-version != '' && inputs.saluki-pi-manual-fpga-version || env.saluki_pi_fpga_version }}"
"saluki_v2_fpga_version=${{ inputs.saluki-v2-manual-fpga-version != '' && inputs.saluki-v2-manual-fpga-version || env.saluki_v2_fpga_version }}"
"saluki_v3_fpga_version=${{ inputs.saluki-v3-manual-fpga-version != '' && inputs.saluki-v3-manual-fpga-version || env.saluki_v3_fpga_version }}"
"saluki_pi_fpga_version=${{ needs.variables.outputs.saluki_pi_fpga_version }}"
"saluki_v2_fpga_version=${{ needs.variables.outputs.saluki_v2_fpga_version }}"
"saluki_v3_fpga_version=${{ needs.variables.outputs.saluki_v3_fpga_version }}"
artifactory:
name: upload builds to artifactory
Expand Down

0 comments on commit 7180e38

Please sign in to comment.