CI: make macos tests more useful by compiling all target and use ccache

This commit is contained in:
Pierre Kancir 2021-06-28 12:37:55 +02:00 committed by Andrew Tridgell
parent 9bd5183d82
commit 54daa94c90
2 changed files with 62 additions and 22 deletions

View File

@ -8,16 +8,56 @@ concurrency:
jobs:
build:
runs-on: 'macos-latest'
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
config: [
sitl,
CubeOrange,
]
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install Prerequisites
shell: bash
run: |
if [[ ${{ matrix.config }} == "sitl" ]]; then
export DO_AP_STM_ENV=0
fi
Tools/environment_install/install-prereqs-mac.sh -y
source ~/.bash_profile
# Put ccache into github cache for faster build
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "::set-output name=timestamp::${NOW}"
- name: ccache cache files
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{matrix.config}}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-${{matrix.config}} # restore ccache from either previous build on this branch or on master
- 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 = 400M" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: test build ${{matrix.config}}
env:
CI_BUILD_TARGET: ${{matrix.config}}
shell: bash
run: |
source ~/.bash_profile
PATH="/github/home/.local/bin:$PATH"
echo $PATH
./waf configure --board CubeOrange
./waf plane
./waf configure --board sitl
./waf plane
./waf configure --board ${{matrix.config}}
./waf
ccache -s
ccache -z

View File

@ -129,7 +129,6 @@ if [[ -z "${DO_AP_STM_ENV}" ]] && maybe_prompt_user "Install ArduPilot STM32 too
DO_AP_STM_ENV=1
fi
if [[ $DO_AP_STM_ENV -eq 1 ]]; then
echo "Checking ccache..."
{
$(which -s ccache)
@ -137,10 +136,11 @@ if [[ $DO_AP_STM_ENV -eq 1 ]]; then
{
brew install ccache
exportline="export PATH=/usr/local/opt/ccache/libexec:\$PATH";
echo $exportline >> ~/$SHELL_LOGIN
eval $exportline
}
CCACHE_PATH=$(which ccache)
if [[ $DO_AP_STM_ENV -eq 1 ]]; then
install_arm_none_eabi_toolchain
fi
@ -162,6 +162,8 @@ echo "Adding ArduPilot Tools to environment"
SCRIPT_DIR=$(dirname $(grealpath ${BASH_SOURCE[0]}))
ARDUPILOT_ROOT=$(grealpath "$SCRIPT_DIR/../../")
if [[ $DO_AP_STM_ENV -eq 1 ]]; then
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [N/y]?" ; then
@ -171,15 +173,13 @@ grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
fi
}
fi
SCRIPT_DIR=$(dirname $(grealpath ${BASH_SOURCE[0]}))
ARDUPILOT_ROOT=$(grealpath "$SCRIPT_DIR/../../")
exportline="export PATH=$ARDUPILOT_ROOT/$ARDUPILOT_TOOLS:\$PATH";
grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {
exportline2="export PATH=$ARDUPILOT_ROOT/$ARDUPILOT_TOOLS:\$PATH";
grep -Fxq "$exportline2" ~/$SHELL_LOGIN 2>/dev/null || {
if maybe_prompt_user "Add $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to your PATH [N/y]?" ; then
echo $exportline >> ~/$SHELL_LOGIN
eval $exportline
echo $exportline2 >> ~/$SHELL_LOGIN
eval $exportline2
else
echo "Skipping adding $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to PATH."
fi