Merge branch 'master' of github.com:emsec/hal #2988
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS | |
on: | |
push: | |
# create: | |
# tags: | |
# - v* | |
jobs: | |
build-test: | |
name: Build and Test macOS | |
strategy: | |
matrix: | |
# runs-on: [ubuntu-latest, macOS-latest] | |
runs-on: [macOS-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Cache pip macOS | |
uses: actions/cache@v1 | |
if: startsWith(runner.os, 'macOS') | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache Homebrew Downloads | |
if: startsWith(runner.os, 'macOS') | |
uses: actions/cache@v1 | |
with: | |
path: ~/Library/Caches/Homebrew | |
# key: ${{ runner.OS }}-build-downloads-${{ hashFiles('**/package-lock.json') }} | |
key: ${{ runner.OS }}-build-downloads | |
restore-keys: | | |
${{ runner.OS }}-build-downloads-${{ env.cache-name }}- | |
${{ runner.OS }}-build-downloads- | |
# - name: Cache Homebrew | |
# if: matrix.os == 'macOS-latest' | |
# uses: actions/cache@v1 | |
# with: | |
# path: /usr/local/Homebrew | |
# # key: ${{ runner.OS }}-build-localbrew-${{ hashFiles('**/package-lock.json') }} | |
# key: ${{ runner.OS }}-build-localbrew | |
# restore-keys: | | |
# ${{ runner.OS }}-build-localbrew-${{ env.cache-name }}- | |
# ${{ runner.OS }}-build-localbrew- | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
shell: cmake -P {0} | |
run: | | |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) | |
message("::set-output name=timestamp::${current_date}") | |
- name: ccache cache files | |
uses: actions/[email protected] | |
with: | |
path: ${{runner.workspace}}/.ccache | |
key: ${{ runner.OS }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ runner.OS }}-ccache- | |
- name: Install Dependencies | |
run: ./install_dependencies.sh | |
- name: Create Build Environment | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Configure CMake | |
if: startsWith(runner.os, 'macOS') | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
# Note the current convention is to use the -S and -B options here to specify source | |
# and build directories, but this is only available with CMake 3.13 and higher. | |
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | |
# brew link --force qt@5 | |
run: | | |
mkdir -p build | |
cd build | |
export PATH="$(brew --prefix qt@5)/bin:$PATH" | |
brew ls llvm@14 | |
brew --prefix llvm@14 | |
ls -l /usr/local | |
ls -l /opt/homebrew/opt | |
ls -l /opt/homebrew/opt/llvm@14 | |
ls -l /opt/homebrew/opt/llvm@14/bin | |
ls -l /opt/homebrew/opt/llvm@14/bin/clang | |
cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON -DCMAKE_C_COMPILER=$(brew --prefix llvm@14)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@14)/bin/clang++ | |
env: | |
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib" | |
CPPFLAGS: "-I$(brew --prefix llvm@14)/include" | |
HAL_BASE_PATH: ${{runner.workspace}}/hal/build | |
CCACHE_DIR: ${{runner.workspace}}/.ccache | |
CCACHE_COMPRESS: true | |
CCACHE_COMPRESSLEVEL: 6 | |
CCACHE_MAXSIZE: 500M | |
- name: Build | |
if: startsWith(runner.os, 'macOS') | |
shell: bash | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
cd build | |
export PATH="$(brew --prefix qt@5)/bin:$PATH" | |
export BUILD_TYPE=Debug | |
cmake --build . --target all --clean-first --config $BUILD_TYPE | |
env: | |
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib" | |
CPPFLAGS: "-I$(brew --prefix llvm@14)/include" | |
HAL_BASE_PATH: ${{runner.workspace}}/hal/build | |
CCACHE_DIR: ${{runner.workspace}}/.ccache | |
CCACHE_COMPRESS: true | |
CCACHE_COMPRESSLEVEL: 6 | |
CCACHE_MAXSIZE: 500M | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v1 | |
- name: Test | |
shell: bash | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: | | |
cd build | |
ninja | |
ctest --rerun-failed --output-on-failure | |
# ninja -v hal_coverage | |
# bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports" | |
env: | |
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib" | |
CPPFLAGS: "-I$(brew --prefix llvm@14)/include" | |
HAL_BASE_PATH: ${{runner.workspace}}/hal/build | |
CCACHE_DIR: ${{runner.workspace}}/.ccache | |
CCACHE_COMPRESS: true | |
CCACHE_COMPRESSLEVEL: 6 | |
CCACHE_MAXSIZE: 500M |