Skip to content

Merge pull request #101 from eoyilmaz/93-increase-test-coverage #45

Merge pull request #101 from eoyilmaz/93-increase-test-coverage

Merge pull request #101 from eoyilmaz/93-increase-test-coverage #45

Workflow file for this run

name: Stalker Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, unlabeled]
branches:
- develop
push:
branches:
- develop
jobs:
build:
name: Python ${{ matrix.python-version }} & PostgreSQL ${{ matrix.postgresql-version }}
env:
PGPASSWORD: postgres
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
postgresql-version: ["14", "15", "16", "17"]
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
run: |
echo "py_version=$(echo ${{ matrix.python-version }} | tr -d .)" >> $GITHUB_ENV
if [ "${{ matrix.python-version }}" == "3.8" ]; then
echo "add_dir_str=${{ matrix.python-version }}" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.9" ]; then
echo "add_dir_str=${{ matrix.python-version }}" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.10" ]; then
echo "add_dir_str=cpython-310" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.11" ]; then
echo "add_dir_str=cpython-311" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.12" ]; then
echo "add_dir_str=cpython-312" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.13" ]; then
echo "add_dir_str=cpython-313" >> $GITHUB_ENV
fi
- name: Setup PostgreSQL for Linux/macOS/Windows
uses: ikalnytskyi/action-setup-postgres@v7
with:
# The username of the user to setup.
username: postgres
# The password of the user to setup.
password: postgres
# The database name to setup and grant permissions to created user.
database: postgres
# The server port to listen on.
port: 5432
# The PostgreSQL major version to install. Either "14", "15", "16" or "17".
postgres-version: ${{ matrix.postgresql-version }}
# When "true", encrypt connections using SSL (TLS).
ssl: false
- name: Set up TaskJuggler
run: |
sudo gem install taskjuggler
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
sudo apt-get install -y $(grep -o ^[^#][[:alnum:]-]*.* "packages.list")
python3 -m pip install --upgrade pip
pip install wheel
- name: Install Python dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
- name: Build Stalker
run: |
python3 -m build
ls -l dist/
wheel_file=$(ls dist/stalker-*.whl)
pip install $wheel_file
- name: Test with pytest
run: |
PYTHONPATH=src python -m pytest
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-py${{ env.py_version }}-psql${{ matrix.postgresql-version }}
path: htmlcov
retention-days: 10
# windows:
# name: Test with Python ${{ matrix.python-version }} on Windows
# runs-on: windows-latest
# strategy:
# fail-fast: false
# matrix:
# python-version:
# - "3.8"
# - "3.9"
# - "3.10"
# - "3.11"
# steps:
# - uses: actions/checkout@v4
# - name: Set Environment Variables
# run: |
# $py_version = "${{ matrix.python-version }}" -replace '\.', ''
# echo "py_version=$py_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# if ("${{ matrix.python-version }}" -eq "3.8") {
# echo "add_dir_str=${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# } elseif ("${{ matrix.python-version }}" -eq "3.9") {
# echo "add_dir_str=${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# } elseif ("${{ matrix.python-version }}" -eq "3.10") {
# echo "add_dir_str=cpython-310" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# } elseif ("${{ matrix.python-version }}" -eq "3.11") {
# echo "add_dir_str=cpython-311" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# } elseif ("${{ matrix.python-version }}" -eq "3.12") {
# echo "add_dir_str=cpython-312" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# }
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# - name: Update pip
# run: |
# python -m pip install --upgrade pip
# pip install wheel
# - name: Install Python dependencies
# run: |
# pip install -r requirements-tests.txt -r requirements-dev.txt
# - name: Test with pytest
# run: |
# python -m pytest --verbose -n auto -W ignore --color=yes --cov=. --cov-report html
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report-${{ env.py_version }}-windows
# path: htmlcov
# retention-days: 10