Skip to content

Commit 6f386a5

Browse files
FeGeyerKevin2
andauthored
Update ci (#24)
* add towncrier, move to mamba * add towncrier readme * add towncrier template * add changelog workflow * add radionets * add changelog * delete pip specifics * add environment.yml * add towncrier config * add init * add inits * add manifest.in * bump version * fix typo in codecov * Update environment.yml and setup.py * try to fix codecov * another codecov fix (try) * Update changelog * another try * change codecov path * change back to cta pipe version --------- Co-authored-by: Kevin2 <[email protected]>
1 parent 01903ff commit 6f386a5

File tree

14 files changed

+207
-12
lines changed

14 files changed

+207
-12
lines changed

.github/workflows/changelog.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Changelog
2+
3+
on:
4+
pull_request:
5+
# should also be re-run when changing labels
6+
types: [opened, reopened, labeled, unlabeled, synchronize]
7+
8+
env:
9+
FRAGMENT_NAME: "docs/changes/${{ github.event.number }}.*.rst"
10+
11+
jobs:
12+
changelog:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Check for news fragment
20+
if: ${{ ! contains( github.event.pull_request.labels.*.name, 'no-changelog-needed')}}
21+
uses: andstor/file-existence-action@v2
22+
with:
23+
files: ${{ env.FRAGMENT_NAME }}
24+
fail: true

.github/workflows/ci.yml

+66-11
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,83 @@ on:
99
pull_request:
1010

1111
env:
12+
MPLBACKEND: Agg
1213
PYTEST_ADDOPTS: --color=yes
14+
GITHUB_PR_NUMBER: ${{ github.event.number }}
1315

1416
jobs:
1517
tests:
16-
runs-on: ubuntu-latest
18+
runs-on: ${{ matrix.os }}
1719
strategy:
1820
matrix:
19-
python-version: [3.7, 3.8, 3.9]
21+
include:
22+
- os: ubuntu-latest
23+
python-version: "3.9"
24+
install-method: mamba
2025

21-
steps:
22-
- uses: actions/checkout@v2
26+
- os: ubuntu-latest
27+
python-version: "3.10"
28+
install-method: mamba
29+
extra-args: ["codecov"]
30+
31+
defaults:
32+
run:
33+
# We need login shells (-l) for micromamba to work.
34+
shell: bash -leo pipefail {0}
2335

24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v2
36+
steps:
37+
- uses: actions/checkout@v3
2638
with:
27-
python-version: ${{ matrix.python-version }}
39+
fetch-depth: 0
40+
41+
- name: Prepare mamba installation
42+
if: matrix.install-method == 'mamba'
43+
env:
44+
PYTHON_VERSION: ${{ matrix.python-version }}
45+
run: |
46+
# setup correct python version
47+
sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml
48+
49+
- name: mamba setup
50+
if: matrix.install-method == 'mamba'
51+
uses: mamba-org/provision-with-micromamba@v14
2852

2953
- name: Install dependencies
3054
run: |
31-
pip install .
55+
python --version
56+
pip install pytest-cov restructuredtext-lint pytest-xdist 'coverage!=6.3.0'
57+
pip install .[all]
58+
pip freeze
59+
60+
- name: List installed package versions (conda)
61+
if: matrix.environment-type == 'mamba'
62+
run: micromamba list
63+
64+
- name: Tests
65+
run: |
66+
py.test --cov --cov-report=xml
3267
33-
- name: tests
34-
run: python -m pytest --cov pyvisgen --cov-report=xml
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v3
70+
if: contains(matrix.extra-args, 'codecov')
3571

36-
- uses: codecov/codecov-action@v1
72+
docs:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
with:
77+
fetch-depth: 0
78+
79+
- name: Set up Python
80+
uses: actions/setup-python@v4
81+
with:
82+
python-version: "3.10"
83+
84+
- name: Install doc dependencies
85+
run: |
86+
sudo apt update --yes && sudo apt install --yes git
87+
pip install -U pip towncrier
88+
89+
- name: Produce Changelog
90+
run: |
91+
towncrier build --yes --version==0.0.0

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include pyvisgen/layouts/*.txt

docs/changes/24.feature.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
update ci:
2+
- change conda to mamba
3+
- install towncrier

docs/changes/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# How to use `towncrier`
2+
3+
A tutorial can be found [here](https://towncrier.readthedocs.io/en/stable/tutorial.html).
4+
5+
1. Create a new file for your changes `<PULL REQUEST>.<TYPE>.rst` in the corresponding folder. The following types are available:
6+
- feature: `New feature`
7+
- bugfix: `Bugfix`
8+
- api: `API Changes`
9+
- optimization: `Refactoring and Optimization`
10+
- maintenance: `Maintenance`
11+
12+
2. Write a suitable message for the change:
13+
```
14+
Fixed ``crazy_function`` to be consistent with ``not_so_crazy_function``
15+
```
16+
17+
3. (For maintainers) How to generate a change log:
18+
- Execute the following command in the base directory of the project
19+
```
20+
towncrier build --version=<VERSION NUMBER>
21+
```
22+

docs/changes/template.rst

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{% if render_title %}
2+
{% if versiondata.name %}
3+
{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }})
4+
{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}}
5+
{% else %}
6+
{{ versiondata.version }} ({{ versiondata.date }})
7+
{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}}
8+
{% endif %}
9+
{% endif %}
10+
11+
{% for category, val in definitions.items() %}
12+
13+
{% set underline = underlines[0] %}
14+
{{ definitions[category]['name'] }}
15+
{{ underline * definitions[category]['name']|length }}
16+
{% set underline = underlines[1] %}
17+
18+
{% for section, _ in sections.items() %}
19+
{% if section and category in sections[section] %}
20+
{{section}}
21+
{{ underline * section|length }}
22+
23+
{% endif %}
24+
{% if sections[section] and category in sections[section] %}
25+
{% if definitions[category]['showcontent'] %}
26+
{% for text, values in sections[section][category].items() %}
27+
- {{ text }} [{{ values|join(', ') }}]
28+
29+
{% endfor %}
30+
{% else %}
31+
- {{ sections[section][category]['']|join(', ') }}
32+
33+
{% endif %}
34+
{% if sections[section][category]|length == 0 %}
35+
No significant changes.
36+
37+
{% else %}
38+
{% endif %}
39+
{% else %}
40+
{# No significant changes. #}
41+
{% endif %}
42+
{% endfor %}
43+
{% endfor %}
44+

environment.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: pyvisgen
3+
channels:
4+
- pytorch
5+
- defaults
6+
- conda-forge
7+
dependencies:
8+
- python
9+
- pytorch
10+
- numpy
11+
- pip
12+
- pip:
13+
- towncrier
14+
- -e .

pyvisgen/fits/__init__.py

Whitespace-only changes.

pyvisgen/gridding/__init__.py

Whitespace-only changes.

pyvisgen/layouts/__init__.py

Whitespace-only changes.

pyvisgen/simulation/__init__.py

Whitespace-only changes.

pyvisgen/utils/__init__.py

Whitespace-only changes.

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
setup(
44
name="pyvisgen",
5-
version="0.1.3",
5+
version="0.1.4",
66
description="Simulate radio interferometer observations \
77
and visibility generation with the RIME formalism.",
88
url="https://github.com/radionets-project/pyvisgen",
99
author="Kevin Schmidt, Felix Geyer, Stefan Fröse",
1010
author_email="[email protected]",
1111
license="MIT",
12+
include_package_data=True,
1213
packages=find_packages(),
1314
install_requires=[
1415
"numpy",

towncrier.toml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[tool.towncrier]
2+
package = "pyvisgen"
3+
directory = "docs/changes"
4+
filename = "CHANGES.rst"
5+
template = "docs/changes/template.rst"
6+
# let towncrier create proper links to the merged PR
7+
issue_format = "`#{issue} <https://github.com/radionets-project/pyvisgen/pull/{issue}>`__"
8+
9+
[tool.towncrier.fragment.feature]
10+
name = "New Features"
11+
showcontent = true
12+
13+
[tool.towncrier.fragment.bugfix]
14+
name = "Bug Fixes"
15+
showcontent = true
16+
17+
[tool.towncrier.fragment.api]
18+
name = "API Changes"
19+
showcontent = true
20+
21+
[tool.towncrier.fragment.optimization]
22+
name = "Refactoring and Optimization"
23+
showcontent = true
24+
25+
[tool.towncrier.fragment.maintenance]
26+
name = "Maintenance"
27+
showcontent = true
28+
29+
[[tool.towncrier.section]]
30+
name = ""
31+
path = ""

0 commit comments

Comments
 (0)