Skip to content

Commit 97d49fd

Browse files
authored
Merge pull request #169 from nicoddemus/modernize-ci
Modernize CI workflow
2 parents a676744 + 55a4c3a commit 97d49fd

File tree

18 files changed

+138
-109
lines changed

18 files changed

+138
-109
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
default: '1.2.3'
10+
11+
jobs:
12+
13+
package:
14+
runs-on: ubuntu-latest
15+
env:
16+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Build and Check Package
22+
uses: hynek/[email protected]
23+
24+
deploy:
25+
needs: package
26+
runs-on: ubuntu-latest
27+
environment: deploy
28+
permissions:
29+
id-token: write # For PyPI trusted publishers.
30+
contents: write # For tag and release notes.
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Download Package
36+
uses: actions/download-artifact@v3
37+
with:
38+
name: Packages
39+
path: dist
40+
41+
- name: Publish package to PyPI
42+
uses: pypa/[email protected]
43+
44+
- name: Push tag
45+
run: |
46+
git config user.name "pytest bot"
47+
git config user.email "[email protected]"
48+
git tag --annotate --message=${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }}
49+
git push origin ${{ github.event.inputs.version }}
50+
51+
- name: GitHub Release
52+
uses: softprops/action-gh-release@v1
53+
with:
54+
files: dist/*
55+
tag_name: ${{ github.event.inputs.version }}

.github/workflows/main.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "test-me-*"
8+
9+
pull_request:
10+
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
package:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Build and Check Package
23+
uses: hynek/[email protected]
24+
25+
test:
26+
27+
needs: [package]
28+
29+
runs-on: ${{ matrix.os }}
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
python: ["3.7", "3.8", "3.9"]
35+
os: [ubuntu-latest, windows-latest]
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
40+
- name: Download Package
41+
uses: actions/download-artifact@v3
42+
with:
43+
name: Packages
44+
path: dist
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v4
48+
with:
49+
python-version: ${{ matrix.python }}
50+
51+
- name: Install tox
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install tox
55+
56+
- name: Test
57+
shell: bash
58+
run: |
59+
tox run -e py --installpkg `find dist/*.tar.gz`

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ htmlcov/
2020
.coverage.*
2121
.pytest_cache/
2222
.eggs/
23+
dist/
2324
coverage.xml
2425
tests/junit.xml
2526

26-
pytest_flask/_version.py
27+
src/pytest_flask/_version.py
2728

2829
# Editors
2930
.vscode

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
- id: rst
2828
name: rst
2929
entry: rst-lint --encoding utf-8
30-
files: ^(HOWTORELEASE.rst|README.rst)$
30+
files: ^(RELEASING.rst|README.rst)$
3131
language: python
3232
additional_dependencies: [pygments, restructuredtext_lint]
3333
- repo: https://github.com/myint/autoflake.git

HOWTORELEASE.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

RELEASING.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Here are the steps on how to make a new release.
2+
3+
1. Create a ``release-VERSION`` branch from ``upstream/main``.
4+
2. Update ``CHANGELOG.rst``.
5+
3. Push the branch to ``upstream``.
6+
4. Once all tests pass, start the ``deploy`` workflow manually.
7+
5. Merge the PR.

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
"setuptools-scm[toml]",
5+
]
6+
build-backend = "setuptools.build_meta"

requirements/main.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pytest>=5.2
2-
Flask
2+
Flask <3.0
33
Werkzeug>=0.7

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ keywords = pytest, flask, testing
77
author_email = [email protected]
88
url = https://github.com/pytest-dev/pytest-flask
99
long_description = file: README.rst, docs/changelog.rst, LICENSE
10+
long_description_content_type = text/x-rst
1011
description = A set of py.test fixtures to test Flask applications.
1112
project_urls =
1213
Source = https://github.com/pytest-dev/pytest-flask
@@ -27,10 +28,12 @@ classifiers=
2728
Topic :: Software Development :: Libraries :: Python Modules
2829

2930
[options]
30-
packages = find:
31+
packages = pytest_flask
3132
zip_safe = False
3233
python_requires = >= 3.7
3334
setup_requires = setuptools_scm
35+
package_dir =
36+
=src
3437

3538
[options.packages.find]
3639
exclude = docs, tests

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def read(*parts):
2121

2222
setup(
2323
# Dependencies are here for GitHub's dependency graph.
24-
use_scm_version={"write_to": "pytest_flask/_version.py"},
24+
use_scm_version={"write_to": "src/pytest_flask/_version.py"},
2525
install_requires=requirements,
2626
tests_require=tests_require,
2727
extras_require=extras_require,
File renamed without changes.
File renamed without changes.

pytest_flask/fixtures.py renamed to src/pytest_flask/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_login(self):
4040

4141

4242
@pytest.fixture(scope=_determine_scope)
43-
def live_server(request, app, pytestconfig):
43+
def live_server(request, app, pytestconfig): # pragma: no cover
4444
"""Run application in a separate process.
4545
4646
When the ``live_server`` fixture is applied, the ``url_for`` function

pytest_flask/live_server.py renamed to src/pytest_flask/live_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
multiprocessing = multiprocessing.get_context("fork")
1515

1616

17-
class LiveServer:
17+
class LiveServer: # pragma: no cover
1818
"""The helper class used to manage a live server. Handles creation and
1919
stopping application in a separate process.
2020
File renamed without changes.
File renamed without changes.

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ deps =
2626
-rrequirements/main.txt
2727
-rrequirements/test.txt
2828

29-
passenv = HOME LANG LC_ALL
30-
3129
commands =
3230
coverage run -m pytest {posargs:tests}
3331
coverage combine

0 commit comments

Comments
 (0)