Skip to content

Commit fbf242c

Browse files
authored
Merge pull request #41 from saimn/actions
Setup publish and tests on Actions
2 parents 3703265 + f479262 commit fbf242c

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python 🐍 distributions 📦 to PyPI
12+
runs-on: ubuntu-latest
13+
if: github.repository == 'astropy/pytest-doctestplus'
14+
if: (github.repository == 'astropy/sphinx-astropy' && (github.event_name == 'tags' || contains(github.event.pull_request.labels.*.name, 'Build wheels')))
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.8
23+
24+
- name: Install python-build and twine
25+
run: python -m pip install build "twine>=3.3"
26+
27+
- name: Build package
28+
run: python -m build --sdist --wheel .
29+
30+
- name: List result
31+
run: ls -l dist
32+
33+
- name: Check long_description
34+
run: python -m twine check --strict dist/*
35+
36+
- name: Test package
37+
run: |
38+
cd ..
39+
python -m venv testenv
40+
testenv/bin/pip install pytest sphinx-astropy/dist/*.whl
41+
testenv/bin/pytest sphinx-astropy/tests
42+
43+
- name: Publish distribution 📦 to PyPI
44+
if: startsWith(github.ref, 'refs/tags')
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
with:
47+
user: __token__
48+
password: ${{ secrets.pypi_password }}

.github/workflows/python-tests.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Run unit tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
tags:
8+
workflow_dispatch:
9+
schedule:
10+
# Run every Sunday at 03:53 UTC
11+
- cron: 53 2 * * 0
12+
13+
jobs:
14+
tests:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
python-version: 3.7
22+
toxenv: py36-test-sphinx17
23+
- os: windows-latest
24+
python-version: 3.7
25+
toxenv: py36-test-sphinx18
26+
- os: macos-latest
27+
python-version: 3.7
28+
toxenv: py37-test-sphinx20
29+
- os: ubuntu-latest
30+
python-version: 3.8
31+
toxenv: py37-test-sphinx24
32+
- os: windows-latest
33+
python-version: 3.8
34+
toxenv: py38-test-sphinx30
35+
- os: ubuntu-latest
36+
python-version: 3.9
37+
toxenv: py38-test-sphinx35
38+
- os: ubuntu-latest
39+
python-version: 3.9
40+
toxenv: py39-test-sphinx40
41+
- os: macos-latest
42+
python-version: 3.9
43+
toxenv: py38-test-sphinxdev
44+
45+
steps:
46+
- uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 0
49+
- name: Set up Python ${{ matrix.python-version }}
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
- name: Install Tox
54+
run: python -m pip install tox
55+
- name: Run Tox
56+
run: tox -v -e ${{ matrix.toxenv }}
57+
58+
# - name: Slack Notification
59+
# uses: 8398a7/action-slack@v3
60+
# with:
61+
# status: ${{ job.status }}
62+
# env:
63+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
64+
# if: always() # TODO: cron

tox.ini

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[tox]
2+
envlist =
3+
py{37,38,39}-test
4+
codestyle
5+
requires =
6+
setuptools >= 30.3.0
7+
pip >= 19.3.1
8+
isolated_build = true
9+
10+
[testenv]
11+
changedir = .tmp/{envname}
12+
description = run tests
13+
deps =
14+
sphinx17: sphinx==1.7.*
15+
sphinx18: sphinx==1.8.*
16+
sphinx20: sphinx==2.0.*
17+
sphinx24: sphinx==2.4.*
18+
sphinx30: sphinx==3.0.*
19+
sphinx35: sphinx==3.5.*
20+
sphinx40: sphinx==4.0.*
21+
sphinxdev: git+https://github.com/sphinx-doc/sphinx#egg=sphinx
22+
23+
commands =
24+
pip freeze
25+
pytest {toxinidir}/tests {posargs}
26+
27+
[testenv:codestyle]
28+
changedir =
29+
skip_install = true
30+
description = check code style, e.g. with flake8
31+
deps = flake8
32+
commands = flake8 sphinx_astropy --count

0 commit comments

Comments
 (0)