Skip to content

Commit 5c53b4d

Browse files
authored
Extrapolation: bugfix when CoordRadii specified. (#64)
Co-authored-by: Michael Boyle <michael.oliver.boyle@gmail.com> Also updates CI system
1 parent 030adbb commit 5c53b4d

18 files changed

+834
-989
lines changed

.github/scripts/parse_bump_rule.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import sys
2+
import os
3+
4+
5+
def parse(message):
6+
if "#prerelease" in message:
7+
return 'prerelease'
8+
9+
for pre in ['pre', '']:
10+
for level in ['patch', 'minor', 'major']:
11+
if f'#{pre}{level}' in message:
12+
return f'{pre}{level}'
13+
14+
return 'patch'
15+
16+
17+
message = os.environ['github_event_head_commit_message']
18+
print(parse(message))

.github/scripts/parse_version.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
3+
4+
def parse(f):
5+
import toml
6+
pyproject = toml.load(f)
7+
return pyproject['tool']['poetry']['version']
8+
9+
10+
print(parse(sys.argv[1]))

.github/workflows/automated_testing.yml

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

.github/workflows/build.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Test and deploy
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
build:
8+
name: ${{ matrix.os }} python ${{ matrix.python-version }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
if: >-
13+
!contains(github.event.head_commit.message, '[skip ci]')
14+
&& !contains(github.event.head_commit.message, '[skip tests]')
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest]
20+
python-version: ['3.8', '3.10']
21+
22+
steps:
23+
- name: Skip replicates on main branch
24+
env:
25+
skip_replicates: ${{ github.ref == 'refs/heads/main' && (matrix.os != 'ubuntu-latest' || matrix.python-version != '3.10') }}
26+
shell: bash
27+
run: |
28+
echo "skipping_build_and_test_replicate=${skip_replicates}" >> $GITHUB_ENV
29+
# echo "skipping_build_and_test_replicate='false'" >> $GITHUB_ENV
30+
31+
- name: Check out code
32+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
33+
uses: actions/checkout@v2
34+
35+
- name: Set up python ${{ matrix.python-version }}
36+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Install poetry
42+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
43+
shell: bash
44+
run: |
45+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
46+
python get-poetry.py -y
47+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
48+
49+
- name: Build and install with poetry
50+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
51+
shell: bash
52+
run: |
53+
poetry run python -m pip install --upgrade pip
54+
poetry env info
55+
rm poetry.lock
56+
poetry update
57+
poetry build
58+
poetry install --no-interaction
59+
60+
- name: Run tests
61+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
62+
shell: bash
63+
run: |
64+
poetry run pytest -s --cov=scri --cov-branch --cov-report=xml --durations=0
65+
66+
- name: Upload coverage
67+
if: "matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'"
68+
uses: codecov/codecov-action@v2
69+
70+
71+
release:
72+
name: Create release and send to PyPI
73+
needs: build
74+
runs-on: ubuntu-latest
75+
if: >-
76+
github.ref == 'refs/heads/main'
77+
&& !contains(github.event.head_commit.message, '[no release]')
78+
&& (success() || contains(github.event.head_commit.message, '[skip tests]'))
79+
80+
steps:
81+
- name: Check out code
82+
uses: actions/checkout@v2
83+
84+
- name: Set up python ${{ matrix.python-version }}
85+
uses: actions/setup-python@v2
86+
with:
87+
python-version: '3.10'
88+
89+
- name: Install toml
90+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
91+
shell: bash
92+
run: |
93+
python -m pip install --upgrade pip toml
94+
95+
- name: Install poetry
96+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
97+
shell: bash
98+
run: |
99+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
100+
python get-poetry.py -y
101+
102+
- name: Build and install with poetry
103+
if: ${{ env.skipping_build_and_test_replicate != 'true' }}
104+
shell: bash
105+
run: |
106+
$HOME/.poetry/bin/poetry run python -m pip install --upgrade pip
107+
$HOME/.poetry/bin/poetry env info
108+
rm poetry.lock
109+
$HOME/.poetry/bin/poetry update
110+
$HOME/.poetry/bin/poetry build
111+
$HOME/.poetry/bin/poetry install --no-interaction --no-dev
112+
113+
- name: Bump version
114+
shell: bash
115+
env:
116+
github_event_head_commit_message: ${{ github.event.head_commit.message }}
117+
run: |
118+
# Note: The following line reads the HEAD commit message to look for an indication of how
119+
# to bump the version number. Specifically, if `#patch`, `#minor`, or `#major` is present
120+
# in the commit message, it bumps the corresponding version number. Those can also be
121+
# prepended as `#premajor`, etc., to add/bump the prerelease modifier. If none of those
122+
# are present, `#patch` is assumed — that is, the lowest-significance number is
123+
# incremented. See the documentation of the `poetry version` command for details.
124+
export version_bump_rule=$(python .github/scripts/parse_bump_rule.py)
125+
echo "version_bump_rule: '${version_bump_rule}'"
126+
$HOME/.poetry/bin/poetry version "${version_bump_rule}"
127+
export new_version=$(python .github/scripts/parse_version.py pyproject.toml)
128+
echo "new_version: '${new_version}'"
129+
echo "new_version=${new_version}" >> $GITHUB_ENV # Save env variable for later steps
130+
131+
- name: Tag and push new version
132+
shell: bash
133+
run: |
134+
git config user.name github-actions
135+
git config user.email github-actions@github.com
136+
git add pyproject.toml
137+
git commit -m "Bump version to v${new_version}"
138+
git tag -a "v${new_version}" -m "Version ${new_version}"
139+
git status
140+
git push --follow-tags # Will not trigger new workflow because it uses GITHUB_TOKEN
141+
142+
- name: Create release
143+
if: "!contains(github.event.head_commit.message, '[no release]')"
144+
id: create_release
145+
uses: actions/create-release@latest
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
with:
149+
tag_name: v${{ env.new_version }}
150+
release_name: Release v${{ env.new_version }}
151+
draft: false
152+
prerelease: false
153+
154+
- name: Publish to PyPI
155+
if: "!contains(github.event.head_commit.message, '[no pypi]')"
156+
env:
157+
# 1) Get key from https://pypi.org/manage/account/token/
158+
# 2) Copy it to Github > repo > Settings > Secrets
159+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
160+
shell: bash
161+
run: |
162+
# Do these first two steps again to ensure the version is right
163+
$HOME/.poetry/bin/poetry build
164+
$HOME/.poetry/bin/poetry install --no-interaction --no-dev
165+
$HOME/.poetry/bin/poetry publish

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ tmp
7070

7171
build_artifacts
7272
# conda smithy ci-skeleton end
73+
74+
75+
.envrc

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

TODO.txt

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

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
sys.path.insert(0, os.path.abspath(".."))
2424
import _version as scri_version
2525
except:
26-
import scri._version as scri_version
26+
import scri.__version__ as scri_version
2727

2828
# -- Project information -----------------------------------------------------
2929

@@ -32,7 +32,7 @@
3232
author = "Michael Boyle"
3333

3434
# The short X.Y version
35-
version = scri_version.__version__
35+
version = scri_version
3636
# The full version, including alpha/beta/rc tags
3737
release = version
3838

pipify.sh

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

0 commit comments

Comments
 (0)