Skip to content

Commit ffe1f8b

Browse files
author
root
committed
added github workflows tests.yml
1 parent c577c53 commit ffe1f8b

File tree

3 files changed

+112
-9
lines changed

3 files changed

+112
-9
lines changed

.github/workflows/tests.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Regular tests
2+
#
3+
# Use this to ensure your tests are passing on every push and PR (skipped on
4+
# pushes which only affect documentation).
5+
#
6+
# You should make sure you run jobs on at least the *oldest* and the *newest*
7+
# versions of python that your codebase is intended to support.
8+
9+
name: tests
10+
11+
on:
12+
push:
13+
branches:
14+
- main
15+
- dev
16+
pull_request:
17+
18+
jobs:
19+
test:
20+
timeout-minutes: 45
21+
defaults:
22+
run:
23+
shell: bash
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
os: [ubuntu-latest, macos-13, windows-latest]
29+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
30+
env:
31+
OS: ${{ matrix.os }}
32+
PYTHON: ${{ matrix.python-version }}
33+
34+
steps:
35+
- name: Set OS Environment Variables (Windows)
36+
if: runner.os == 'Windows'
37+
run: |
38+
echo 'ACTIVATE_PYTHON_VENV=.venv/scripts/activate' >> $GITHUB_ENV
39+
40+
- name: Set OS Environment Variables (not Windows)
41+
if: runner.os != 'Windows'
42+
run: |
43+
echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV
44+
45+
- name: Check out repository
46+
uses: actions/checkout@v4
47+
48+
- name: Cache $HOME/.local # Significantly speeds up Poetry Install
49+
uses: actions/cache@v4
50+
with:
51+
path: ~/.local
52+
key: dotlocal-${{ runner.os }}-${{matrix.python-version}}-${{ hashFiles('.github/workflows/tests.yaml') }}
53+
54+
- name: Set up python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install poetry
60+
uses: snok/install-poetry@v1
61+
with:
62+
virtualenvs-create: true
63+
virtualenvs-in-project: true
64+
installer-parallel: false # Currently there seems to be some race-condition in windows
65+
66+
- name: Install library
67+
run: poetry install --no-interaction
68+
69+
- uses: actions/cache@v4
70+
with:
71+
path: ~/.cache/pre-commit/
72+
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
73+
74+
- name: Pre-commit run
75+
run: |
76+
source ${{ env.ACTIVATE_PYTHON_VENV }}
77+
pre-commit run --show-diff-on-failure --color=always --all-files
78+
79+
- name: Check tests folder existence
80+
id: check_test_files
81+
uses: andstor/file-existence-action@v3
82+
with:
83+
files: "tests"
84+
85+
- name: Run tests
86+
if: steps.check_test_files.outputs.files_exists == 'true'
87+
run: |
88+
source ${{ env.ACTIVATE_PYTHON_VENV }}
89+
make test
90+
coverage report
91+
92+
#----------------------------------------------
93+
# make sure docs build
94+
#----------------------------------------------
95+
- name: Build HTML docs
96+
run: |
97+
source ${{ env.ACTIVATE_PYTHON_VENV }}
98+
mkdocs build
99+
100+
- name: Upload coverage to Codecov
101+
if: steps.check_test_files.outputs.files_exists == 'true'
102+
uses: codecov/codecov-action@v4
103+
with:
104+
token: ${{ secrets.CODECOV_TOKEN }}
105+
flags: unittests
106+
env_vars: OS,PYTHON
107+
name: Python ${{ matrix.python-version }} on ${{ runner.os }}

docs/development/building.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,7 @@ To use dynamic versioning, you need to install the poetry-dynamic-versioning plu
182182
poetry self add poetry-dynamic-versioning
183183
```
184184

185-
After installing the plugin, you need to configure it. You can do this by adding a [tool.dynamic-versioning] section to your pyproject.toml file. Here’s an example configuration:
186-
187-
```bash
188-
[tool.dynamic-versioning]
189-
version = { source = "git" }
190-
```
185+
### To Release a New Version
191186

192187
1. Create and push a tag:
193188
```bash

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["poetry-core>=1.0.0", "setuptools", "tomli"]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["poetry-core>=1.0.0", "setuptools", "tomli", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
3+
build-backend = "poetry_dynamic_versioning.backend"
44

55
[tool.poetry]
66
name = "python-newtype"
@@ -41,7 +41,8 @@ python = ">=3.8,<4.0"
4141
typing-extensions = "*"
4242

4343
[tool.poetry-dynamic-versioning]
44-
version = { source = "git" }
44+
enable = true
45+
vcs = "git"
4546

4647
[tool.poetry.group.docs.dependencies]
4748
mkdocs = "*"

0 commit comments

Comments
 (0)