-
Notifications
You must be signed in to change notification settings - Fork 113
133 lines (115 loc) · 3.47 KB
/
ci-cd.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
name: CI/CD Pipeline
on: [ push, pull_request, workflow_dispatch ]
env:
PIP_CACHE_DIR: /tmp/pipcache
HOME_REPO: thebjorn/pydeps
jobs:
ci-lint:
name: CI:Lint
runs-on: ubuntu-latest
env:
LINTDIR: ./ghlint
steps:
# setup environment
- uses: actions/checkout@v4
- name: setup directories
shell: bash
run: |
mkdir -p $PIP_CACHE_DIR
mkdir -p $LINTDIR
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- run: pip install flake8
- run: flake8 pydeps/** --max-line-length=199 --exit-zero --exclude mf
docs:
name: CI:Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: setup directories
shell: bash
run: |
mkdir -p build
- run: pip install sphinx
- run: pip install -e .
- run: sphinx-build -W -b html docs build/sphinx/html
- run: sphinx-build -W -n -T -b man docs build/sphinx/man
- name: Upload docs as artifact
uses: actions/upload-artifact@v3
with:
name: Docs
path: build/sphinx/
ci-test:
name: CI:Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
os: [ubuntu-latest]
include:
- python-version: '3.9'
os: windows-latest
# macos is just waay too slow...
# - python-version: '3.9'
# os: macos-latest
steps:
# setup environment
- uses: actions/checkout@v4
- uses: ts-graphviz/setup-graphviz@v1
- name: setup global directories
shell: bash
run: mkdir -p $PIP_CACHE_DIR
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
- run: pip list
- run: pytest -vv --cov=pydeps --cov-report=xml tests
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN}}
fail_ci_if_error: false
cd:
name: CD
needs: ci-test
runs-on: ubuntu-latest
steps:
# setup environment
- uses: actions/checkout@v4
- name: setup directories
shell: bash
run: mkdir -p $PIP_CACHE_DIR
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Cleanup
run: |
rm -rf dist
rm -rf build
- run: pip install -U build twine
- run: python -m build
- name: Upload packages as artifact
uses: actions/upload-artifact@v3
with:
name: Packages
path: dist/
- name: Deploy to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO
shell: bash
run: |
twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/*
- name: Create Github release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO
with:
artifacts: "dist/*"
owner: thebjorn
repo: pydeps
token: ${{ secrets.GITHUB_TOKEN }}
# Initial version With help from:
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)