Build Dependencies on macOS #49
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: Build Dependencies on macOS | |
on: | |
push: | |
branches: [master] | |
# Run this workflow every Sunday at 18:30 to refresh caches | |
schedule: | |
- cron: "30 18 * * 0" | |
workflow_dispatch: | |
env: | |
BUILD_TYPE: Debug | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup-viennals: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Store cache key in ENV | |
shell: bash | |
run: echo "VIENNALS_CACHE_KEY=viennals-dependency-cache-${{ runner.os }}-${{env.BUILD_TYPE}}-${{ hashFiles( './external/upstream/**CMakeLists.txt' ) }}" >> $GITHUB_ENV | |
- name: Check if cache key exists | |
uses: ./.github/actions/cache-check | |
id: cache-check | |
with: | |
cache-key: ${{env.VIENNALS_CACHE_KEY}} | |
token: ${{ secrets.PAT_CACHE }} | |
repository: ${{github.repository_owner}}/ViennaLS | |
- name: Clear Cache | |
if: ${{ github.event_name == 'schedule' && steps.cache-check.outputs.exists == 'true'}} | |
uses: ./.github/actions/cache-delete | |
with: | |
cache-key: ${{env.VIENNALS_CACHE_KEY}} | |
token: ${{ secrets.PAT_CACHE }} | |
repository: ${{github.repository_owner}}/ViennaLS | |
- name: Store cache refresh key in ENV | |
shell: bash | |
run: echo "CACHE_REFRESH=${{ github.event_name == 'schedule' || steps.cache-check.outputs.exists != 'true' }}" >> $GITHUB_ENV | |
- name: Setup Cache for Build Dependencies | |
if: ${{ env.CACHE_REFRESH == 'true' }} | |
uses: actions/cache@v3 | |
id: viennals-dependency-cache | |
with: | |
key: ${{env.VIENNALS_CACHE_KEY}} | |
path: ${{github.workspace}}/dependencies/Install | |
- name: Configure | |
if: ${{ env.CACHE_REFRESH == 'true' }} | |
run: | | |
cmake -B ${{github.workspace}}/build \ | |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-D OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ | |
-D OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ | |
-D OpenMP_C_LIB_NAMES="omp" \ | |
-D OpenMP_CXX_LIB_NAMES="omp" \ | |
-D OpenMP_omp_LIBRARY="$(brew --prefix libomp)/lib/libomp.a" | |
- name: Build | |
if: ${{ env.CACHE_REFRESH == 'true' }} | |
run: cmake --build ${{github.workspace}}/build |