Release CI/CD #5
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: Release CI/CD # workflow name | |
on: # trigger | |
release: | |
branches: [main] | |
types: | |
- created | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Sources: | |
# https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml | |
# https://cibuildwheel.readthedocs.io/en/stable/options/ | |
# # Windows | |
# - os: windows-2019 | |
# arch: AMD64 | |
# - os: windows-2019 | |
# arch: x86 | |
# # MacOS | |
# - os: macos-11 | |
# arch: x86_64 | |
# - os: macos-11 | |
# arch: arm64 | |
# - os: macos-11 | |
# arch: universal2 | |
# Linux | |
- os: ubuntu-20.04 | |
arch: x86_64 | |
# - os: ubuntu-20.04 | |
# arch: i686 | |
# - os: ubuntu-20.04 # raspberry pi | |
# arch: aarch64 | |
# - os: ubuntu-20.04 | |
# arch: ppc64le | |
# - os: ubuntu-20.04 | |
# arch: s390x | |
steps: | |
- name: Set Github Workspace | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.10 # set architecture and Python3 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Build | |
shell: bash | |
run: | | |
pip install -e '.[dev]' | |
- name: Build wheels | |
shell: bash | |
run: pip wheel -w wheelhouse . | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/sealwatch*.whl | |
make_sdist: | |
name: Make source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm | |
submodules: true # Optional, use if you have submodules | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
unit_tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest # runner | |
needs: [build_wheels, make_sdist] | |
steps: # tasks | |
- name: Set Github Workspace # access Github Workspace | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.10 # set architecture and Python3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
architecture: "x64" # architecture | |
- name: Downloads artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Install wheel | |
run: | | |
pip install jpeglib numpy scipy parameterized h5py pillow conseal | |
pip install --find-links ./dist sealwatch --no-index | |
- name: Run unittests | |
shell: bash | |
run: | | |
python -m unittest | |
- name: Print log | |
shell: bash | |
if: always() | |
run: | | |
if [ -f test.log ]; then cat test.log; fi | |
upload_to_pypi: | |
name: Upload to PyPi | |
needs: [build_wheels, make_sdist, unit_tests] | |
runs-on: ubuntu-latest | |
# if: ${{github.event_name == 'release' && github.event.action == 'created'}} | |
steps: | |
- name: Downloads artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@v1.4.1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
verbose: true |