-
Notifications
You must be signed in to change notification settings - Fork 18
109 lines (104 loc) · 3.39 KB
/
cibuild.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
name: CI
on:
push:
pull_request:
schedule:
- cron: "0 4 * * *"
release:
types: [created]
jobs:
egginfo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install --upgrade tox
- name: egg-info vos
run: cd vos && tox -e egg_info
tests:
needs: egginfo
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
package: [vos]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
# pytest-runner required to support deprecated Python3.5
run: python -m pip install --upgrade tox pytest-runner
- name: Test ${{ matrix.package }}
run: |
# add py and remove the "." from python-version in order to get the tox_target
tox_target=$(echo py${{matrix.python-version}} | sed 's/\.//')
echo "Tox target: " $tox_target
cd ${{ matrix.package }} && tox -e $tox_target
style_n_coverage:
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install tox
run: python -m pip install --upgrade tox
- name: checkstyle & coverage vos
run: cd vos && tox -e checkstyle && tox -e cov
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
files: ./vos/coverage.xml
build-n-publish:
name: Build and publish to PyPI
needs: style_n_coverage
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
if: contains(github.ref, '=')
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Determine the package
run: |
echo ${GITHUB_REF#refs/*/}
echo "repo_name=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $1}')" >> $GITHUB_ENV
echo "repo_version=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $2}')" >> $GITHUB_ENV
- name: Check version is valid
run: |
echo ${{ env.repo_name }}
echo ${{ env.repo_version }}
cd ${{ env.repo_name }} || (echo "Invalid release tag. Repo not found: ${{ env.repo_name }}" && exit -1)
sed 's/ //g' setup.cfg | grep "^version=${{ env.repo_version }}" || (echo "Version in tag ${{ env.repo_version }} does not match version in setup.cfg" && exit -1)
- name: Install dependencies
run: |
cd ${{ env.repo_name }}
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Install package
run: |
cd ${{ env.repo_name }}
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ env.repo_name }}/dist/