Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Add option to use GitHub Actions for CI #449

Merged
merged 35 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8b1a5d7
add github actions workflow configuration to the template and add a q…
tepickering Feb 21, 2020
7b3f717
flesh out comments in workflow config file
tepickering Feb 21, 2020
95bce37
fix to only use var from tox-env since tox is smart enough to figure …
tepickering Feb 21, 2020
9d3c29d
don't install numpy in actions, let tox handle it. need to specify th…
tepickering Feb 21, 2020
070f212
remove oldestdeps from env list. update step name.
tepickering Feb 21, 2020
16d329b
add note to template_changes; tell cookiecutter to not render anythin…
tepickering Feb 21, 2020
7e8bf28
add coverage command to tox.ini to create xml output appropriate for …
tepickering Jun 8, 2020
6e44fb1
remove python36 from actions matrix; update actions to use v2 for che…
tepickering Jun 8, 2020
334e177
remove redundant step in actions doc_test
tepickering Jun 9, 2020
18fbe15
add build_docs back as a separate step in the actions workflow
tepickering Jun 9, 2020
5664926
merge upstream changes; fix conflict in TEMPLATE_CHANGES.md
tepickering Nov 16, 2020
90c6fd0
remove travis config
tepickering Nov 16, 2020
e104a31
edit TEMPLATE_CHANGES to more clearly reflect move to Actions for all…
tepickering Nov 16, 2020
64f7fdb
renameactions ci workflow to be more generalized
tepickering Nov 16, 2020
17c03c0
add scheduled weekly test to check documentation links
tepickering Nov 16, 2020
f8c8971
refactor core ci workflow to more closely match what is now used in a…
tepickering Nov 16, 2020
e7d866b
remove more references to travis; add .vscode to .gitignore
tepickering Nov 16, 2020
322683b
remove travis question from cookiecutter.json
tepickering Nov 17, 2020
6e8ca55
Revert "remove more references to travis; add .vscode to .gitignore"
tepickering Nov 17, 2020
c0e1aaf
remove reference to travis in QUESTIONS.rst
tepickering Nov 17, 2020
95675a9
remove reference to travis in rendered.yml
tepickering Nov 17, 2020
026de85
comment out section for uploading to codecov in the default workflow …
tepickering Nov 17, 2020
8497d53
expunge travis bit in post_gen_project.py
tepickering Nov 17, 2020
fa6fa76
update docs to reflect the move from travis to github actions as the …
tepickering Nov 17, 2020
677370c
bump supported python versions up a notch. include 3.9 for future-pro…
tepickering Nov 17, 2020
da62bd1
fix typos in ape17.rst
tepickering Nov 17, 2020
d92e94d
fix typos in nextsteps.rst
tepickering Nov 17, 2020
f5fde9e
fix post_gen_project.py to only remove the template workflows
tepickering Nov 17, 2020
40833b3
include fix from astropy/astropy#11054 to prevent double-runs when PR…
tepickering Nov 17, 2020
7caea3c
change coverage step to use contains instead of endsWith
tepickering Nov 17, 2020
2fc7f51
change master to main to reflect new github default; add commented bi…
tepickering Nov 17, 2020
3b016ec
more changes to reflect github's change to main as the default branch…
tepickering Nov 17, 2020
0e47911
add PR number for migration away from travis in template
tepickering Nov 17, 2020
88a818e
flesh out some comments in the ci_tests.yml workflow
tepickering Nov 17, 2020
fd8a4d3
fix some grammer and spelling
tepickering Nov 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions QUESTIONS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ a description of each of the prompts.
10. ``edit_on_github_extension``: Set to ``True`` to enable the edit on GitHub sphinx extension.
11. ``github_project``: This is the GitHub identifier for the edit on GitHub extension and the changelog link extension.
12. ``use_travis_ci``: If ``'y'`` the template will include an example ``.travis.yml`` file for the Travis CI service.
13. ``use_read_the_docs``: If ``'y'`` the ``read_the_docs.yml`` and ``.rtd-environment.yml`` files will be included for using conda on Read the Docs.
14. ``sphinx_theme``: The value of the ``html_theme`` variable in the sphinx configuration file.
15. ``required_dependencies``: Comma-separated list of required dependencies
16. ``optional_dependencies``: Comma-separated list of optional dependencies
17. ``minimum_python_version``: Version string of minimum supported Python version
13. ``use_gh_actions``: If ``'y'`` the template will include an example ``.github/workflows/tox-tests.yml`` file for the Github Actions CI service.
14. ``use_read_the_docs``: If ``'y'`` the ``read_the_docs.yml`` and ``.rtd-environment.yml`` files will be included for using conda on Read the Docs.
15. ``sphinx_theme``: The value of the ``html_theme`` variable in the sphinx configuration file.
16. ``required_dependencies``: Comma-separated list of required dependencies
17. ``optional_dependencies``: Comma-separated list of optional dependencies
18. ``minimum_python_version``: Version string of minimum supported Python version
3 changes: 3 additions & 0 deletions TEMPLATE_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ be copied over manually if desired.
- Refactored the template to follow the recommendations in APE 17:
https://github.com/astropy/astropy-APEs/blob/master/APE17.rst [#438]

- Add option to use Github Actions for CI.


2.1 (unreleased)
----------------

Expand Down
6 changes: 5 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
"edit_on_github_extension": "False",
"github_project": "astropy/astropy",
"use_travis_ci": "y",
"use_gh_actions": "y",
"use_read_the_docs": "y",
"sphinx_theme": "astropy-bootstrap",
"_parent_project": "astropy",
"required_dependencies": "astropy",
"optional_dependencies": "",
"minimum_python_version": ["3.6", "3.7", "3.8"]
"minimum_python_version": ["3.6", "3.7", "3.8"],
tepickering marked this conversation as resolved.
Show resolved Hide resolved
"_copy_without_render": [
".github"
]
}
1 change: 1 addition & 0 deletions docs/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ a description of each of the prompts:
#. ``edit_on_github_extension``: Set to ``True`` to enable the edit on GitHub sphinx extension.
#. ``github_project``: This is the GitHub identifier for the edit on GitHub extension and the changelog link extension.
#. ``use_travis_ci``: If ``'y'`` the template will include an example ``.travis.yml`` file for the Travis CI service.
#. ``use_gh_actions``: If ``'y'`` the template will include an example ``.github/workflows/tox-tests.yml`` file for the Github Actions CI service.
tepickering marked this conversation as resolved.
Show resolved Hide resolved
#. ``use_read_the_docs``: If ``'y'`` the ``read_the_docs.yml`` and ``.rtd-environment.yml`` files will be included for using conda on Read the Docs.
#. ``sphinx_theme``: The value of the ``html_theme`` variable in the sphinx configuration file.
#. ``required_dependencies``: Comma-separated list of required dependencies
Expand Down
3 changes: 3 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def process_licence(licence_name):
if '{{ cookiecutter.use_travis_ci }}' != 'y':
remove_file('.travis.yml')

if '{{ cookiecutter.use_gh_actions }}' != 'y':
remove_dir('.github')
tepickering marked this conversation as resolved.
Show resolved Hide resolved

if '{{ cookiecutter.use_read_the_docs }}' != 'y':
remove_file('.rtd-environment.yml')
remove_file('readthedocs.yml')
Expand Down
1 change: 1 addition & 0 deletions rendered.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ default_context:
edit_on_github_extension: "False"
github_project: "astropy/astropy"
use_travis_ci: "y"
use_gh_actions: "y"
use_read_the_docs: "y"
sphinx_theme: "astropy-bootstrap"
minimum_python_version: "3.6"
Expand Down
104 changes: 104 additions & 0 deletions {{ cookiecutter.package_name }}/.github/workflows/tox-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# GitHub Actions workflow for testing and continuous integration.
#
# This file performs testing using tox and tox.ini to define and configure the test environments.

name: Python Tests

on: [push, pull_request]
tepickering marked this conversation as resolved.
Show resolved Hide resolved

jobs:

# Set up matrix to run tox tests across lists of os, python version, and tox environment
matrix_tests:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')" # github actions doesn't yet support this natively so add here
tepickering marked this conversation as resolved.
Show resolved Hide resolved
strategy:
matrix:
# Github actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Only run on ubuntu by default, but can add other os's to the test matrix here.
# For example -- os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]

# Test python 3.7 and 3.8 by default.
python-ver: [7, 8]
tepickering marked this conversation as resolved.
Show resolved Hide resolved

# Specify which tox environments to test in this list.
tox-env: [cov, alldeps, devdeps, astropylts]
steps:
- uses: actions/checkout@v2
tepickering marked this conversation as resolved.
Show resolved Hide resolved
- name: Set up python 3.${{ matrix.python-ver }} with tox environment py3${{ matrix.python-ver }}-${{ matrix.tox-env }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: 3.${{ matrix.python-ver }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e py3${{ matrix.python-ver }}-${{ matrix.tox-env }}
#
# # This is an example of how to upload coverage to codecov
# - name: Upload coverage to codecov
# if: matrix.tox-env == 'cov' && matrix.python-ver == '8'
tepickering marked this conversation as resolved.
Show resolved Hide resolved
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV }}
# file: ./coverage.xml
# fail_ci_if_error: true

# Test building of documents
doc_build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Set up Python to build docs with sphinx
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Testing building of docs using tox
run: |
tox -e build_docs
tepickering marked this conversation as resolved.
Show resolved Hide resolved

# Test links in documents
doc_test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Set up Python to build docs with sphinx
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Check links in docs using tox
run: |
tox -e linkcheck
tepickering marked this conversation as resolved.
Show resolved Hide resolved

# Perform codestyle check
codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Python codestyle check
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Check codestyle using tox
run: |
tox -e codestyle
2 changes: 2 additions & 0 deletions {{ cookiecutter.package_name }}/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ description =
# The following provides some specific pinnings for key packages
deps =

cov: coverage
numpy116: numpy==1.16.*
numpy117: numpy==1.17.*
numpy118: numpy==1.18.*
Expand All @@ -63,6 +64,7 @@ commands =
pip freeze
!cov: pytest --pyargs {{ cookiecutter.module_name }} {toxinidir}/docs {posargs}
cov: pytest --pyargs {{ cookiecutter.module_name }} {toxinidir}/docs --cov {{ cookiecutter.module_name }} --cov-config={toxinidir}/setup.cfg {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml

[testenv:build_docs]
changedir = docs
Expand Down