Skip to content

Commit

Permalink
updates CI
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Feb 7, 2025
1 parent 43ccc68 commit 9de2e9b
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 36 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release to PyPI
on:
push:
tags: ["*"]

env:
dists-artifact-name: python-package-distributions

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: ${{ env.dists-artifact-name }}
path: dist/*

release:
needs:
- build
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/pytest-echo/${{ github.ref_name }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: ${{ env.dists-artifact-name }}
path: dist/
- name: Publish to PyPI
uses: pypa/[email protected]
with:
attestations: true
74 changes: 38 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Test

on:
workflow_dispatch:
push:
branches:
- master
- develop
branches: [ "develop" ]
tags-ignore: [ "**" ]
pull_request:
schedule:
- cron: "0 8 * * *"

jobs:
lint:
Expand All @@ -30,47 +32,47 @@ jobs:
strategy:
fail-fast: false
matrix:
# python-version: [ "3.10", "3.11", "3.12" ]
# django-version: [ "3.2", "4.2", "5.0" ]
python-version: [ "312" ]
# python-version: [ "3.10", "3.11", "3.12" ]
# django-version: [ "3.2", "4.2", "5.0" ]
python-version: [ "312" ]
django-version: [ "51" ]
env:
PY_VER: ${{ matrix.python-version}}
DJ_VER: ${{ matrix.django-version}}
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_ALWAYS_EAGER: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv

- name: Install Python
if: matrix.python-version != '3.13'
run: uv python install --python-preference only-managed ${{ matrix.python-version}}
- name: Install Python
if: matrix.python-version != '3.13'
run: uv python install --python-preference only-managed ${{ matrix.python-version}}

- name: Setup test suite ${{ env.DJ_VER }}-${{ env.PY_VER }}
run: tox run -vv --notest --skip-missing-interpreters false -e d${{ env.DJ_VER }}-py${{ env.PY_VER }}
- name: Setup test suite ${{ env.DJ_VER }}-${{ env.PY_VER }}
run: tox run -vv --notest --skip-missing-interpreters false -e d${{ env.DJ_VER }}-py${{ env.PY_VER }}

- name: Run test suite
run:
COV_CMD=$(if [${{ env.DJ_VER }}-${{ env.PY_VER }}} == 51-312 ]; then echo "--cov=pytest_echo --cov-report=xml"; else echo ; fi)
tox run --skip-pkg-install -e d${{ env.DJ_VER }}-py${{ env.PY_VER }} $COV_CMD
env:
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ success() && matrix.python-version == 3.13 }}
with:
env_vars: OS
name: codecov-pytest-order
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run test suite
run:
COV_CMD=$(if [${{ env.DJ_VER }}-${{ env.PY_VER }} == 51-312 ]; then echo "--cov=pytest_echo --cov-report=xml"; else echo ; fi)
tox run --skip-pkg-install -e d${{ env.DJ_VER }}-py${{ env.PY_VER }} $COV_CMD
env:
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ success() && matrix.python-version == 3.13 }}
with:
env_vars: OS
name: codecov-pytest-order
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 9de2e9b

Please sign in to comment.