-
Notifications
You must be signed in to change notification settings - Fork 13
124 lines (118 loc) · 3.93 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: CI
on:
push:
pull_request:
schedule:
- cron: "0 4 * * *"
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
egginfo:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install --upgrade tox
- name: egg-info caom2
run: cd caom2 && tox -e egg_info
- name: egg-info caom2utils
run: cd caom2utils && tox -e egg_info
- name: egg-info caom2repo
run: cd caom2repo && 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"]
package: [caom2, caom2utils, caom2repo]
exclude:
# temporary since hdf5 is not working yet
- python-version: "3.11"
package: caom2utils
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: python -m pip install --upgrade tox
- 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@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
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 caom2
run: cd caom2 && tox -e checkstyle && tox -e cov
- name: checkstyle & coverage caom2utils
run: cd caom2utils && tox -e checkstyle && tox -e cov
- name: checkstyle & coverage caom2repo
run: cd caom2repo && tox -e checkstyle && tox -e cov
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
files: ./caom2/coverage.xml,./caom2utils/coverage.xml,./caom2repo/coverage.xml
build-n-publish:
name: Build and publish to PyPI
needs: style_n_coverage
runs-on: ubuntu-latest
if: contains(github.ref, '=')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
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: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_PUBLISH_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH_PWORD }}
run: |
cd ${{ env.repo_name }}
python setup.py sdist bdist_wheel
twine upload --skip-existing dist/*