11name : Test and Deploy
22on :
33 pull_request :
4- branches :
5- - main
6- push :
74 branches :
85 - main
6+ push :
97 create :
108 tags :
119 - ' *'
1210jobs :
1311 check :
1412 runs-on : ubuntu-latest
1513 steps :
16- - uses : actions/checkout@v2
17- - uses : actions/setup-python@v2
14+ - uses : actions/checkout@v3
15+ - uses : actions/setup-python@v4
1816 with :
19- python-version : 3.8
17+ python-version : ' 3.x'
18+ cache : pip
19+ cache-dependency-path : .github/workflows/workflow.yml
2020 - name : Black
2121 run : |
2222 pip install black
2323 black --check --exclude /docs --diff .
2424
25- test-extension :
25+ build-wheel :
2626 runs-on : ubuntu-latest
27+ steps :
28+ - uses : actions/checkout@v3
29+ - name : Set up Python
30+ uses : actions/setup-python@v4
31+ with :
32+ python-version : " 3.7"
33+ cache : pip
34+ cache-dependency-path : |
35+ .github/workflows/workflow.yml
36+ dev-requirements.txt
37+ - name : Install dependencies
38+ run : |
39+ set -xe
40+ python -VV
41+ python -m site
42+ python -m pip install --upgrade pip setuptools wheel
43+ python -m pip install -r dev-requirements.txt
44+ - name : Install package
45+ run : |
46+ python -m pip install .
47+ - name : Build wheel
48+ run : |
49+ python -m pip install build
50+ python -m build
51+ - name : Upload wheel as artifact
52+ uses : actions/upload-artifact@v3
53+ with :
54+ name : my-wheel
55+ path : dist/*.whl
56+
57+ test :
58+ needs : build-wheel
59+ runs-on : ${{ matrix.os }}
2760 strategy :
61+ fail-fast : false
2862 matrix :
29- python-version : ['3.6', '3.7', '3.8', '3.9', 'pypy3']
63+ python-version : ['3.7', '3.8', '3.9', '3.10', '3.11-dev', 'pypy3.8']
64+ sphinx-version : ['>=4,<5', '>=5,<6', '>=6a0,<7']
65+ os : [windows-latest, macos-latest, ubuntu-latest]
66+ exclude :
67+ # Sphinx 6 supports 3.8+
68+ - { python-version: '3.7', sphinx-version: '>=6a0,<7' }
3069 steps :
31- - uses : actions/checkout@v2
32- - name : Setup Python
33- uses : actions/setup-python@v2
70+ - uses : actions/checkout@v3
71+ - name : Set up Python ${{ matrix.python-version }}
72+ uses : actions/setup-python@v4
3473 with :
3574 python-version : ${{ matrix.python-version }}
75+ cache : pip
76+ cache-dependency-path : |
77+ .github/workflows/workflow.yml
78+ dev-requirements.txt
3679 - name : Install dependencies
3780 run : |
38- set -xe
3981 python -VV
4082 python -m site
4183 python -m pip install --upgrade pip setuptools wheel
4284 python -m pip install -r dev-requirements.txt
43- - name : Install Package
85+ python -m pip install "sphinx${{ matrix.sphinx-version }}"
86+ - name : Download wheel artifact
87+ uses : actions/download-artifact@v3
88+ with :
89+ name : my-wheel
90+ path : dist
91+ - name : Install downloaded wheel
4492 run : |
45- python -m pip install .
46- - name : Run Tests for ${{ matrix.python-version }}
93+ python -m pip install dist/sphinxext_opengraph-main-py3-none-any.whl
94+ - name : Run tests for ${{ matrix.python-version }}
4795 run : |
4896 python -m pytest -vv
4997
5098 build-docs :
5199 runs-on : ubuntu-latest
52100 steps :
53- - uses : actions/checkout@v2
101+ - uses : actions/checkout@v3
54102 with :
55103 fetch-depth : 0
56104 - name : Setup Python
57- uses : actions/setup-python@v2
105+ uses : actions/setup-python@v4
106+ with :
107+ python-version : ' 3.x'
108+ cache : pip
109+ cache-dependency-path : docs/requirements.txt
58110 - name : Install dependencies
59111 run : |
60112 pip install -r docs/requirements.txt
@@ -66,23 +118,22 @@ jobs:
66118 pypi-release :
67119 needs : test-extension
68120 runs-on : ubuntu-latest
69- if : contains(github.ref, 'refs/tags/') && github.repository_owner == 'wpilibsuite'
121+ if : contains(github.ref, 'refs/tags/') && github.repository_owner == 'wpilibsuite'
70122 steps :
71- - uses : actions/checkout@v2
123+ - uses : actions/checkout@v3
72124 with :
73125 fetch-depth : 0
74126 - name : Set up Python
75- uses : actions/setup-python@v2
127+ uses : actions/setup-python@v4
76128 with :
77- python-version : ' 3.7'
78- - name : Install Dependencies
79- run : |
80- python -m pip install --upgrade pip
81- pip install -r ./dev-requirements.txt
82- - name : Build PyPI Wheel
83- run : |
84- python setup.py sdist
85- python setup.py bdist_wheel
129+ python-version : ' 3.x'
130+ cache : pip
131+ cache-dependency-path : dev-requirements.txt
132+ - name : Download wheel artifact
133+ uses : actions/download-artifact@v3
134+ with :
135+ name : my-wheel
136+ path : dist
86137 - name : Publish a Python distribution to PyPI
87138 uses : pypa/gh-action-pypi-publish@master
88139 with :
0 commit comments