From c7e5a306f52dbba4b8b557bdf96dacea696e4259 Mon Sep 17 00:00:00 2001 From: molpopgen Date: Tue, 24 Nov 2020 10:23:22 -0800 Subject: [PATCH] Add macOS build/test action for C++14. --- .github/workflows/tests_macOS.yml | 93 +++++++++++++++++++++++ requirements/conda_minimal_deps.txt | 5 ++ requirements/conda_minimal_deps_macOS.txt | 1 + 3 files changed, 99 insertions(+) create mode 100644 .github/workflows/tests_macOS.yml create mode 100644 requirements/conda_minimal_deps.txt create mode 100644 requirements/conda_minimal_deps_macOS.txt diff --git a/.github/workflows/tests_macOS.yml b/.github/workflows/tests_macOS.yml new file mode 100644 index 000000000..b6c7a75f5 --- /dev/null +++ b/.github/workflows/tests_macOS.yml @@ -0,0 +1,93 @@ +name: macOS tests + +on: + pull_request: + push: + branches: [main, dev] + +jobs: + test: + name: Build and run tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + python: [ 3.8 ] + os: [ macos-latest ] + defaults: + run: + shell: bash + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ secrets.ACTIONS }} + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Cache conda and dependancies + id: cache + uses: actions/cache@v2 + with: + path: | + /usr/share/miniconda/envs/anaconda-client-env + ~/osx-conda + ~/.bashrc + key: ${{ runner.os }}-${{ matrix.python }}-conda-v1-${{ hashFiles('requirements/conda_minimal_deps.txt') }} + + - name: Install Conda + uses: conda-incubator/setup-miniconda@v2 + if: steps.cache.outputs.cache-hit != 'true' + with: + activate-environment: anaconda-client-env + python-version: ${{ matrix.python }} + channels: conda-forge + channel-priority: strict + auto-update-conda: true + use-only-tar-bz2: true + + - name: Install conda deps + if: steps.cache.outputs.cache-hit != 'true' + shell: bash -l {0} #We need a login shell to get conda + run: | + conda install --yes --file=requirements/conda_minimal_deps_${{ runner.os }}.txt + conda install --yes --file=requirements/conda_minimal_deps.txt + + - name: Fix OSX Cache Write #OSX Won't let the cache restore due to file perms + if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' + run: | + cp -r /usr/local/miniconda/envs/anaconda-client-env ~/osx-conda + + - name: Fix OSX Cache Restore + if: steps.cache.outputs.cache-hit == 'true' && matrix.os == 'macos-latest' + run: | + mkdir -p /usr/local/miniconda/envs + sudo cp -r ~/osx-conda /usr/local/miniconda/envs/anaconda-client-env + + - name: Init conda + shell: bash -l {0} + run: | + conda init bash + + - name: Fix OSX profile + if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' + run: | + cp ~/.bash_profile ~/.bashrc + + - name: Configure and build + # shell: bash -l {0} + run: | + # conda init bash + source ~/.bashrc + conda activate anaconda-client-env + autoreconf --install + ./configure + make -j 3 + + - name: Run C++ tests + run: | + source ~/.bashrc + conda activate anaconda-client-env + make check -j 2 diff --git a/requirements/conda_minimal_deps.txt b/requirements/conda_minimal_deps.txt new file mode 100644 index 000000000..f2b054003 --- /dev/null +++ b/requirements/conda_minimal_deps.txt @@ -0,0 +1,5 @@ +boost +autoconf +automake +make +gsl diff --git a/requirements/conda_minimal_deps_macOS.txt b/requirements/conda_minimal_deps_macOS.txt new file mode 100644 index 000000000..18eae1de1 --- /dev/null +++ b/requirements/conda_minimal_deps_macOS.txt @@ -0,0 +1 @@ +clangxx_osx-64