Skip to content

Commit ebb241d

Browse files
authored
Merge pull request #38 from lincc-frameworks/issue/17/basic-automated-template-testing
Issue/17/basic automated template testing
2 parents dcd257d + 263767f commit ebb241d

4 files changed

Lines changed: 64 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI for Template
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
name: ${{ matrix.name }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
include:
17+
18+
- name: Base example
19+
extra_flags: ''
20+
foldername: 'base_example'
21+
22+
- name: Provide non-default answers
23+
extra_flags: '--data project_name=new_science --data module_name=drewtonian --data author_name=Drew --data author_email=ao@aol.com'
24+
foldername: 'non_default_answers'
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
- name: Set up Python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.10'
33+
- name: Install Python dependencies
34+
run: |
35+
sudo apt-get update
36+
python -m pip install --upgrade pip
37+
python -m pip install copier
38+
- name: Generate package
39+
run: |
40+
copier --vcs-ref HEAD --defaults ${{ matrix.extra_flags }} copy ./ ../test/${{ matrix.foldername }}
41+
cd ../test/${{ matrix.foldername }}
42+
cat .copier-answers.yml
43+
- name: Build package
44+
run: |
45+
cd ../test/${{ matrix.foldername }}
46+
pip install -e .
47+
pip install .[dev]
48+
- name: Code style checks
49+
run: |
50+
cd ../test/${{ matrix.foldername }}
51+
python -m pylint --recursive=y ./src/
52+
- name: Build docs
53+
run: |
54+
cd ../test/${{ matrix.foldername }}
55+
sphinx-build -b html docs/source docs/build/html
56+
- name: Tests
57+
run: |
58+
cd ../test/${{ matrix.foldername }}
59+
python -m pytest tests/*

copier.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
project_name:
22
type: str
33
help: What is the name of your project?
4+
default: example_project
45

56
module_name:
67
type: str
@@ -11,10 +12,12 @@ author_name:
1112
type: str
1213
help: Your first and last name?
1314
placeholder: Jenny Fantastic
15+
default: Name Placeholder
1416

1517
author_email:
1618
type: str
1719
help: Your preferred email address?
20+
default: email.placeholder@someplace.special
1821

1922
###
2023
# Below this line are Copier configuration options.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sphinx==6.1.3
1+
sphinx==5.3.0
22
sphinx_rtd_theme==1.1.1

python-project-template/pyproject.toml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dev = [
2727
"pre-commit", # Used to run checks before finalizing a git commit
2828
"nbconvert", # Needed for pre-commit check to clear output from Python notebooks
2929
"pylint", # Used for static linting of files
30-
"sphinx==6.1.3", # Used to automatically generate documentation
30+
"sphinx==5.3.0", # Used to automatically generate documentation
3131
"sphinx_rtd_theme==1.1.1", # Used to render documentation
3232
]
3333

0 commit comments

Comments
 (0)