Skip to content

Bump actions/setup-python from 4 to 5 (#28) #164

Bump actions/setup-python from 4 to 5 (#28)

Bump actions/setup-python from 4 to 5 (#28) #164

Workflow file for this run

# 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.9"
dist: "tiny"
python: 38
runs-on: "${{matrix.os.image}}"
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
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://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: |
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-${{matrix.os.short}}.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@v5
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