Skip to content

test: Just tidy test definition ✅ #43

test: Just tidy test definition ✅

test: Just tidy test definition ✅ #43

Workflow file for this run

name: Python package
## Will run when commits pushed to master, or when PR opened for merging commits into master
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# cache: "poetry"
- name: Install poetry & Dependencies
run: pip install poetry && poetry install
- name: Run unit tests
run: poetry run python -m unittest discover -s tests
- name: Lint with flake8
run: poetry run flake8
release:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
## full history of commits on repo will be checked out. Needed to for tool to determine how to set package version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# cache: "poetry"
- name: Install dependencies
run: |
pip install poetry && \
poetry install
- name: Action | Semantic Version Release
id: semrelease
uses: go-semantic-release/action@v1
with:
hooks: exec
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Action | Check if no-release run
id: filecheck
run: |
if [ -f "no-release"]; then
echo "check_result=false" >> $GITHUB_OUTPUT
else
echo "check_result=true" >> $GITHUB_OUTPUT
fi
- name: Publish | Upload package to PyPI
if: steps.filecheck.outputs.check_result == 'true' # Only if this is not chore/ci/docs we do release
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}