Skip to content

Commit

Permalink
refactor for tox and makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
sorend committed Jul 1, 2024
1 parent 56086c7 commit b453e32
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 25 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Dynamic versioning
run: |
python -m pip install --upgrade pip
pip install versiontag flit
python .ci/versioning.py
- name: Install dependencies
run: |
pip install -e '.[test]'
- name: Run tests
run: pytest tests

- name: Codecov upload
run: codecov
run: make test

deploy:
runs-on: "ubuntu-latest"
Expand All @@ -74,13 +61,12 @@ jobs:
- name: Publish testpypi
run: |
flit build
flit publish
make publish
- name: Publish pypi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
export FLIT_INDEX_URL=${{ secrets.PROD_FLIT_INDEX_URL }}
export FLIT_USERNAME=${{ secrets.PROD_FLIT_USERNAME }}
export FLIT_PASSWORD=${{ secrets.PROD_FLIT_PASSWORD }}
flit publish
make publish
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ venv
dist
build
.pytest_cache
version.txt
.coverage
sshconf_version.py
*~
coverage.xml
*~
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

FLIT_INDEX_URL ?= https://test.pypi.org/legacy/
FLIT_USERNAME = __token__
FLIT_PASSWORD ?= dummy

all: build

deps:
pip install versiontag flit

$(VERSION_FILE): deps
python .ci/versioning.py

local_install: $(VERSION_FILE) deps
pip install -e '.[test]'

wheel: local_install
flit build --format wheel
flit build --format sdist

build: wheel

publish:
@FLIT_USERNAME=$(FLIT_USERNAME) FLIT_PASSWORD=$(FLIT_PASSWORD) FLIT_INDEX_URL=$(FLIT_INDEX_URL) flit publish --format wheel
@FLIT_USERNAME=$(FLIT_USERNAME) FLIT_PASSWORD=$(FLIT_PASSWORD) FLIT_INDEX_URL=$(FLIT_INDEX_URL) flit publish --format sdist

test: local_install
tox

clean:
rm -rf dist .pytest_cache build .eggs fylearn.egg-info htmlcov .tox *.whl *~
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
name = "sshconf"
authors = [
{name = "Søren A D", email = "sorend@gmail.com"},
{name = "Søren A D", email = "soren@hamisoke.com"},
]
dependencies = [ ]
dependencies = []
license = {file = "LICENSE"}
dynamic = ["version", "description"]
classifiers = [
Expand Down Expand Up @@ -31,4 +31,7 @@ requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.sdist]
include = ["version.txt"]
exclude = [".gitignore", ".github", ".ci", "codecov.yml", "Makefile"]

[tool.pytest.ini_options]
addopts = "-v --cov-fail-under=60 --cov=sshconf"
33 changes: 33 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[metadata]
description-file = README.md

[aliases]
test = pytest

[flake8]
max-line-length = 120
exclude = .git, setup.py, __pycache__, tests

[tox:tox]
envlist = clean, py312, coverage

[gh-actions]
python =
3.12: py312, coverage

[testenv]
deps =
pytest
pytest-cov
commands = pytest {posargs}

[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase

[testenv:coverage]
passenv = TOXENV,CI,GITHUB,GITHUB_*,CODECOV_*
deps = codecov
skip_install = true
commands = codecov

0 comments on commit b453e32

Please sign in to comment.