Merge pull request #54 from harmsm/main #343
This file contains hidden or 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
| # This workflow will install Python dependencies, run tests and lint with a single version of Python | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: topiary | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| concurrency: | |
| group: topiary-ci-group | |
| cancel-in-progress: false | |
| jobs: | |
| build-nix: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 1 | |
| matrix: | |
| os: [ubuntu-latest,macos-latest] | |
| python-version: ['3.11', '3.12', '3.13'] | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: set up miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: topiary | |
| environment-file: environment.yml | |
| channel-priority: strict | |
| python-version: ${{ matrix.python-version }} | |
| auto-activate-base: false | |
| miniconda-version: "latest" | |
| - name: get dependency hashes | |
| id: get-hashes | |
| shell: bash | |
| run: | | |
| GENERAX_HASH=$(git ls-remote https://github.com/harmslab/generax.git HEAD | awk '{print $1}') | |
| RAXML_HASH=$(git ls-remote https://github.com/harmslab/raxml-ng.git HEAD | awk '{print $1}') | |
| echo "generax_hash=$GENERAX_HASH" >> $GITHUB_OUTPUT | |
| echo "raxml_hash=$RAXML_HASH" >> $GITHUB_OUTPUT | |
| - name: cache generax | |
| id: cache-generax | |
| uses: actions/cache@v4 | |
| with: | |
| path: bin-cache/generax | |
| key: ${{ runner.os }}-generax-${{ steps.get-hashes.outputs.generax_hash }} | |
| - name: cache raxml-ng | |
| id: cache-raxml | |
| uses: actions/cache@v4 | |
| with: | |
| path: bin-cache/raxml-ng | |
| key: ${{ runner.os }}-raxml-${{ steps.get-hashes.outputs.raxml_hash }} | |
| - name: install topiary | |
| shell: bash -l {0} | |
| run: | | |
| # platform specific packages | |
| conda install -c conda-forge cmake | |
| python -m pip install .[dev] -vv | |
| python -m pip install coverage flake8 pytest genbadge[tests] pytest-mock | |
| # Ensure bin-cache exists | |
| mkdir -p bin-cache | |
| # compile generax if not cached | |
| if [ ! -f bin-cache/generax ]; then | |
| cd dependencies | |
| conda run -n topiary bash compile-generax.sh | |
| cp $CONDA_PREFIX/bin/generax ../bin-cache/ | |
| cd .. | |
| else | |
| cp bin-cache/generax $CONDA_PREFIX/bin/ | |
| fi | |
| # compile raxml if not cached | |
| if [ ! -f bin-cache/raxml-ng ]; then | |
| cd dependencies | |
| conda run -n topiary bash compile-raxml-ng.sh | |
| cp $CONDA_PREFIX/bin/raxml-ng ../bin-cache/ | |
| cd .. | |
| else | |
| cp bin-cache/raxml-ng $CONDA_PREFIX/bin/ | |
| fi | |
| - name: run flake8 | |
| shell: bash -l {0} | |
| run: | | |
| flake8 src/topiary tests --count --select=E9,F63,F7,F82 --show-source --statistics | |
| - name: run pytest | |
| shell: bash -l {0} | |
| env: | |
| TOPIARY_MPI_OVERSUBSCRIBE: "1" | |
| run: | | |
| pytest tests/ --run-raxml --run-generax --run-blast |