Skip to content

Commit 7641cdc

Browse files
committed
ci fixes
1 parent 862d44e commit 7641cdc

File tree

9 files changed

+64
-55
lines changed

9 files changed

+64
-55
lines changed

.ci/release_check.py

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

.ci/version_check.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Ensure that current version is not in conflict with published releases."""
2+
import requests
3+
from pkg_resources import parse_version
4+
import subprocess as subp
5+
from pathlib import PurePath
6+
7+
project_dir = PurePath(__file__).parent.parent
8+
version_fn = project_dir / "src/iminuit/version.py"
9+
changelog_fn = project_dir / "doc/changelog.rst"
10+
11+
with open(version_fn) as f:
12+
version = {}
13+
exec(f.read(), version) # this loads __version__
14+
version = version["__version__"]
15+
16+
# make sure that changelog was updated
17+
with open(changelog_fn) as f:
18+
assert version in f.read(), "changelog entry missing"
19+
20+
# make sure that version is not already tagged
21+
tags = subp.check_output(["git", "tag"]).decode().strip().split("\n")
22+
assert f"v{version}" not in tags, "tag exists"
23+
24+
# make sure that version itself was updated
25+
r = requests.get("https://pypi.org/pypi/iminuit/json")
26+
releases = r.json()["releases"]
27+
pypi_versions = [parse_version(v) for v in releases]
28+
this_version = parse_version(version)
29+
assert this_version not in pypi_versions, "pypi version exists"

.github/workflows/coverage.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Coverage
22

33
on:
44
pull_request:
5-
branches:
6-
- master
7-
- develop
85
paths-ignore:
96
- 'doc/**'
107
- '.ci/**'
@@ -13,6 +10,7 @@ on:
1310
branches:
1411
- master
1512
- develop
13+
- beta/*
1614

1715
jobs:
1816
coverage:
@@ -29,8 +27,6 @@ jobs:
2927
run: |
3028
python -m pip install --upgrade pip wheel
3129
python -m pip install -r requirements-dev.txt
32-
- run: pre-commit run -a
33-
# -e is required here to track coverage properly
3430
- run: python -m pip install -e .
3531
- run: coverage run -m pytest
3632
- uses: AndreMiras/coveralls-python-action@develop

.github/workflows/docs.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ name: Docs
22

33
on:
44
pull_request:
5-
branches:
6-
- master
7-
- develop
85
paths-ignore:
96
- '.ci/**'
107
push:
118
branches:
12-
- master
13-
- develop
9+
- beta/*
1410

1511
jobs:
1612
docs:

.github/workflows/pre-commit.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
- beta/*
10+
11+
jobs:
12+
version:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
- run: python -m pip install --upgrade pip wheel
21+
- run: python -m pip install pre-commit
22+
- run: pre-commit run -a

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Test
22

33
on:
44
pull_request:
5-
# test every branch except master, master is tested by wheels.yml
6-
branches-ignore:
7-
- master
85
paths-ignore:
96
- 'doc/**'
107
- '.ci/**'

.github/workflows/version.yml

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

.github/workflows/wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Wheels
33
on:
44
push:
55
branches:
6-
- beta-*
6+
- beta/*
77
pull_request:
88
branches:
99
- master
@@ -44,7 +44,7 @@ jobs:
4444
path: ./wheelhouse/*.whl
4545

4646
sdist:
47-
name: Build source distribution
47+
name: Build source package
4848
runs-on: ubuntu-latest
4949
steps:
5050
- uses: actions/checkout@v2
@@ -68,7 +68,7 @@ jobs:
6868
path: dist/*.tar.gz
6969

7070
upload:
71-
if: "github.event.release.published"
71+
if: "github.event.release"
7272
needs: [wheels, sdist]
7373
runs-on: ubuntu-latest
7474
steps:

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ repos:
3232
- id: trailing-whitespace
3333
exclude: ^doc/_static/.*.svg
3434

35+
- repo: local
36+
hooks:
37+
- id: version-check
38+
name: version-check
39+
language: python
40+
additional_dependencies: [requests]
41+
entry: python .ci/version_check.py
42+
3543
# Python linter (Flake8)
3644
- repo: https://gitlab.com/pycqa/flake8
3745
rev: 3.8.4

0 commit comments

Comments
 (0)