Skip to content

tests: verify EAPI params for dependency type package creation #1118

tests: verify EAPI params for dependency type package creation

tests: verify EAPI params for dependency type package creation #1118

Workflow file for this run

name: ci
on:
push:
branches-ignore: [release]
paths:
- "src/**"
- "testdata/**"
- "tests/**"
- "pyproject.toml"
- "setup.py"
- "tox.ini"
- ".github/workflows/ci.yml"
pull_request:
branches: [main]
paths:
- "src/**"
- "testdata/**"
- "tests/**"
- "pyproject.toml"
- "setup.py"
workflow_dispatch:
inputs:
python-version:
required: false
type: string
workflow_call:
inputs:
python-version:
required: false
type: string
event-type:
required: true
type: string
jobs:
setup:
runs-on: ubuntu-latest
outputs:
python-version: ${{ steps.vars.outputs.python-version }}
steps:
- name: Checkout code to determine the minimum supported python version
if: ${{ inputs.python-version == '' }}
uses: actions/checkout@v4
with:
repository: pkgcraft/pkgcraft-python
- name: Set python versions to test against
id: vars
run: |
if [[ -n "${{ inputs.python-version }}" ]]; then
echo "python-version=$(jq 'split(",")' -Rc <(echo '${{ inputs.python-version }}'))" >> $GITHUB_OUTPUT
else
# pull minimum supported python version from pyproject.toml
min_ver=$(sed -rn '/^requires-python\s*=/ s/^.*=\s*">=([0-9]\.[0-9]+).*/\1/p' pyproject.toml)
echo "python-version=['${min_ver}', '3.x']" >> $GITHUB_OUTPUT
fi
test:
needs: setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ${{ fromJson(needs.setup.outputs.python-version) }}
steps:
- name: Set pkgcraft dir env var
run: echo pkgcraft_dir=~/pkgcraft >> $GITHUB_ENV
- name: Download pkgcraft-c library from most recent run
if: ${{ inputs.event-type == '' }}
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{ secrets.PKGCRAFT_CI_TOKEN }}
repo: pkgcraft/pkgcraft
branch: main
workflow: pkgcraft-c.yml
workflow_conclusion: ""
search_artifacts: true
name: pkgcraft-c-${{ runner.os }}
path: ${{ env.pkgcraft_dir }}
- name: Download pkgcraft-c library from running workflow
if: ${{ inputs.event-type != '' }}
uses: actions/download-artifact@v4
with:
name: pkgcraft-c-${{ runner.os }}
path: ${{ env.pkgcraft_dir }}
- name: Checkout code
uses: actions/checkout@v4
with:
repository: pkgcraft/pkgcraft-python
# checkout full history for setuptools-scm
fetch-depth: 0
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install dependencies
run: pip install tox
- name: Override build variables
run: |
echo "PKG_CONFIG_PATH=${pkgcraft_dir}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV
- name: Run tests
run: tox -c tox.ini -e coverage
- name: Upload build artifacts
if: ${{ inputs.event-type == '' && matrix.python-version == '3.x' }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml
if-no-files-found: error
coverage:
if: ${{ inputs.event-type == '' && github.ref_name == 'main' }}
needs: test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/coverage.xml
fail_ci_if_error: true