Merge pull request #35 from mrphys/release/v0.22.0 #147
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build package | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/mrphys/tensorflow-manylinux:1.14.0 | |
strategy: | |
matrix: | |
py_version: ["3.7", "3.8", "3.9", "3.10"] | |
env: | |
PYTHON: python${{ matrix.py_version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- name: Lint code | |
run: | | |
make lint PY_VERSION=${{ matrix.py_version }} | |
- name: Compile shared library | |
run: | | |
make PY_VERSION=${{ matrix.py_version }} CXX=/dt9/usr/bin/g++ | |
- name: Install required packages | |
run: | | |
$PYTHON -m pip install -r requirements.txt | |
- name: Run test suite | |
run: | | |
make test PY_VERSION=${{ matrix.py_version }} | |
- name: Build wheel | |
run: | | |
make wheel PY_VERSION=${{ matrix.py_version }} | |
- name: Build docs | |
run: | | |
make docs PY_VERSION=${{ matrix.py_version }} | |
- name: Upload wheel | |
if: startsWith(github.ref, 'refs/tags') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wheels | |
path: ./artifacts/*.whl | |
- name: Upload docs | |
if: startsWith(github.ref, 'refs/tags') && matrix.py_version == 3.9 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docs | |
path: ./tools/docs/_build/dirhtml | |
- name: Publish to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
packages_dir: artifacts/ | |
skip_existing: true | |
release: | |
name: Release | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout docs branch | |
uses: actions/checkout@v2 | |
with: | |
ref: docs | |
- name: Clean docs branch | |
run: | | |
rm -rf ./* | |
- name: Download docs | |
uses: actions/download-artifact@v2 | |
with: | |
name: docs | |
- name: Publish docs to GitHub Pages | |
run: | | |
git config --global user.name mrphys | |
git config --global user.email [email protected] | |
git add -A | |
git commit -m "Update docs [bot]" || echo "No changes to commit." | |
git push --force | |
- name: Checkout master | |
uses: actions/checkout@v2 | |
- name: Get release tag | |
run: | | |
echo "release=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Create a release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: TensorFlow MRI ${{ env.release }} | |
body_path: RELEASE.rst | |
prerelease: ${{ contains(env.release, 'a') || contains(env.release, 'b') || contains(env.release, 'rc') }} | |
fail_on_unmatched_files: true | |
- name: Download wheels | |
uses: actions/download-artifact@v2 | |
with: | |
name: wheels | |
path: artifacts/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: artifacts/ |