diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8e1eab5..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,236 +0,0 @@ -version: 2.1 - -executors: - python: - parameters: - pyversion: - type: string - pgversion: - type: string - default: "16.0" - debiandist: - type: string - default: "bullseye" - docker: - - image: python:<< parameters.pyversion >>-<< parameters.debiandist >> - - image: postgres:<< parameters.pgversion >> - environment: - POSTGRES_DB: 'psqlextra' - POSTGRES_USER: 'psqlextra' - POSTGRES_PASSWORD: 'psqlextra' - -commands: - install-dependencies: - parameters: - extra: - type: string - - steps: - - run: - name: Install packages - command: apt-get update && apt-get install -y --no-install-recommends postgresql-client libpq-dev build-essential git - - - run: - name: Install Python packages - command: pip install --progress-bar off '.[<< parameters.extra >>]' - - run-tests: - parameters: - pyversion: - type: integer - - steps: - - run: - name: Run tests - command: tox --listenvs | grep ^py<< parameters.pyversion >> | circleci tests split | xargs -n 1 tox -e - environment: - DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra' - DATABASE_IN_CONTAINER: 'true' - TOX_TESTENV_PASSENV: 'DATABASE_URL DATABASE_IN_CONTAINER' - -jobs: - test-python37: - executor: - name: python - pyversion: "3.7" - pgversion: "13.0" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 37 - - test-python38: - executor: - name: python - pyversion: "3.8" - pgversion: "13.0" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 38 - - test-python39: - executor: - name: python - pyversion: "3.9" - pgversion: "13.0" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 39 - - test-python310: - executor: - name: python - pyversion: "3.10" - pgversion: "16.0" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 310 - - test-python311: - executor: - name: python - pyversion: "3.11" - pgversion: "16.0" - steps: - - checkout - - install-dependencies: - extra: dev, test, test-report - - run-tests: - pyversion: 311 - - store_test_results: - path: reports - - run: - name: Upload coverage report - command: coveralls - - test-python312: - executor: - name: python - pyversion: "3.12" - pgversion: "16.0" - debiandist: "bullseye" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 312 - - test-python313: - executor: - name: python - pyversion: "3.13" - pgversion: "16.0" - debiandist: "bullseye" - steps: - - checkout - - install-dependencies: - extra: dev, test - - run-tests: - pyversion: 313 - - analysis: - executor: - name: python - pyversion: "3.11" - steps: - - checkout - - install-dependencies: - extra: dev, analysis, test - - run: - name: Verify - command: poe verify - - publish: - executor: - name: python - pyversion: "3.11" - steps: - - checkout - - install-dependencies: - extra: publish - - run: - name: Set version number - command: echo "__version__ = \"${CIRCLE_TAG:1}\"" > psqlextra/_version.py - - run: - name: Build package - command: python -m build - - run: - name: Publish package - command: > - python -m twine upload - --username "__token__" - --password "${PYPI_API_TOKEN}" - --verbose - --non-interactive - --disable-progress-bar - dist/* - -workflows: - build: - jobs: - - test-python37: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python38: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python39: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python310: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python311: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python312: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - test-python313: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - analysis: - filters: - tags: - only: /.*/ - branches: - only: /.*/ - - publish: - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9e4213b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Publish + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + version: + type: string + description: The version to release. + required: true + +concurrency: + group: release-${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || '' } + cancel-in-progress: true + +jobs: + publish: + name: Run Tests + + runs-on: ubuntu-latest + + container: + image: public.ecr.aws/docker/library/python:3.11-bullseye + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install packages + run: apt-get update && apt-get install -y --no-install-recommends postgresql-client libpq-dev build-essential git + + - name: Install Python packages + run: pip install --progress-bar off '.[publish]' + + - name: Set version number + env: + RELEASE_VERSION: |- + ${{ case( + github.event_name == 'workflow_dispatch', inputs.version, + github.ref_name, + ) }} + run: | + if [[ "$RELEASE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "__version__ = \"${RELEASE_VERSION:1}\"" > psqlextra/_version.py + else + echo "::error::Invalid version format: '$RELEASE_VERSION', expected 'vX.Y.Z'." + exit 1 + fi + + - name: Build package + run: python -m build + + - name: Publish package + env: + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + run: > + python -m twine upload + --username "__token__" + --password "${PYPI_API_TOKEN}" + --verbose + --non-interactive + --disable-progress-bar + dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ac206b7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,97 @@ +name: Verify + +on: + pull_request: {} + push: + branches: + - master + +concurrency: + group: test-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analysis: + name: Analysis + + runs-on: ubuntu-latest + + container: + image: public.ecr.aws/docker/library/python:3.11-bullseye + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install packages + run: apt-get update && apt-get install -y --no-install-recommends postgresql-client libpq-dev build-essential git + + - name: Install Python packages + run: pip install --progress-bar off '.[dev, analysis, test]' + + - name: Verify + run: poe verify + + run-tests: + name: Run Tests + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.7" + postgres-version: "13" + debian-dist: "bullseye" + - python-version: "3.8" + postgres-version: "13" + debian-dist: "bullseye" + - python-version: "3.9" + postgres-version: "13" + debian-dist: "bullseye" + - python-version: "3.10" + postgres-version: "16" + debian-dist: "bullseye" + - python-version: "3.11" + postgres-version: "16" + debian-dist: "bullseye" + - python-version: "3.12" + postgres-version: "16" + debian-dist: "bullseye" + - python-version: "3.13" + postgres-version: "16" + debian-dist: "bullseye" + + container: + image: public.ecr.aws/docker/library/python:${{ matrix.python-version }}-${{ matrix.debian-dist }} + + services: + postgres: + image: public.ecr.aws/docker/library/postgres:${{ matrix.postgres-version }} + env: + POSTGRES_DB: "psqlextra" + POSTGRES_USER: "psqlextra" + POSTGRES_PASSWORD: "psqlextra" + ports: + - "5432:5432" + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install packages + run: apt-get update && apt-get install -y --no-install-recommends postgresql-client libpq-dev build-essential git + + - name: Install Python packages + run: pip install --progress-bar off '.[dev, test]' + + - name: Compute Python Version + run: echo "PYVERSION=${{ matrix.python-version }}" | sed 's/\.//g' >> $GITHUB_ENV + + - name: Run tests + env: + DATABASE_URL: "postgres://psqlextra:psqlextra@postgres:5432/psqlextra" + DATABASE_IN_CONTAINER: "true" + TOX_TESTENV_PASSENV: "DATABASE_URL DATABASE_IN_CONTAINER" + run: tox --listenvs | grep "^py$PYVERSION" | xargs -n 1 tox -e diff --git a/README.md b/README.md index 7d32022..07afdda 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ | | | | |--------------------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| :white_check_mark: | **Tests** | [![CircleCI](https://circleci.com/gh/SectorLabs/django-postgres-extra/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/django-postgres-extra/tree/master) | +| :white_check_mark: | **Tests** | [![Verify](https://github.com/SectorLabs/django-postgres-extra/actions/workflows/test.yml/badge.svg)](https://github.com/SectorLabs/django-postgres-extra/actions/workflows/test.yml) | | :memo: | **License** | [![License](https://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) | | :package: | **PyPi** | [![PyPi](https://badge.fury.io/py/django-postgres-extra.svg)](https://pypi.python.org/pypi/django-postgres-extra) | | :four_leaf_clover: | **Code coverage** | [![Coverage Status](https://coveralls.io/repos/github/SectorLabs/django-postgres-extra/badge.svg?branch=coveralls)](https://coveralls.io/github/SectorLabs/django-postgres-extra?branch=master) |