-
Notifications
You must be signed in to change notification settings - Fork 4
115 lines (108 loc) · 3.6 KB
/
test_package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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@v4
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@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