Fix the CI (#24) #148
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-latest" | |
short: "osx" | |
qiime: | |
- version: "2023.7" | |
python: 38 | |
- version: "2023.5" | |
python: 38 | |
runs-on: "${{matrix.os.image}}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
- shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Download Qiime2 env file | |
shell: bash -l {0} | |
run: | | |
wget https://raw.githubusercontent.com/qiime2/environment-files/master/${{matrix.qiime.version}}/release/qiime2-${{matrix.qiime.version}}-py${{matrix.qiime.python}}-${{matrix.os.short}}-conda.yml | |
cp qiime2-${{matrix.qiime.version}}-py${{matrix.qiime.python}}-${{matrix.os.short}}-conda.yml env.yml | |
- name: Install Qiime 2 | |
shell: bash -l {0} | |
run: | | |
mamba env create -n qiime2-dev --file env.yml | |
- name: Install CPLEX | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
mamba install -v -c ibmdecisionoptimization cplex | |
- name: Install q2-micom | |
shell: bash -l {0} | |
run: | | |
conda activate qiime2-dev | |
mamba env update -n qiime2-dev -f q2-micom.yml | |
- 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@v3 | |
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@v4 | |
with: | |
python-version: '3.8' | |
- 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@v3 | |
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/master/NEWS.md for the full release notes. | |
draft: false | |
prerelease: false |