Skip to content

chore(deps): Update dependency prospector to v1 Automatically created by mend renovate bot. #540

chore(deps): Update dependency prospector to v1 Automatically created by mend renovate bot.

chore(deps): Update dependency prospector to v1 Automatically created by mend renovate bot. #540

Workflow file for this run

---
name: PullRequest validation
on:
pull_request:
branches:
- main
- staging
- development
jobs:
set-versions:
name: Get versions from .python-version
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.versions }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Read repo root .python-version file
id: versions
shell: bash
run: |
export versions="["
for version in $(cat ./.python-version);
do
IFS='.' read -r major minor patch <<< "${version}"
export vstring="${major}.${minor}"
export vstring=$(echo "\""${vstring}"\"")
export versions="${versions} ${vstring} ,"
export vstring=
done
export versions=$(echo "${versions}" | awk '{ print substr( $0, 1, length($0)-1 ) }')
export versions="${versions}]"
echo "versions=${versions}" >> "$GITHUB_OUTPUT"
build:
name: Perform build
runs-on: ubuntu-latest
needs: set-versions
strategy:
matrix:
python-version: ${{ fromJSON(needs.set-versions.outputs.versions) }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set PDM version
id: setpdmversion
shell: bash
run: |
echo "pdm_version=$(./.github/workflow_scripts/get-pdm-version-from-lock.awk pdm.lock)" >> $GITHUB_OUTPUT
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: ${{ steps.setpdmversion.outputs.pdm_version }}
prerelease: true
enable-pep582: true
allow-python-prereleases: false
- name: Install production dependencies
run: pdm install --prod
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
- name: Build wheel
run: pdm build
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
test:
name: Run unit tests
runs-on: ubuntu-latest
needs: set-versions
strategy:
matrix:
python-version: ${{ fromJSON(needs.set-versions.outputs.versions) }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set PDM version
id: setpdmversion
shell: bash
run: |
echo "pdm_version=$(./.github/workflow_scripts/get-pdm-version-from-lock.awk pdm.lock)" >> $GITHUB_OUTPUT
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: ${{ steps.setpdmversion.outputs.pdm_version }}
prerelease: true
enable-pep582: true
allow-python-prereleases: false
- name: Install development dependencies
run: pdm install --dev
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
- name: Run unit tests
run: pdm run pytest
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
lint:
name: Run linters / Code style checks
runs-on: ubuntu-latest
needs: set-versions
strategy:
matrix:
python-version: ${{ fromJSON(needs.set-versions.outputs.versions) }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set PDM version
id: setpdmversion
shell: bash
run: |
echo "pdm_version=$(./.github/workflow_scripts/get-pdm-version-from-lock.awk pdm.lock)" >> $GITHUB_OUTPUT
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: ${{ steps.setpdmversion.outputs.pdm_version }}
prerelease: true
enable-pep582: true
allow-python-prereleases: false
- name: Install development dependencies
run: pdm install --dev
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
- name: Run linters
run: pdm check-style
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
format:
name: Run code formatting
runs-on: ubuntu-latest
needs: set-versions
strategy:
matrix:
python-version: ${{ fromJSON(needs.set-versions.outputs.versions) }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set PDM version
id: setpdmversion
shell: bash
run: |
echo "pdm_version=$(./.github/workflow_scripts/get-pdm-version-from-lock.awk pdm.lock)" >> $GITHUB_OUTPUT
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: ${{ steps.setpdmversion.outputs.pdm_version }}
prerelease: true
enable-pep582: true
allow-python-prereleases: false
- name: Install development dependencies
run: pdm install --dev
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
- name: Run linters
run: pdm format
shell: bash
env:
PDM_PYTHON_VERSION: ${{ matrix.python-version }}
- name: Check for changed files
shell: bash
run: |
export no_changed_files=$(git status --porcelain | grep '.py' | wc -l)
if [ "${no_changed_files}" != "0" ];
then
echo "There are changed files:" >&2
git status --porcelain >&2
exit 1
fi
exit 0
commit-lint:
name: Lint git commit messages
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch entire history
- name: Get oldest python version
id: setpyversion
shell: bash
run: |
export PY_VERSION=$(cat .python-version | sort -V | head -1)
IFS=. read -r major minor patch <<< ${PY_VERSION}
echo "python_version=${major}.${minor}" >> "${GITHUB_OUTPUT}"
- name: Set PDM version
id: setpdmversion
shell: bash
run: |
echo "pdm_version=$(./.github/workflow_scripts/get-pdm-version-from-lock.awk pdm.lock)" >> $GITHUB_OUTPUT
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.setpyversion.outputs.python_version }}
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ steps.setpyversion.outputs.python_version }}
architecture: x64
version: ${{ steps.setpdmversion.outputs.pdm_version }}
prerelease: true
enable-pep582: true
allow-python-prereleases: false
- name: Install development dependencies
run: pdm install --dev
shell: bash
env:
PDM_PYTHON_VERSION: ${{ steps.setpyversion.outputs.python_version }}
- name: Run and check for issues
shell: bash
run: |
git fetch origin ${{ github.base_ref }}:target
git fetch origin ${{ github.head_ref }}:source
issues=$(pdm run gitlint --commits "target..source" lint)
issue_count=$(echo -n "$issues" | wc -l)
if [ $issue_count -gt 0 ];
then
echo "There are issues with the commits:" >&2
echo "$issues" >&2
exit 1
fi