Skip to content

package-verification is updated (build-check) (#354) #76

package-verification is updated (build-check) (#354)

package-verification is updated (build-check) (#354) #76

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Run Package Verifications
on:
push:
branches: [ "master" ]
paths-ignore:
- "*.md"
pull_request:
branches: [ "master" ]
paths-ignore:
- "*.md"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 flake8-pyproject ruff
- name: Lint with flake8
run: |
flake8 .
- name: Lint with ruff
run: |
ruff check .
build-check:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build package
run: |
python -m build
- name: Check package metadata
run: |
twine check dist/*
test:
runs-on: ubuntu-latest
needs: build-check
strategy:
fail-fast: false
matrix:
include:
- platform: "std2-all"
python: "3.7"
postgres: "17"
- platform: "std2-all"
python: "3.8.0"
postgres: "17"
- platform: "std2-all"
python: "3.8"
postgres: "17"
- platform: "std2-all"
python: "3.9"
postgres: "17"
- platform: "std2-all"
python: "3.10"
postgres: "17"
- platform: "std2-all"
python: "3.11"
postgres: "17"
- platform: "std2-all"
python: "3.12"
postgres: "17"
- platform: "std2-all"
python: "3.13"
postgres: "17"
- platform: "std2-all"
python: "3.14"
postgres: "17"
- platform: "std"
python: "3"
postgres: "10"
- platform: "std"
python: "3"
postgres: "11"
- platform: "std"
python: "3"
postgres: "12"
- platform: "std"
python: "3"
postgres: "13"
- platform: "std"
python: "3"
postgres: "14"
- platform: "std"
python: "3"
postgres: "15"
- platform: "std"
python: "3"
postgres: "16"
- platform: "std-all"
python: "3"
postgres: "17"
- platform: "std-all"
python: "3"
postgres: "18"
- platform: "ubuntu_24_04"
python: "3"
postgres: "17"
- platform: "altlinux_10"
python: "3"
postgres: "17"
- platform: "altlinux_11"
python: "3"
postgres: "17"
- platform: "astralinux_1_7"
python: "3"
postgres: "17"
env:
BASE_SIGN: "${{ matrix.platform }}-py${{ matrix.python }}-pg${{ matrix.postgres }}"
steps:
- name: Prepare variables
run: |
echo "RUN_CFG__NOW=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
echo "RUN_CFG__LOGS_DIR=logs-${{ env.BASE_SIGN }}" >> $GITHUB_ENV
echo "RUN_CFG__DOCKER_IMAGE_NAME=tests-${{ env.BASE_SIGN }}" >> $GITHUB_ENV
echo "---------- [$GITHUB_ENV]"
cat $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
- name: Prepare logs folder on the host
run: mkdir -p "${{ env.RUN_CFG__LOGS_DIR }}"
- name: Adjust logs folder permission
run: chmod -R 777 "${{ env.RUN_CFG__LOGS_DIR }}"
- name: Build local image ${{ matrix.alpine }}
run: docker build --build-arg PG_VERSION="${{ matrix.postgres }}" --build-arg PYTHON_VERSION="${{ matrix.python }}" -t "${{ env.RUN_CFG__DOCKER_IMAGE_NAME }}" -f Dockerfile--${{ matrix.platform }}.tmpl .
- name: Run
run: docker run $(bash <(curl -s https://codecov.io/env)) -t -v ${{ github.workspace }}/${{ env.RUN_CFG__LOGS_DIR }}:/home/test/testgres/logs "${{ env.RUN_CFG__DOCKER_IMAGE_NAME }}"
- name: Upload Logs
uses: actions/upload-artifact@v7
if: always() # IT IS IMPORTANT!
with:
name: testgres--test_logs--${{ env.RUN_CFG__NOW }}-${{ env.BASE_SIGN }}-id${{ github.run_id }}
path: "${{ env.RUN_CFG__LOGS_DIR }}/"