Skip to content

Commit

Permalink
.github: reduce duplicate for GCC and Clang build
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr authored and tridge committed Nov 20, 2020
1 parent d1983b0 commit f40a5b9
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 302 deletions.
77 changes: 24 additions & 53 deletions .github/workflows/test_sitl_copter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ on: [push, pull_request]
# - "!README.md" <-- don't rebuild on doc change

jobs:
build-gcc:
build:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
container: khancyr/ardupilot-dev-${{ matrix.toolchain }}:latest
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
toolchain: [
base, # GCC
clang,
]
steps:
# git checkout the PR
- uses: actions/checkout@v2
Expand All @@ -24,8 +31,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand All @@ -35,57 +42,21 @@ jobs:
echo "max_size = 400M" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: build copter
- name: build copter ${{ matrix.toolchain }}
shell: bash
run: |
if [[ ${{ matrix.toolchain }} = "clang" ]]; then
export CC=clang-7
export CXX=clang++-7
fi
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl
./waf build --target bin/arducopter
ccache -s
ccache -z
build-clang:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-clang:latest
steps:
# git checkout the PR
- uses: actions/checkout@v2
with:
submodules: 'recursive'
# 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-clang-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-clang- # 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: build copter
shell: bash
run: |
export CC=clang-7
export CXX=clang++-7
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl --board sitl
./waf build --target bin/arducopter
ccache -s
ccache -z
autotest:
needs: build-gcc # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
strategy:
Expand Down Expand Up @@ -116,8 +87,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand Down Expand Up @@ -151,7 +122,7 @@ jobs:


build-gcc-heli:
needs: build-gcc # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
steps:
Expand All @@ -169,8 +140,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand Down Expand Up @@ -215,8 +186,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand Down
67 changes: 19 additions & 48 deletions .github/workflows/test_sitl_plane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,16 @@ on: [push, pull_request]
# - "!README.md" <-- don't rebuild on doc change

jobs:
build-gcc:
build:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
steps:
# git checkout the PR
- uses: actions/checkout@v2
with:
submodules: 'recursive'
# 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-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # 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: build plane gcc
shell: bash
run: |
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl
./waf build --target bin/arduplane
ccache -s
ccache -z
build-clang:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-clang:latest
container: khancyr/ardupilot-dev-${{ matrix.toolchain }}:latest
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
toolchain: [
base, # GCC
clang,
]
steps:
# git checkout the PR
- uses: actions/checkout@v2
Expand All @@ -62,8 +31,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-clang-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-clang- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand All @@ -73,19 +42,21 @@ jobs:
echo "max_size = 400M" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: build plane clang
- name: build plane ${{ matrix.toolchain }}
shell: bash
run: |
export CC=clang-7
export CXX=clang++-7
if [[ ${{ matrix.toolchain }} = "clang" ]]; then
export CC=clang-7
export CXX=clang++-7
fi
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl
./waf build --target bin/arduplane
ccache -s
ccache -z
autotest:
needs: build-gcc # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
strategy:
Expand All @@ -111,8 +82,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand Down
67 changes: 19 additions & 48 deletions .github/workflows/test_sitl_rover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,16 @@ on: [push, pull_request]
# - "!README.md" <-- don't rebuild on doc change

jobs:
build-gcc:
build:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
steps:
# git checkout the PR
- uses: actions/checkout@v2
with:
submodules: 'recursive'
# 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-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # 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: build rover gcc
shell: bash
run: |
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl
./waf build --target bin/ardurover
ccache -s
ccache -z
build-clang:
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-clang:latest
container: khancyr/ardupilot-dev-${{ matrix.toolchain }}:latest
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
toolchain: [
base, # GCC
clang,
]
steps:
# git checkout the PR
- uses: actions/checkout@v2
Expand All @@ -62,8 +31,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-clang-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-clang- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand All @@ -73,19 +42,21 @@ jobs:
echo "max_size = 400M" >> ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: build rover clang
- name: build rover ${{ matrix.toolchain }}
shell: bash
run: |
export CC=clang-7
export CXX=clang++-7
if [[ ${{ matrix.toolchain }} = "clang" ]]; then
export CC=clang-7
export CXX=clang++-7
fi
PATH="/github/home/.local/bin:$PATH"
./waf configure --board sitl
./waf build --target bin/ardurover
ccache -s
ccache -z
autotest:
needs: build-gcc # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
runs-on: ubuntu-20.04
container: khancyr/ardupilot-dev-base:latest
strategy:
Expand All @@ -111,8 +82,8 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
mkdir -p ~/.ccache
Expand Down
Loading

0 comments on commit f40a5b9

Please sign in to comment.