Skip to content

First PR

First PR #10

---
#
# .github/workflows/python-dependency-update.yaml
#
# yamllint disable rule:line-length
name: python-dependency-update
on: # yamllint disable-line rule:truthy
push:
branches:
- main
- develop
pull_request:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '15 8 * * 4'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
strategy:
matrix:
python-version: ["3.12"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
exclude:
- os: "macos-latest"
python-version: "3.12"
- os: "windows-latest"
python-version: "3.12"
runs-on: "${{ matrix.os }}"
env:
PYTHONPATH: "src"
steps:
- name: Checkout Repo (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: checkout-repo
uses: actions/checkout@v4
- name: Set up Python (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Env (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: setup-env
run: |
[[ -d ./src ]] && PY_SRC_DIR="src"
if [[ -d ./tests ]]; then
PY_TEST_DIR="tests"
else
PY_TEST_DIR="src/tests"
fi
printf "%s=%s\n" "PY_SRC_DIR" "${PY_SRC_DIR}" | tee -a "${GITHUB_ENV}"
printf "%s=%s\n" "PY_TEST_DIR" "${PY_TEST_DIR}" | tee -a "${GITHUB_ENV}"
- name: Update pip (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: update-pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Update PDM (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: update-pdm
run: |
pip install --upgrade pdm
pdm --version
- name: Check file existence - pdm.lock (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: check_file_pdm_lock
uses: andstor/file-existence-action@v1
with:
files: "pdm.lock"
- name: Setup PDM (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: setup-pdm
run: |
python --version
pdm use "$(which python)"
pdm sync
- name: Analyzing the code using safety (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: safety-check
continue-on-error: true
run: |
{
printf "### Security Scan\n\n"
printf '```\n'
pdm run safety check --full-report
printf '```\n'
printf "\n"
} >> "${GITHUB_STEP_SUMMARY}"
- name: Check for outdated dependencies (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: outdated-check
continue-on-error: true
run: |
{
printf "### Outdated Dependencies\n\n"
printf '```\n'
pdm outdated
printf '```\n'
printf "\n"
} >> "${GITHUB_STEP_SUMMARY}"
- name: Check for outdated dependencies (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: update-deps
continue-on-error: true
run: |
pdm update
- name: Testing with pytest (os:${{ matrix.os }} python:${{ matrix.python-version }})
id: pytest
run: |-
{
printf "### PyTest with Coverage\n\n"
printf '```\n'
pdm run pytest --verbose --cov-report term --cov=src --cov-branch --cov-report=term-missing --cov-report=xml:.coverage.xml
printf '```\n'
printf "\n"
} >> "${GITHUB_STEP_SUMMARY}"