Skip to content

1.2.1

1.2.1 #14

Workflow file for this run

name: Build Python Package
on:
release:
types: [ published ]
jobs:
release-package:
runs-on: ubuntu-latest
steps:
# 1. Initialize the build
# -------------------------------------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v4
# Without this option, we don't get the tag information
with:
fetch-depth: 0
- name: Initialise the build system
run: |
chmod u+x $GITHUB_WORKSPACE/build/bin/*.sh
$GITHUB_WORKSPACE/build/bin/initbuild.sh
source $GITHUB_WORKSPACE/build/bin/.functions.sh
# 2. Python Package Build
# -------------------------------------------------------------------------------------------
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build the Python package
run: |
sed -i "s#__version__ = \"100.0.0\"#__version__ = \"${{ env.VERSION_NOPREREL }}\"#g" ${GITHUB_WORKSPACE}/src/mas/devops/__init__.py
cat ${GITHUB_WORKSPACE}/src/mas/devops/__init__.py
python -m pip install --upgrade pip
pip install .[dev]
# There are no tests yet
# pytest
# 3. Flake8 Linting
# -------------------------------------------------------------------------------------------
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=200 --statistics
# 4. Publish to PyPi
# -------------------------------------------------------------------------------------------
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}