-
-
Notifications
You must be signed in to change notification settings - Fork 22
168 lines (164 loc) · 5.04 KB
/
lint-test.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: "Lint and Test"
on:
push:
branches:
- '**'
tags:
- '!**'
paths:
- odmpy/**
- tests/**
- '*.py'
- '.*'
- run_tests.sh
- 'requirements*.txt'
- .github/workflows/lint-test.yml
pull_request:
branches:
- '**'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10" , "3.11" ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip -q install -r requirements.txt
pip -q install -r requirements-dev.txt
- name: Compile all
run: |
python -m compileall odmpy tests
- name: Analysing the code with black
run: |
black --check setup.py odmpy tests
# - name: Analysing the code with flake8
# run: |
# flake8 setup.py odmpy tests
- name: Analysing the code with ruff
run: |
ruff check setup.py odmpy tests
# keep pylint until https://github.com/astral-sh/ruff/issues/970
- name: Analysing the code with pylint
run: |
pylint setup.py odmpy tests
- name: Analysing the code with mypy
run: |
mypy --package odmpy --package tests
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [ "3.7", "3.8", "3.9", "3.10" , "3.11" ]
needs: lint
steps:
- uses: FedericoCarboni/setup-ffmpeg@v2
id: setup-ffmpeg
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
# Installing wheel due to https://github.com/pypa/pip/issues/8559
run: |
python3 -m pip -q install --upgrade pip wheel
python3 -m pip -q install -r requirements.txt --upgrade
python3 -m pip -q install -r requirements-dev.txt --upgrade
- name: Run tests on ${{ matrix.os }} with python ${{ matrix.python-version }}
run: |
cd ${GITHUB_WORKSPACE}
sh run_tests.sh
coverage lcov
mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
shell: bash
- name: Test installation process
run: |
python3 setup.py install
odmpy --version
shell: bash
- name: Upload coverage artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-results
path: .coverage.*
retention-days: 1
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
path-to-lcov: "coverage.lcov"
flag-name: run-${{ matrix.os }}-${{ matrix.python-version }}
parallel: true
coverage-report:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install coverage coverage-badge
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 1
path: "source"
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: coverage-results
path: source/
- name: Merge and report
run: |
cd source/
coverage combine && coverage json && python cov2md.py
cat 'coverage.md' >> $GITHUB_STEP_SUMMARY
coverage html -d "$GITHUB_WORKSPACE/coverage/" --precision=1 --title="Coverage Report for ${GITHUB_SHA:0:7}"
coverage-badge -o "$GITHUB_WORKSPACE/coverage/badge.svg" -f
- name: Update coverage html report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/
retention-days: 14
- name: Checkout gh-pages
uses: actions/checkout@v3
if: github.ref == 'refs/heads/master'
with:
ref: "gh-pages"
fetch-depth: 1
path: "pages"
- name: Publish coverage to gh-pages
if: github.ref == 'refs/heads/master'
run: |
cd "$GITHUB_WORKSPACE/pages/"
rm -rf coverage/
rm -f ../coverage/.gitignore
mv ../coverage .
git config user.name github-actions
git config user.email [email protected]
git add -A coverage
git status
if [[ `git status --porcelain --untracked-files=no` ]]; then git commit -m "Updated coverage results from $GITHUB_SHA"; git push; fi