Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate manylinux wheels #13

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb3ae38
Merge pull request #4 from DanShort12/serialise_plasma_source
DanShort12 Sep 24, 2020
f6059de
Use cibuildwheel to create wheels
DanShort12 Sep 24, 2020
3fd24bf
Work in manylinux container
DanShort12 Sep 24, 2020
f1381ba
No sudo as we're in a container
DanShort12 Sep 24, 2020
9f5d9e4
Use yum rather than apt
DanShort12 Sep 24, 2020
00ec010
Use yum package names
DanShort12 Sep 24, 2020
4972b86
Use cmake3
DanShort12 Sep 24, 2020
b7ceb2e
Register cmake3 as alternative for cmake
DanShort12 Sep 24, 2020
b404fd3
Run pip as a python module
DanShort12 Sep 24, 2020
a4c46d8
Use manylinux installed python
DanShort12 Sep 24, 2020
494abf5
Install auditwheel and repair
DanShort12 Sep 24, 2020
90a2b40
Test to determine which python is used for test
DanShort12 Sep 24, 2020
d83d4cd
Use correct python version for tests
DanShort12 Sep 25, 2020
037f1b1
Run tests from within tests directory
DanShort12 Sep 25, 2020
c3e9ebe
Support Python 3.9
DanShort12 Sep 25, 2020
1883ec6
Publish wheel to test PyPI
DanShort12 Sep 25, 2020
c54d596
Fix indentation
DanShort12 Sep 25, 2020
6e66b52
Don't upload to TestPyPI for now
DanShort12 Sep 25, 2020
8144f77
Generate version from git tags and commits
DanShort12 Sep 28, 2020
7e499ad
Refactor actions and include publish to PyPI
DanShort12 Sep 28, 2020
9b2ecf2
Fix yaml syntax error
DanShort12 Sep 28, 2020
319d361
Add missing steps identifier
DanShort12 Sep 28, 2020
ada610a
Add missing run identifier
DanShort12 Sep 28, 2020
a8109aa
Action not finding artifact after download
DanShort12 Sep 28, 2020
4feb6f3
GitHub doesn't have 3.9 installed
DanShort12 Sep 28, 2020
b943a17
Add some log messages when creating version
DanShort12 Sep 28, 2020
a76d50c
Get full repo history so we know number of commits
DanShort12 Sep 28, 2020
5169061
Use post as the version extension
DanShort12 Sep 28, 2020
f01ed23
Verbose twine output
DanShort12 Sep 28, 2020
eb070b6
Run workflow when a release is created
DanShort12 Sep 30, 2020
952ff27
Don't reinstall twine
DanShort12 Sep 30, 2020
acaff6e
Check TestPyPI and PyPI versions
DanShort12 Sep 30, 2020
8a21eb9
Use same account for PyPI and TestPyPI
DanShort12 Sep 30, 2020
e866b3e
trigger GitHub actions
DanShort12 Sep 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 70 additions & 12 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,97 @@ on:
branches: [ master ]

jobs:
build_and_test:
build:

runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
fetch-depth: 0 # Get the repo history so we can version by number of commits
- name: Install OpenMC
run: |
sudo apt-get install -y g++ cmake libhdf5-dev
yum install -y gcc-c++ cmake3 hdf5-devel
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
--family cmake
git clone --recurse-submodules https://github.com/openmc-dev/openmc.git
cd openmc
git checkout
mkdir build && cd build
cmake ..
make
sudo make install
- name: Install plasma source
make install
- name: Build plasma source
run: |
pip install -r requirements-develop.txt
export PYVER=${{ matrix.python-version }}
alias python=$(ls -d /opt/python/* | grep ${PYVER//.})/bin/python
python -m pip install -r requirements-develop.txt
python -m pip install auditwheel
python setup.py bdist_wheel
python -m pip install --verbose dist/*.whl
- name: Run tests
run: |
pytest tests
python -m auditwheel show dist/*.whl
python -m auditwheel repair dist/*.whl
- name: Upload wheel artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: wheelhouse

test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Install plasma source
run: |
python -m pip install --no-index --find-links=file:dist parametric-plasma-source
- name: Run tests
run: |
python -m pip install -r requirements-develop.txt
cd tests
python -m pytest

publish:
runs-on: ubuntu-latest
needs: test

steps:
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish wheel artifact to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python3 -m pip install twine
python3 -m twine upload --repository testpypi dist/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add this, just to provide more info should it ever break

Suggested change
python3 -m twine upload --repository testpypi dist/*
python3 -m twine upload --repository testpypi dist/* --verbose

- name: Release wheel artifact to PyPI
if: startsWith(github.ref, 'refs/tags')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install twine
python3 -m twine upload dist/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add this, just to provide more info should it ever break

Suggested change
python3 -m twine upload dist/*
python3 -m twine upload dist/* --verbose

25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,35 @@ def build_extension(self, ext):
)


def get_version(release_override="0.0.1"):
cwd = os.path.dirname(os.path.realpath(__file__))
version = subprocess.check_output(
["git", "describe", "--always", "--tags"], stderr=None, cwd=cwd
).strip().decode("utf-8")
if "." not in version:
# Git doesn't know about a tag yet, so manually set a version and get the total
# number of commits
num_commits = subprocess.check_output(
["git", "rev-list", "--count", "HEAD"], stderr=None, cwd=cwd
).strip().decode("utf-8")
version = release_override + ".post" + num_commits
else:
if "-" in version:
# This commit doesn't correspond to an annotated tag, so mark it as post and
# get the number of commits since the last annotated tag
version_split = version.split("-")
tag_version = version_split[0]
num_commits = version_split[1]
version = tag_version + ".post" + num_commits
return version


with open("README.md", "r") as fh:
long_description = fh.read()

setup(
name="parametric_plasma_source",
version="0.0.6",
version=get_version("0.0.6"),
author="Andrew Davis",
author_email="[email protected]",
description="Parametric plasma source for fusion simulations in OpenMC",
Expand Down