This repository has been archived by the owner on Aug 11, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 63
106 lines (97 loc) · 3.18 KB
/
ci_workflows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
branches:
- cookiecutter
pull_request:
branches:
- cookiecutter
# Extra context is a way to override options that the user normally
# specifies during the questions phase of the cookiecutter setup. The keys
# being overridden here must exist in the cookiecutter.json
# See https://cookiecutter.readthedocs.io/en/0.9.1/advanced_usage.html#injecting-extra-context
jobs:
tests:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- name: Default setup
extra_context: ''
extra_flags: ''
foldername: 'packagename'
- name: Compile ext and example code
extra_context: 'use_compiled_extensions=y include_example_code=y'
extra_flags: ''
foldername: 'packagename'
- name: Custom package name
extra_context: 'package_name=AstropyProject'
extra_flags: ''
foldername: 'AstropyProject'
- name: Parent is sunpy
extra_context: '_parent_project=sunpy'
extra_flags: ''
foldername: 'packagename'
- name: Python minversion
extra_context: 'minimum_python_version=3.7'
extra_flags: ''
foldername: 'packagename'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Python dependencies
run: |
python -m pip install --upgrade tox
python -m pip install sphinx-astropy cookiecutter gitpython
- name: Generate package
run: |
cd docs ; make html ; cd ..
cookiecutter --no-input ./ -o ../test ${{ matrix.extra_context }} ${{ matrix.extra_flags }}
cd ../test/${{ matrix.foldername }}
git init
- name: Code style checks
run: |
cd ../test/${{ matrix.foldername }}
tox -e codestyle
- name: Build docs
run: |
cd ../test/${{ matrix.foldername }}
tox -e build_docs
- name: Tests
run: |
cd ../test/${{ matrix.foldername }}
tox -e py38-test
# upload-artifact does not take relpath, so render inside code checkout
render:
name: Render template
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Python dependencies
run: |
python -m pip install --upgrade tox
python -m pip install sphinx-astropy cookiecutter gitpython
- name: Generate package
run: |
cd docs ; make html ; cd ..
cookiecutter --no-input ./ -o ./test use_compiled_extensions=y include_example_code=y license=Other --config-file rendered.yml --no-input
cd ./test/packagename
git init
- name: Upload artifact
uses: actions/upload-artifact@v2
if: github.repository == 'astropy/package-template' && github.event_name == 'push'
with:
name: rendered
path: ${{ github.workspace }}/test/packagename/
retention-days: 1