switch to conda with libmamba #212
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Test and deploy | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- image: "ubuntu-latest" | |
short: "linux" | |
- image: "macos-13" | |
short: "osx" | |
qiime: | |
- version: "2023.9" | |
dist: "tiny" | |
python: 38 | |
- version: "2024.2" | |
dist: "tiny" | |
python: 38 | |
runs-on: "${{matrix.os.image}}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v3 | |
- shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Download Qiime2 env file | |
shell: bash -l {0} | |
run: | | |
wget https://data.qiime2.org/distro/${{matrix.qiime.dist}}/qiime2-${{matrix.qiime.dist}}-${{matrix.qiime.version}}-py${{matrix.qiime.python}}-${{matrix.os.short}}-conda.yml | |
mv qiime2-${{matrix.qiime.dist}}-${{matrix.qiime.version}}-py${{matrix.qiime.python}}-${{matrix.os.short}}-conda.yml env.yml | |
- name: Install Qiime 2 | |
shell: bash -l {0} | |
run: | | |
conda env create -n qiime2-dev --file env.yml | |
- name: Install CPLEX | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
conda install -v -c ibmdecisionoptimization cplex | |
- name: Install q2-micom | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
conda env update -n qiime2-dev -f q2-micom.yml | |
pip install -e . | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
pip install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --ignore=F203 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --ignore=F203 --max-complexity=10 --max-line-length=88 --statistics | |
- name: Test with pytest | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
pip install pytest pytest-benchmark pytest-cov | |
pytest --benchmark-skip --cov=q2_micom --cov-report=xml | |
- name: Upload to codecov | |
if: matrix.os.image == 'ubuntu-latest' | |
uses: codecov/codecov-action@v4.6.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: python-packages | |
path: dist/* | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: 'dist/*' | |
body: | | |
Please see https://github.com/micom-dev/q2-micom/blob/main/NEWS.md for the full release notes. | |
draft: false | |
prerelease: false |