Skip to content

Update CI. #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 29 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -5,9 +5,6 @@ concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
CONDA_EXE: mamba

on:
push:
branches:
@@ -18,6 +15,21 @@ on:

jobs:

run-type-checking:

name: Run tests for type-checking
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
allow-prereleases: true
cache: pip
- run: pip install tox-uv
- run: tox -e typing

run-tests:

name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
@@ -31,33 +43,29 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/setup-python@v5
with:
auto-update-conda: false
python-version: ${{ matrix.python-version }}
channels: conda-forge,nodefaults
miniforge-variant: Mambaforge

- name: Install core dependencies.
shell: bash -l {0}
run: mamba install -c conda-forge tox-conda coverage
cache: pip
allow-prereleases: true
- run: pip install tox-uv

# Unit, integration, and end-to-end tests.

- name: Run unit tests and doctests.
shell: bash -l {0}
run: tox -e pytest -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
run: tox -e test -- -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto

- name: Upload coverage report for unit tests and doctests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F unit -c
- name: Upload unit test coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
flags: unit

- name: Run end-to-end tests.
shell: bash -l {0}
run: tox -e pytest -- -m end_to_end --cov=./ --cov-report=xml -n auto
run: tox -e test -- -m end_to_end --cov=./ --cov-report=xml -n auto

- name: Upload coverage reports of end-to-end tests.
if: runner.os == 'Linux' && matrix.python-version == '3.8'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
- name: Upload end_to_end test coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
flags: end_to_end
93 changes: 74 additions & 19 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,91 @@
name: PyPI
name: Publish Python 🐍 distribution 📦 to PyPI

on: push

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8

python-version: "3.x"
- name: Install pypa/build
run: >-
python -m
python3 -m
pip install
build
--user

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pytask-stata
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI. `dist/` contains the built
# packages, and the sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -24,10 +24,6 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.2
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -2,6 +2,51 @@
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"

[project]
name = "pytask_stata"
description = "Execute do-files with Stata and pytask."
authors = [{ name = "Tobias Raabe", email = "raabe@posteo.de" }]
license = { text = "MIT" }
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
]
requires-python = ">=3.8"
dependencies = ["click", "pytask>=0.3,<0.4"]
dynamic = ["version"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.optional-dependencies]
test = ["pytest", "pytest-cov", "pytest-xdist"]
typing = ["mypy"]

[project.urls]
Homepage = "https://github.com/pytask-dev/pytask-stata"
Documentation = "https://github.com/pytask-dev/pytask-stata"
Github = "https://github.com/pytask-dev/pytask-stata"
Tracker = "https://github.com/pytask-dev/pytask-stata/issues"
Changelog = "https://github.com/pytask-dev/pytask-stata/blob/main/CHANGES.md"

[project.entry-points]
pytask = { pytask_stata = "pytask_stata.plugin" }

[tool.setuptools]
include-package-data = true
package-dir = { "" = "src" }
zip-safe = false
platforms = ["any"]
license-files = ["LICENSE"]

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false

[tool.setuptools_scm]
write_to = "src/pytask_stata/_version.py"

43 changes: 0 additions & 43 deletions setup.cfg

This file was deleted.

23 changes: 10 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[tox]
envlist = pytest
requires = tox>=4
envlist = docs, mypy

[testenv]
usedevelop = true
package = editable

[testenv:pytest]
conda_channels =
conda-forge
nodefaults
conda_deps =
pytask =0.3
pytest
pytest-cov
pytest-xdist
commands =
pytest {posargs}
[testenv:typing]
extras = typing
commands = - mypy

[testenv:test]
extras = test
commands = pytest {posargs}