2021-04-09 09:54:28 +02:00
name : CI
on : [ 'push' , 'pull_request' ]
jobs :
build :
2021-04-09 10:03:43 +02:00
name : CI
2021-04-09 09:54:28 +02:00
strategy :
2021-04-09 10:03:43 +02:00
fail-fast : false
2021-04-09 09:54:28 +02:00
matrix :
os :
- macos-10.15
2021-04-18 04:45:30 +02:00
- ubuntu-18.04
2021-04-17 18:31:10 +02:00
- ubuntu-20.04
2021-04-09 09:54:28 +02:00
compiler :
- cxx : g++-7
cc : gcc-7
2021-04-17 18:31:10 +02:00
macos_cxx : g++-7
macos_cc : gcc-7
2021-04-09 09:54:28 +02:00
homebrew_package : gcc@7
2021-04-17 18:31:10 +02:00
apt_package : g++-7
2021-04-09 09:54:28 +02:00
- cxx : g++-8
cc : gcc-8
2021-04-17 18:31:10 +02:00
macos_cxx : g++-8
macos_cc : gcc-8
2021-04-09 09:54:28 +02:00
homebrew_package : gcc@8
2021-04-17 18:31:10 +02:00
apt_package : g++-8
2021-04-09 09:54:28 +02:00
- cxx : g++-9
cc : gcc-9
2021-04-17 18:31:10 +02:00
macos_cxx : g++-9
macos_cc : gcc-9
apt_package : g++-9
2021-04-09 09:54:28 +02:00
homebrew_package : gcc@9
# - cxx: g++-10
# cc: gcc-10
2021-04-17 18:31:10 +02:00
# macos_cxx: g++-10
# macos_cc: gcc-10
# apt_package: g++-10
2021-04-09 09:54:28 +02:00
# homebrew_package: gcc@10
2021-04-17 18:31:10 +02:00
- cxx : clang++-7
cc : clang-7
macos_cxx : /usr/local/opt/llvm@7/bin/clang++
macos_cc : /usr/local/opt/llvm@7/bin/clang
apt_package : clang-7
2021-04-09 10:03:43 +02:00
homebrew_package : llvm@7
2021-04-17 18:31:10 +02:00
- cxx : clang++-8
cc : clang-8
macos_cxx : /usr/local/opt/llvm@8/bin/clang++
macos_cc : /usr/local/opt/llvm@8/bin/clang
apt_package : clang-8
2021-04-09 10:03:43 +02:00
homebrew_package : llvm@8
2021-04-17 18:31:10 +02:00
- cxx : clang++-9
cc : clang-9
macos_cxx : /usr/local/opt/llvm@9/bin/clang++
macos_cc : /usr/local/opt/llvm@9/bin/clang
apt_package : clang-9
2021-04-09 10:03:43 +02:00
homebrew_package : llvm@9
2021-04-17 18:31:10 +02:00
# TODO Clang-10 on linux? macos homebrew doesn't seem to have it
- cxx : clang++-11
cc : clang-11
macos_cxx : /usr/local/opt/llvm@11/bin/clang++
macos_cc : /usr/local/opt/llvm@11/bin/clang
apt_package : clang-11
2021-04-09 10:03:43 +02:00
homebrew_package : llvm@11
# Apple Clang
# - cxx: clang++
# cc: clang
# homebrew_package: ""
2021-04-09 09:54:28 +02:00
build_type :
- Debug
- Release
- RelWithDebInfo
runs-on : ${{matrix.os}}
env :
# Setting conan cache dir to a location where our Github Cache Action can find it
CONAN_USER_HOME : "${{ github.workspace }}/conan-cache/"
steps :
- name : Checkout
uses : actions/checkout@v1
2021-04-17 18:31:10 +02:00
#TODO Ideally, all the setup actions would be in their own subaction, but Github doesn't support using third party actions (e.g. cache) from nested actions yet, see https://github.com/actions/runner/issues/862
- name : Install OSX dependencies
if : ${{ runner.os == 'macOS' }}
shell : bash
2021-04-09 09:54:28 +02:00
run : |
2021-04-18 00:57:32 +02:00
brew install ninja macfuse libomp ccache ${{matrix.compiler.homebrew_package}}
2021-04-17 18:31:10 +02:00
- name : Install Linux dependencies
if : ${{ runner.os == 'Linux' }}
2021-04-09 09:54:28 +02:00
shell : bash
2021-04-17 18:31:10 +02:00
run : |
2021-04-18 04:45:30 +02:00
if [[ "${{matrix.os}}" == "ubuntu-18.04" ]]; then
echo Adding apt repositories for newer clang versions on Ubuntu 18.04
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo touch /etc/apt/sources.list.d/clang.list
sudo chmod o+w /etc/apt/sources.list.d/clang.list
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list.d/clang.list
echo "deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list.d/clang.list
sudo chmod o-w /etc/apt/sources.list.d/clang.list
elif [[ "${{matrix.os}}" == "ubuntu-20.04" ]]; then
echo Adding apt repositories for newer clang versions on Ubuntu 20.04
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo touch /etc/apt/sources.list.d/clang.list
sudo chmod o+w /etc/apt/sources.list.d/clang.list
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" >> /etc/apt/sources.list.d/clang.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" >> /etc/apt/sources.list.d/clang.list
sudo chmod o-w /etc/apt/sources.list.d/clang.list
fi
sudo apt-get update
2021-04-18 00:57:32 +02:00
sudo apt-get install ninja-build libcurl4-openssl-dev libfuse-dev ccache ${{matrix.compiler.apt_package}}
- name : Find pip cache location
id : pip_cache_dir
run : |
# We need at least pip 20.1 to get the "pip cache dir" command. Ubuntu doesn't have pip 20.1 by default yet, let's upgrade it
python3 -m pip install -U pip
python3 -m pip --version
echo "::set-output name=pip_cache_dir::$(python3 -m pip cache dir)"
shell : bash
- name : Retrieve pip cache
# We're using an S3 based cache because the standard GitHub Action cache (actions/cache) only gives us 5GB of storage and we need more
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
with :
action : get
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-setup-pip
2021-04-17 18:31:10 +02:00
- name : Install Conan
shell : bash
run : |
# Using "python3 -m pip" instead of "pip3" to make sure we get the same pip that we queried the cache dir for the Github Cache action
2021-04-18 04:45:30 +02:00
if [[ "${{matrix.os}}" == "ubuntu-18.04" ]]; then
python3 -m pip install setuptools
fi
2021-04-17 18:31:10 +02:00
python3 -m pip install conan
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
2021-04-18 00:57:32 +02:00
- name : Save pip cache
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
with :
action : put
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-setup-pip
artifacts : ${{ steps.pip_cache_dir.outputs.pip_cache_dir }}
2021-04-18 09:47:44 +02:00
#TODO Ideally, the Setup ccache step would be part of the build action, but Github doesn't support nested actions yet, see https://github.com/actions/runner/issues/862
2021-04-09 09:54:28 +02:00
- name : Configure ccache
shell : bash
2021-04-12 04:45:56 +02:00
run : |
set -v
ccache --set-config=compiler_check=content
2021-04-18 00:57:32 +02:00
ccache --set-config=max_size=500M
ccache --set-config=cache_dir=${{github.workspace}}/.ccache
ccache --set-config=compression=true
echo CCache config :
ccache -p
echo Clearing ccache statistics
ccache -z
2021-04-18 03:05:10 +02:00
- name : Retrieve ccache cache
# We're using an S3 based cache because the standard GitHub Action cache (actions/cache) only gives us 5GB of storage and we need more
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
with :
action : get
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-ccache__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__
2021-04-18 04:45:30 +02:00
- name : Show ccache statistics
shell : bash
run : |
set -v
ccache -s
2021-04-09 09:54:28 +02:00
# TODO Ideally, the Setup conan cache step would be part of the build action, but Github doesn't support nested actions yet, see https://github.com/actions/runner/issues/862
2021-04-18 00:57:32 +02:00
- name : Retrieve conan cache
# We're using an S3 based cache because the standard GitHub Action cache (actions/cache) only gives us 5GB of storage and we need more
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
2021-04-09 09:54:28 +02:00
with :
2021-04-18 00:57:32 +02:00
action : get
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-conancache__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__
2021-04-17 18:31:10 +02:00
- name : Build (macOS)
if : ${{ runner.os == 'macOS' }}
uses : ./.github/workflows/actions/run_build
with :
cxx : ${{ matrix.compiler.macos_cxx }}
cc : ${{ matrix.compiler.macos_cc }}
build_type : ${{ matrix.build_type }}
- name : Build (Linux)
if : ${{ runner.os == 'Linux' }}
2021-04-09 09:54:28 +02:00
uses : ./.github/workflows/actions/run_build
with :
cxx : ${{ matrix.compiler.cxx }}
cc : ${{ matrix.compiler.cc }}
build_type : ${{ matrix.build_type }}
2021-04-18 00:57:32 +02:00
- name : Show ccache statistics
shell : bash
run : |
set -v
ccache -s
- name : Reduce ccache size
2021-04-17 18:31:10 +02:00
if : ${{ runner.os == 'macOS' }}
shell : bash
run : |
set -v
ccache --evict-older-than 7d
2021-04-18 01:13:35 +02:00
ccache -s
2021-04-18 00:57:32 +02:00
- name : Save ccache cache
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
with :
action : put
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-ccache__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__
artifacts : ${{ github.workspace }}/.ccache
- name : Save conan cache
uses : leroy-merlin-br/action-s3-cache@8d75079437b388688b9ea9c7d73dff4ef975c5fa # v1.0.5
with :
action : put
aws-access-key-id : ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key : ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region : ${{ secrets.CACHE_AWS_REGION }}
bucket : ${{ secrets.CACHE_AWS_S3_BUCKET }}
key : v0-${{ runner.os }}-${{ matrix.os }}-conancache__${{matrix.compiler.cxx}}__${{matrix.compiler.cc}}__${{matrix.build_type}}__
artifacts : ${{ env.CONAN_USER_HOME }}
- name : Test
uses : ./.github/workflows/actions/run_tests