Skip to content
This repository was archived by the owner on May 20, 2020. It is now read-only.

Commit 1a4bff3

Browse files
authored
Merge pull request #225 from matchms/193-check-conda-package
WIP-193 check conda package
2 parents d1b21e8 + fbed102 commit 1a4bff3

File tree

12 files changed

+192
-37
lines changed

12 files changed

+192
-37
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
shell: bash -l {0}
3737
run: python -m pip install -r conda/requirements-dev.txt
3838
- name: Conda list
39-
shell: pwsh
39+
shell: bash -l {0}
4040
run: conda list
4141
- name: Check style against standards using prospector
4242
shell: bash -l {0}
Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: 'Anaconda Build and Publish'
1+
name: Anaconda Build
22

3-
on:
4-
release:
5-
types: [published]
3+
on: [push, pull_request]
64

75
jobs:
86

9-
publish:
10-
name: Publish conda (${{ matrix.python-version }}, ${{ matrix.os }})
7+
build:
8+
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }})
119
runs-on: ${{ matrix.os }}
1210
strategy:
1311
fail-fast: false
@@ -18,33 +16,31 @@ jobs:
1816
- uses: actions/checkout@v2
1917
- uses: goanpeca/setup-miniconda@v1
2018
with:
21-
miniconda-version: 'latest'
19+
activate-environment: matchms-build
20+
auto-activate-base: false
2221
auto-update-conda: true
22+
environment-file: conda/environment-build.yml
23+
miniconda-version: 'latest'
2324
python-version: ${{ matrix.python-version }}
24-
activate-environment: matchms
25-
auto-activate-base: false
26-
channels: conda-forge,bioconda,nlesc
27-
- name: Install required packages
28-
shell: bash -l {0}
29-
run: |
30-
conda install conda-build conda-verify anaconda
3125
- name: Show conda config
3226
shell: bash -l {0}
3327
run: |
3428
conda info
3529
conda list
3630
conda config --show-sources
3731
conda config --show
32+
- name: Python info
33+
shell: bash -l {0}
34+
run: |
35+
which python
36+
python --version
3837
- name: Build the conda package
3938
shell: bash -l {0}
4039
run: |
4140
conda config --set anaconda_upload no
42-
export BUILD_FOLDER=./output
43-
export BUILD_DATE=`date +%Y.%m.%d`
41+
export BUILD_FOLDER=/tmp/matchms/_build
4442
mkdir -p $BUILD_FOLDER
45-
conda build -c bioconda -c conda-forge -c nlesc --output-folder $BUILD_FOLDER .
46-
- name: Push the package to anaconda cloud
47-
shell: bash -l {0}
48-
run: |
49-
export BUILD_FOLDER=./output
50-
anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload -u nlesc --force $BUILD_FOLDER/noarch/*.tar.bz2
43+
conda build --numpy 1.18.1 --no-include-recipe \
44+
--channel bioconda --channel conda-forge \
45+
--croot $BUILD_FOLDER \
46+
./conda
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Anaconda Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
publish:
10+
name: Publish for (${{ matrix.python-version }}, ${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
16+
python-version: ['3.7']
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: goanpeca/setup-miniconda@v1
20+
with:
21+
activate-environment: matchms-build
22+
auto-activate-base: false
23+
auto-update-conda: true
24+
environment-file: conda/environment-build.yml
25+
miniconda-version: 'latest'
26+
python-version: ${{ matrix.python-version }}
27+
- name: Show conda config
28+
shell: bash -l {0}
29+
run: |
30+
conda info
31+
conda list
32+
conda config --show-sources
33+
conda config --show
34+
- name: Python info
35+
shell: bash -l {0}
36+
run: |
37+
which python
38+
python --version
39+
- name: Build the conda package
40+
shell: bash -l {0}
41+
run: |
42+
conda config --set anaconda_upload no
43+
export BUILD_FOLDER=/tmp/matchms/_build
44+
mkdir -p $BUILD_FOLDER
45+
conda build --numpy 1.18.1 --no-include-recipe \
46+
--channel bioconda --channel conda-forge \
47+
--croot $BUILD_FOLDER \
48+
./conda
49+
- name: Push the package to anaconda cloud
50+
shell: bash -l {0}
51+
run: |
52+
export BUILD_FOLDER=/tmp/matchms/_build
53+
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --user nlesc --force $BUILD_FOLDER/noarch/*.tar.bz2
54+
- uses: goanpeca/setup-miniconda@v1
55+
with:
56+
activate-environment: matchms-test
57+
auto-activate-base: false
58+
auto-update-conda: true
59+
channels: conda-forge,bioconda,nlesc
60+
miniconda-version: 'latest'
61+
python-version: ${{ matrix.python-version }}
62+
- name: Show conda config
63+
shell: bash -l {0}
64+
run: |
65+
conda info
66+
conda list
67+
conda config --show-sources
68+
conda config --show
69+
- name: Install the conda package from anaconda repository
70+
shell: bash -l {0}
71+
run: |
72+
conda install conda build -c bioconda -c conda-forge -c nlesc matchms
73+
- name: Install development dependencies
74+
shell: bash -l {0}
75+
run: python -m pip install -r conda/requirements-dev.txt
76+
- name: Test the installed conda package
77+
shell: bash -l {0}
78+
run: |
79+
cd ${CONDA_PREFIX}/pkgs/matchms-*/site-packages/tests
80+
pytest --ignore-glob='test_version_string_consistency.py'

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.3.1] - 2020-05-19
11+
12+
### Added
13+
14+
- improve conda package https://github.com/matchms/matchms/pull/225
15+
- Build scripts for Windows and Unix(MacOS and Linux) systems
16+
- verify conda package after uploading to anaconda repository by installing it
17+
- conda package also includes `matchms/data` folder
18+
1019
### Changed
1120

1221
- conda package fixes [#223](https://github.com/matchms/matchms/pull/223)
@@ -20,6 +29,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2029
- skip builds for Python 2.X
2130
- more flexible package versions
2231
- add deployment requirements to meta.yml
32+
- verify conda package https://github.com/matchms/matchms/pull/225
33+
- use conda/environment.yml when building the package
34+
- split anaconda workflow https://github.com/matchms/matchms/pull/225
35+
- conda build: tests conda packages on every push and pull request
36+
- conda publish: publish and test conda package on release
37+
- update the developer instructions
38+
- move conda receipe to conda folder
2339

2440
## [0.3.0] - 2020-05-13
2541

README.rst

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Vector representation and similarity measure for mass spectrometry data.
2828
* - **Other best practices**
2929
-
3030
* - Continuous integration
31-
- |Python Build| |Anaconda Build and Publish|
31+
- |Python Build| |Anaconda Build| |Anaconda Publish|
3232
* - Documentation
3333
- |ReadTheDocs Badge|
3434
* - Code Quality
@@ -79,10 +79,13 @@ Vector representation and similarity measure for mass spectrometry data.
7979
:target: https://github.com/matchms/matchms/actions?query=workflow%3A%22Python%20Build%22
8080
:alt: Python Build
8181

82-
.. |Anaconda Build and Publish| image:: https://github.com/matchms/matchms/workflows/Anaconda%20Build%20and%20Publish/badge.svg
83-
:target: https://github.com/matchms/matchms/actions?query=workflow%3A%22Anaconda%20Build%20and%20Publish%22
84-
:alt: Anaconda Build and Publish
82+
.. |Anaconda Build| image:: https://github.com/matchms/matchms/workflows/Anaconda%20Build/badge.svg
83+
:target: https://github.com/matchms/matchms/actions?query=workflow%3A%22Anaconda%20Build%22
84+
:alt: Anaconda Build
8585

86+
.. |Anaconda Publish| image:: https://github.com/matchms/matchms/workflows/Anaconda%20Publish/badge.svg
87+
:target: https://github.com/matchms/matchms/actions?query=workflow%3A%22Anaconda%20Publish%22
88+
:alt: Anaconda Publish
8689

8790
***********************
8891
Documentation for users
@@ -175,17 +178,42 @@ To build anaconda package locally, do:
175178
conda deactivate
176179
conda env create --file conda/environment-build.yml
177180
conda activate matchms-build
178-
rm -rfv output;mkdir ./output
181+
BUILD_FOLDER=/tmp/matchms/_build
182+
rm -rfv $BUILD_FOLDER;mkdir -p $BUILD_FOLDER
179183
conda build --numpy 1.18.1 --no-include-recipe -c bioconda -c conda-forge \
180-
--croot /tmp/matchms/_build --output-folder ./output ./conda
184+
--croot $BUILD_FOLDER ./conda
185+
186+
The package will saved in ``/tmp/matchms/_build`` folder.
187+
188+
To install local anaconda package, do:
189+
190+
.. code-block:: console
191+
192+
conda install \
193+
--channel bioconda \
194+
--channel conda-forge \
195+
--channel file://${CONDA_PREFIX}/output/noarch/ \
196+
matchms
197+
198+
where ``$PATH_TO_TARBALL`` is the path to local conda package with ``tar.bz2`` extension.
199+
200+
To publish the package on anaconda cloud, do:
201+
202+
.. code-block:: console
203+
204+
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --user nlesc --force $BUILD_FOLDER/noarch/*.tar.bz2
205+
206+
where secrets.ANACONDA_TOKEN is a token to be gererated on anaconda cloud website. This secret should be added to repository.
207+
181208

182209
To remove matchms package:
183210

184211
.. code-block:: console
185212
186213
conda remove matchms
187214
188-
To remove environment:
215+
216+
To remove matchms-build environment:
189217

190218
.. code-block:: console
191219

conda/bld.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"%PYTHON%" -m pip install --no-deps --ignore-installed . -vv
2+
3+
mkdir %PREFIX%\site-packages\matchms\data
4+
copy matchms\data\* %PREFIX%\site-packages\matchms\data\
5+
6+
if errorlevel 1 exit 1

conda/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Show environment variables
4+
env
5+
6+
$PYTHON -m pip install --no-deps --ignore-installed . -vv
7+
8+
# Copy data folder
9+
mkdir -p $PREFIX/site-packages/matchms/data
10+
cp matchms/data/* $PREFIX/site-packages/matchms/data/

conda/conda_build_config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
numpy:
2+
- 1.18.4 # [unix]
3+
- 1.18.4 # [win]

conda/meta.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set name = "matchms" %}
2-
{% set version = "0.3.0" %}
2+
{% set version = "0.3.1" %}
33

44
package:
55
name: {{ name|lower }}
@@ -18,7 +18,6 @@ build:
1818
preserve_egg_dir: True
1919
number: 0
2020
skip: True # [py2k]
21-
script: {{PYTHON}} -m pip install --no-deps --ignore-installed . -vv
2221

2322
requirements:
2423
build:
@@ -59,8 +58,5 @@ about:
5958
dev_url: https://github.com/matchms/matchms
6059

6160
extra:
62-
deploy:
63-
- anaconda-client
64-
- setuptools >=0.39
6561
recipe-maintainers:
6662
- fdiblen

conda/run_tests.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
echo ${PREFIX}
4+
echo ${RECIPE_DIR}
5+
6+
pip install -r ${RECIPE_DIR}/conda/requirements-dev.txt
7+
8+
prospector -o grouped -o pylint:pylint-report.txt
9+
10+
isort --check-only --diff --conda-env matchms --recursive --wrap-length 79 --lines-after-imports 2 --force-single-line --no-lines-before FUTURE --no-lines-before STDLIB --no-lines-before THIRDPARTY --no-lines-before FIRSTPARTY --no-lines-before LOCALFOLDER matchms/ tests/ integration-tests/
11+
12+
cat readthedocs/_build/coverage/python.txt
13+
UNCOVERED_MEMBERS=$(grep '*' readthedocs/_build/coverage/python.txt | wc -l)
14+
UNCOVERED_MEMBERS_ALLOWED=25
15+
if (( $UNCOVERED_MEMBERS > $UNCOVERED_MEMBERS_ALLOWED )) ; then echo "There are currently ${UNCOVERED_MEMBERS} uncovered members in the documentation, which is more than the ${UNCOVERED_MEMBERS_ALLOWED} allowed."; exit 1;fi
16+
echo "The code is sufficiently documented with ${UNCOVERED_MEMBERS} uncovered members out of ${UNCOVERED_MEMBERS_ALLOWED} allowed.";
17+
18+
python setup.py test
19+
20+
pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml

0 commit comments

Comments
 (0)