Skip to content

Commit

Permalink
ci: replace build workflows (PX4#23550)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpollo authored Aug 19, 2024
1 parent 0481c04 commit 746ae25
Show file tree
Hide file tree
Showing 7 changed files with 268 additions and 255 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ tab_width = 8
# Not in the official standard, but supported by many editors
max_line_length = 120

[*.yaml]
[*.yaml, *.yml]
indent_style = space
indent_size = 2
83 changes: 83 additions & 0 deletions .github/workflows/build_all_targets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build all targets

on:
push:
branches:
- 'main'
- 'stable'
- 'beta'
- 'release/*'
pull_request:
branches:
- '*'

jobs:
group_targets:
name: Scan for Board Targets
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
timestamp: ${{ steps.set-timestamp.outputs.timestamp }}
steps:
- uses: actions/checkout@v4

- name: Install Python Dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "./Tools/setup/requirements.txt"

- id: set-matrix
run: echo "::set-output name=matrix::$(./Tools/generate_board_targets_json.py --group)"

- id: set-timestamp
run: echo "::set-output name=timestamp::$(date +"%Y%m%d%H%M%S")"

setup:
name: ${{ matrix.group }}
runs-on: ubuntu-latest
needs: group_targets
strategy:
matrix: ${{ fromJson(needs.group_targets.outputs.matrix) }}
container:
image: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ownership workaround
run: git config --system --add safe.directory '*'

- name: ccache setup keys
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ matrix.group }}-ccache-${{ needs.group_targets.outputs.timestamp }}
restore-keys: ${{ matrix.group }}-ccache-${{ needs.group_targets.outputs.timestamp }}

- name: setup ccache
run: |
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 120M" >> ~/.ccache/ccache.conf
echo "hash_dir = false" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: build target group
run: |
./Tools/ci_build_all_runner.sh ${{matrix.targets}}
- name: Upload px4 package
uses: actions/upload-artifact@v4
with:
name: px4_${{matrix.group}}_build_artifacts
path: |
build/**/*.px4
build/**/*.bin
compression-level: 0

- name: ccache post-run
run: ccache -s
58 changes: 0 additions & 58 deletions .github/workflows/compile_linux.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/compile_linux_arm64.yml

This file was deleted.

137 changes: 0 additions & 137 deletions .github/workflows/compile_nuttx.yml

This file was deleted.

19 changes: 19 additions & 0 deletions Tools/ci_build_all_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# This script is meant to be used by the build_all.yml workflow in a github runner
# Please only modify if you know what you are doing
set -e

echo "### :clock1: Build Times" >> $GITHUB_STEP_SUMMARY
targets=$1
for target in ${targets//,/ }
do
echo "::group::Building: [${target}]"
start=$(date +%s)
make $target
stop=$(date +%s)
diff=$(($stop-$start))
build_time="$(($diff /60/60))h $(($diff /60))m $(($diff % 60))s elapsed"
echo -e "\033[0;32mBuild Time: [$build_time]"
echo "* **$target** - $build_time" >> $GITHUB_STEP_SUMMARY
echo "::endgroup::"
done
Loading

0 comments on commit 746ae25

Please sign in to comment.