name: PLBA package CI on: push: branches: - main pull_request: types: [opened, synchronize, reopened] jobs: tests: name: Python tests runs-on: cloud-build steps: - name: Check out repository env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY: ${{ gitea.repository }} GITEA_REF: ${{ gitea.ref }} run: | set -eu repository_url="${GITEA_SERVER_URL%/}/${GITEA_REPOSITORY}.git" git init . git remote add origin "$repository_url" git fetch --no-tags --depth=1 origin "$GITEA_REF" git checkout --detach FETCH_HEAD - name: Check Python version run: | python3 - <<'PY' import sys print(f"Using Python {sys.version.split()[0]}") if sys.version_info < (3, 11): raise SystemExit("PLBA v2 CI requires Python 3.11 or newer") PY - name: Install package and test dependencies run: | python3 -m venv .venv .venv/bin/python -m pip install -e ".[test]" - name: Run tests run: .venv/bin/python -m pytest package-version: name: Package version increment if: ${{ gitea.event_name == 'pull_request' }} runs-on: cloud-build steps: - name: Check out repository and target branch history env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY: ${{ gitea.repository }} GITEA_REF: ${{ gitea.ref }} BASE_REF: ${{ gitea.base_ref }} run: | set -eu test -n "$BASE_REF" repository_url="${GITEA_SERVER_URL%/}/${GITEA_REPOSITORY}.git" git init . git remote add origin "$repository_url" git fetch --no-tags --depth=1 origin "$GITEA_REF" git checkout --detach FETCH_HEAD git fetch --no-tags --depth=1 origin "refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}" - name: Check package version increment env: BASE_REF: ${{ gitea.base_ref }} run: | test -n "$BASE_REF" python3 scripts/check_package_version.py --base-ref "origin/${BASE_REF}"