-
Notifications
You must be signed in to change notification settings - Fork 53
130 lines (107 loc) · 3.8 KB
/
unit.yaml
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
name: Unit tests and release
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
unit_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Re-enable 3.13-dev when https://github.com/zopefoundation/zope.interface/issues/292 is fixed
python-version: [pypy-3.7, 3.7, 3.8, 3.9, '3.10', 3.11, '3.12']
os: [ubuntu-22.04]
include:
- os: windows-latest
python-version: 3.11
- os: macos-latest
python-version: 3.11
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install --upgrade pip tox
- name: Log system information
run: |
test -r /etc/os-release && sh -c '. /etc/os-release && echo "OS: $PRETTY_NAME"'
python --version
python -c "print('\nENVIRONMENT VARIABLES\n=====================\n')"
python -c "import os; [print(f'{k}={v}') for k, v in os.environ.items()]"
- name: Run unit tests
run: |
tox -e test
- name: Run unit tests with latest Twisted version (only for python 3.8 and later)
if: matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.7'
run: |
tox -e test-latest-twisted
- name: Publish code coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
name: unit-${{ matrix.os }}-${{matrix.python-version}}
# Check the secret defined in GHA here
# https://github.com/twisted/pydoctor/settings/secrets/actions
# And get it from Codecov.io here
# https://app.codecov.io/gh/twisted/pydoctor/settings
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
release:
needs: [unit_tests]
runs-on: ubuntu-latest
permissions:
contents: read
# The `id-token` permission is mandatory for trusted publishing
# See https://github.com/pypa/gh-action-pypi-publish
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Log system information
run: |
test -r /etc/os-release && sh -c '. /etc/os-release && echo "OS: $PRETTY_NAME"'
python --version
python -c "print('\nENVIRONMENT VARIABLES\n=====================\n')"
python -c "import os; [print(f'{k}={v}') for k, v in os.environ.items()]"
- name: Install deps
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Build pydoctor
run: |
python setup.py --quiet build check sdist bdist_wheel
ls -alh ./dist/
- name: Publish to PyPI - on tag
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
# This is a meta-job to simplify PR CI enforcement configuration in GitHub.
# Inside the GitHub config UI you only configure this job as required.
# All the extra requirements are defined "as code" as part of the `needs`
# list for this job.
gha-required:
name: GHA Required
runs-on: ubuntu-latest
# The `if` condition is very important.
# If not set, the job will be skipped on failing dependencies.
if: ${{ !cancelled() }}
needs:
# This is the list of CI job that we are interested to pass before
# a merge.
# pypi-publish is skipped since this is only executed for a tag.
- unit_tests
steps:
- name: Require all successes
uses: re-actors/alls-green@3a2de129f0713010a71314c74e33c0e3ef90e696
with:
jobs: ${{ toJSON(needs) }}