Skip to content

Commit f5bda9a

Browse files
committed
ci(actions): Replace Travis CI with GitHub Actions workflow
1 parent 19c795d commit f5bda9a

File tree

2 files changed

+122
-96
lines changed

2 files changed

+122
-96
lines changed

.github/workflows/build.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: Build and Test Package
10+
strategy:
11+
matrix:
12+
version:
13+
- '3.8'
14+
- '3.9'
15+
- '3.10'
16+
- '3.11'
17+
- '3.12'
18+
os: [ubuntu-latest, windows-latest]
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.version }}
29+
30+
- name: Install package
31+
run: pip install .
32+
33+
- name: Run tests
34+
run: python -m unittest discover -v
35+
36+
- name: Build documentation
37+
run: |-
38+
mkdir html
39+
git fetch --all
40+
python -I -m sphinx_multiversion -W docs html
41+
42+
- name: Upload the Docs
43+
uses: actions/upload-artifact@v4
44+
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12'
45+
with:
46+
name: docs
47+
path: html/
48+
49+
- name: Install pypa/build
50+
run: pip install build
51+
52+
- name: Build a binary wheel and a source tarball
53+
run: python3 -m build
54+
55+
- name: Store the distribution packages
56+
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12'
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: python-package-distributions
60+
path: dist/
61+
62+
deploy-docs:
63+
name: Deploy Docs to GitHub Pages
64+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
65+
runs-on: ubuntu-latest
66+
needs: [build]
67+
permissions:
68+
pages: write # to deploy to Pages
69+
id-token: write # to verify the deployment originates from an appropriate source
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
78+
with:
79+
artifact_name: docs
80+
81+
deploy-testpypi:
82+
name: Deploy Distribution to Test PyPI
83+
if: false # Currently disabled
84+
needs: [build]
85+
runs-on: ubuntu-latest
86+
environment:
87+
name: testpypi
88+
url: https://test.pypi.org/p/sphinx-multiversion
89+
permissions:
90+
id-token: write
91+
92+
steps:
93+
- name: Download the Distributions
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: python-package-distributions
97+
path: dist/
98+
99+
- name: Publish Distributions to Test PyPI
100+
uses: pypa/gh-action-pypi-publish@release/v1
101+
102+
deploy-pypi:
103+
name: Deploy Distribution to PyPI
104+
if: startsWith(github.ref, 'refs/tags/')
105+
needs: [build]
106+
runs-on: ubuntu-latest
107+
environment:
108+
name: pypi
109+
url: https://pypi.org/p/sphinx-multiversion
110+
permissions:
111+
id-token: write
112+
113+
steps:
114+
- name: Download the Distributions
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: python-package-distributions
118+
path: dist/
119+
120+
- name: Publish Distributions to PyPI
121+
uses: pypa/gh-action-pypi-publish@release/v1
122+

.travis.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)