Skip to content

Commit

Permalink
Build package for Python 3.7 and Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wvxvw committed Jun 27, 2021
1 parent 0ee0ca0 commit 5672185
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,25 @@ jobs:
branch: gh-pages
folder: build/sphinx/html

CondaBuild:
CondaBuild3_7:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
- run: python3.7 -m venv .venv
- run: .venv/bin/python setup.py genconda
- run: conda install conda-build
- run: conda build -c conda-forge ./conda-pkg/

CondaBuild3_8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,32 @@ jobs:
with:
conda-channels: conda-forge
- run: conda install conda-build anaconda-client conda-verify
- run: .venv/bin/python setup.py genconda
- run: .venv/bin/python setup.py genconda -t 3.7
- run: conda build -c conda-forge --output-folder ./dist ./conda-pkg/
- run: conda convert -p osx-64 -o ./dist ./dist/linux-64/*py37_0.tar.bz2
- run: conda convert -p win-64 -o ./dist ./dist/linux-64/*py37_0.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/linux-64/*py37_0.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/osx-64/*py37_0.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/win-64/*py37_0.tar.bz2
- run: .venv/bin/python setup.py genconda -t 3.8
- run: conda build -c conda-forge --output-folder ./dist ./conda-pkg/
- run: conda convert -p osx-64 -o ./dist ./dist/linux-64/*.tar.bz2
- run: conda convert -p win-64 -o ./dist ./dist/linux-64/*.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/linux-64/*.tar.bz2
anaconda upload --label main ./dist/linux-64/*py38_0.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/osx-64/*.tar.bz2
anaconda upload --label main ./dist/osx-64/*py38_0.tar.bz2
- run: >
ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --label main ./dist/win-64/*.tar.bz2
anaconda upload --label main ./dist/win-64/*py38_0.tar.bz2
- uses: marvinpinto/action-automatic-releases@latest
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ test/target/
*~
/source/cleanX.rst
/source/modules.rst
/conda-pkg/meta.yaml
4 changes: 2 additions & 2 deletions conda-pkg/meta.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ source:

requirements:
build:
- python
- python==${python_version}
- setuptools
- sphinx

run:
- python
- python==${python_version}
- numpy
- pandas
- matplotlib
Expand Down
18 changes: 14 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

import sys
import shlex
import os
Expand All @@ -22,10 +24,10 @@
readme = f.read()

name = 'cleanX'

try:
tag = subprocess.check_output([
'git',
'--no-pager',
'describe',
'--abbrev=0',
'--tags',
Expand Down Expand Up @@ -99,13 +101,20 @@ def run(self):

class GenerateCondaYaml(Command):

user_options = []
user_options = [(
'target-python=',
't',
'Python version to build the package for',
)]

def initialize_options(self):
pass
self.target_python = None

def finalize_options(self):
pass
if self.target_python is None:
maj, min, patch = sys.version.split(maxsplit=1)[0].split('.')

self.target_python = '{}.{}'.format(maj, min)

def run(self):
from string import Template
Expand All @@ -120,6 +129,7 @@ def run(self):
f.write(tpl.substitute(
version=version,
tag=tag,
python_version=self.target_python,
))


Expand Down

0 comments on commit 5672185

Please sign in to comment.