Skip to content

Commit c19f866

Browse files
authored
Merge pull request #216 from NLeSC/175-latest-python
Use the latest Python version and improve the workflows
2 parents 79acd4c + 9f61993 commit c19f866

14 files changed

Lines changed: 131 additions & 48 deletions

File tree

.github/workflows/cffconvert.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: cffconvert
33
on: push
44

55
jobs:
6-
verify:
7-
name: "cffconvert"
6+
7+
cffconvert:
8+
name: Verify citation metadata consistency
89
runs-on: ubuntu-latest
910
steps:
1011
- uses: actions/checkout@v2

.github/workflows/markdown-link-checker.yml renamed to .github/workflows/markdown-link-check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: markdown-link-checker
1+
name: markdown-link-check
22

33
on: [push, pull_request]
44

55
jobs:
6+
67
markdown-link-check:
8+
name: Check markdown links
79
runs-on: ubuntu-latest
810
steps:
911
- uses: actions/checkout@main

.github/workflows/tests.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@ on:
66
types: [opened, synchronize, reopened]
77

88
jobs:
9-
tests:
10-
11-
runs-on: ubuntu-latest
129

10+
tests:
11+
name: Run template tests
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
17+
python-version: ['3.6', '3.7', '3.8', '3.9']
1318
steps:
1419
- uses: actions/checkout@v2
15-
- name: Set up Python
20+
- name: Set up Python ${{ matrix.python-version }}
1621
uses: actions/setup-python@v2
1722
with:
18-
python-version: '3.x'
23+
python-version: ${{ matrix.python-version }}
24+
- name: Python info
25+
shell: bash -l {0}
26+
run: |
27+
which python3
28+
python3 --version
1929
- name: Install dependencies
2030
run: |
2131
python3 -m pip install --upgrade pip setuptools
2232
python3 -m pip install .[dev]
23-
- name: Run tests
33+
- name: Run pytest
2434
run: |
2535
pytest

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ an empty Python package. Features include:
3030
| **Other best practices** |   |
3131
|   |   |
3232
| **GitHub Actions** |   |
33-
| MarkDown link checker | [![workflow mlc badge](https://github.com/nlesc/python-template/workflows/markdown-link-checker/badge.svg)](https://github.com/nlesc/python-template/actions?query=workflow%3A%22markdown-link-checker%22) |
34-
| Citation metadata consistency | [![workflow cffconvert badge](https://github.com/nlesc/python-template/workflows/cffconvert/badge.svg)](https://github.com/nlesc/python-template/actions?query=workflow%3A%22cffconvert%22) |
35-
| Unit tests | [![workflow tests badge](https://github.com/nlesc/python-template/workflows/tests/badge.svg)](https://github.com/nlesc/python-template/actions?query=workflow%3Atests) |
33+
| Citation metadata consistency | [![cffconvert](https://github.com/nlesc/python-template/actions/workflows/cffconvert.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/cffconvert.yml) |
34+
| MarkDown link checker | [![markdown-link-check](https://github.com/nlesc/python-template/actions/workflows/markdown-link-check.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/markdown-link-check.yml) |
35+
| Tests | [![tests](https://github.com/nlesc/python-template/actions/workflows/tests.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/tests.yml) |
3636

3737
## How to use
3838

hooks/pre_gen_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"),
66
"project_name": cookiecutter.project_name.lower().replace(" ", "-"),
77
"full_name": cookiecutter.full_name.replace('\"', '\\\"'),
8-
"repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"),
8+
"repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace(" ", "-"),
99
"package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"')
1010
}) }}
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: build
22

33
on: [push, pull_request]
44

@@ -15,28 +15,19 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v2
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Python info
2222
shell: bash -l {0}
2323
run: |
24-
which python
25-
python --version
26-
- name: Install package and its dependencies
24+
which python3
25+
python3 --version
26+
- name: Upgrade pip and install dependencies
2727
run: |
28-
python -m pip install --upgrade pip
29-
pip install .[dev]
30-
- name: Check style against standards using prospector
31-
shell: bash -l {0}
32-
run: prospector -o grouped -o pylint:pylint-report.txt
33-
- name: Build
28+
python3 -m pip install --upgrade pip setuptools
29+
python3 -m pip install .[publishing]
30+
- name: Verify that we can build the package
3431
shell: bash -l {0}
3532
run: |
36-
pip install -e .[dev]
37-
- name: Check style against standards using prospector
38-
shell: bash -l {0}
39-
run: prospector -0 -o grouped -o pylint:pylint-report.txt
40-
- name: Test
41-
shell: bash -l {0}
42-
run: pytest
33+
python3 setup.py sdist bdist_wheel

{{cookiecutter.project_name}}/.github/workflows/cffconvert.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: cffconvert
22

3-
on: push
3+
on: [push, pull_request]
44

55
jobs:
6+
67
verify:
78
name: "cffconvert"
89
runs-on: ubuntu-latest
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
lint:
8+
name: Lint for (${{ matrix.python-version }}, ${{ matrix.os }})
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
14+
python-version: ['3.6', '3.7', '3.8', '3.9']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Python info
22+
shell: bash -l {0}
23+
run: |
24+
which python3
25+
python3 --version
26+
- name: Install package and its dependencies
27+
run: |
28+
python3 -m pip install --upgrade pip setuptools
29+
python3 -m pip install .[dev]
30+
- name: Check style against standards using prospector
31+
shell: bash -l {0}
32+
run: prospector --zero-exit --output-format grouped --output-format pylint:pylint-report.txt
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: markdown-link-check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
markdown-link-check:
8+
name: Check markdown links
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@main
12+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
13+
with:
14+
config-file: '.mlc-config.json'

{{cookiecutter.project_name}}/.github/workflows/pypi.yml renamed to {{cookiecutter.project_name}}/.github/workflows/publish.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
name: Publish
1+
name: publish
22

33
on:
44
release:
55
types: [published]
66

77
jobs:
8+
89
publish:
10+
name: Publish
911
runs-on: ubuntu-latest
1012
steps:
1113
- uses: actions/checkout@v2
1214
- name: Set up Python
1315
uses: actions/setup-python@v2
1416
with:
15-
python-version: 3.7
17+
python-version: 3.9
18+
- name: Python info
19+
shell: bash -l {0}
20+
run: |
21+
which python3
22+
python3 --version
1623
- name: Install dependencies
1724
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
25+
python3 -m pip install --upgrade pip setuptools
26+
python3 -m pip install .[publishing]
2027
- name: Build distributions
21-
run: python setup.py sdist bdist_wheel
28+
run: python3 setup.py sdist bdist_wheel
2229
- name: Publish package
2330
uses: pypa/gh-action-pypi-publish@release/v1
2431
with:

0 commit comments

Comments
 (0)