Skip to content

Fix indent

Fix indent #6

name: Compatibility Matrix
on:
push:
branches:
- github-ci
jobs:
CompatibilityMatrix:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12, 3.x]
env:
MUST_RUN_VERSION: "3.12"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Get Python version
id: python_version
run: |
python --version
- name: Check if Python versions match
id: check_version
run: |
if [[ "${{ matrix.python-version }}" == "3.x" ]]; then
PYTHON_VERSION=$(python --version | grep -oP '(?<=Python\s)[\d.]+')
if [[ "$PYTHON_VERSION" == "${{ env.MUST_RUN_VERSION }}."* ]]; then
echo "skip-job=true" >> $GITHUB_ENV
fi
fi
- name: Install dependencies
if: env.skip-job != 'true'
run: |
pip install poetry
poetry install --with dev
- name: Run the major version update check script
if: env.skip-job != 'true'
run: |
# Get outdated dependencies with Poetry, excluding dev dependencies
outdated=$(poetry show --outdated --only main)
# Loop through each outdated dependency and check the versions
echo "$outdated" | while read -r line; do
# Check if the line contains version information
if [[ $line =~ ^[a-zA-Z0-9_-]+\s+[0-9]+\.[0-9]+\.[0-9]+\s+->\s+[0-9]+\.[0-9]+\.[0-9]+ ]]; then
# Extract the package name, current version, and latest version
package_name=$(echo $line | awk '{print $1}')
current_version=$(echo $line | awk '{print $2}')
latest_version=$(echo $line | awk '{print $4}')
# Compare major versions
current_major=$(echo $current_version | cut -d '.' -f 1)
latest_major=$(echo $latest_version | cut -d '.' -f 1)
if [ "$current_major" -lt "$latest_major" ]; then
echo "$package_name: $current_version -> $latest_version (Major version update available)"
fi
fi
done
- name: Update dependencies to the latest allowed versions
if: env.skip-job != 'true'
run: |
poetry update
echo "Dependencies updated"
- name: Run tests
if: env.skip-job != 'true'
run: |
poetry run pytest
continue-on-error: false