-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (132 loc) · 3.96 KB
/
main.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Derived from https://github.com/jaraco/skeleton/blob/ab34814ca3ffe511ad63bb9589da06fd76758db8/.github/workflows/main.yml
name: tests
on:
workflow_call:
secrets:
PYPI_TOKEN:
required: false
permissions:
contents: read
defaults:
run:
shell: bash
env:
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1
# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
jobs:
test:
strategy:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
fail-fast: false
matrix:
python:
- "3.9"
- "3.13"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- python: "3.10"
platform: ubuntu-latest
- python: "3.11"
platform: ubuntu-latest
- python: "3.12"
platform: ubuntu-latest
- python: "3.14"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.14' }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install wget (Windows only)
if: runner.os == 'Windows'
run: choco install wget -y
- name: Workaround pypa/pipx#1539
run: wget https://raw.githubusercontent.com/jaraco/pipx-1539/main/workaround-1539.py -O - | python3
- name: Run tests for ${{ matrix.python }} (${{ runner.os }})
run: pipx run --python ${{ matrix.python }} 'coherent.test>=0.7.0'
env:
# See coherent-oss/coherent.build#21
GH_TOKEN: ${{ github.token }}
# diffcov--commented out and worked on in a different branch
# see coherent-oss/system#2
# diffcov:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.x
# - run: |
# set -euxo pipefail
# pipx run --pip-args pytest-cov 'coherent.test>=0.7.0' --cov --cov-report xml
# pip install diff-cover
# diff-cover coverage.xml --compare-branch=origin/main --html-report diffcov.html
# diff-cover coverage.xml --compare-branch=origin/main --fail-under=100
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Skip or build with Sphinx
run: |
set -euxo pipefail
cd docs || exit 0
pip install sphinx jaraco.packaging rst.linker furo sphinx-lint jaraco.tidelift
python -m sphinx -W --keep-going . ./build/html
python -m sphinxlint
env:
# token is required for `gh` to resolve metadata
GH_TOKEN: ${{ github.token }}
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- test
- docs
# - diffcov
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
release:
permissions:
contents: write
needs:
- check
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Build and upload to PyPI
run: |
pipx run coherent.cli build
pipx run twine upload dist/*
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
GH_TOKEN: ${{ github.token }}