Skip to content

Commit 3a93d25

Browse files
committed
add Github Actions based CI
1 parent 298159f commit 3a93d25

File tree

2 files changed

+216
-0
lines changed

2 files changed

+216
-0
lines changed

.github/workflows/ci.yml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: GitHub CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- tlslite-ng-0.7
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
# first test on vanilla environments
18+
- os: ubuntu-16.04
19+
python-version: 2.7
20+
- os: ubuntu-18.04
21+
#python-version: 3.3.7
22+
python-version: 3.3
23+
- os: ubuntu-18.04
24+
#python-version: 3.4.10
25+
python-version: 3.4
26+
- os: ubuntu-18.04
27+
python-version: 3.5
28+
- os: ubuntu-18.04
29+
python-version: 3.6
30+
- os: ubuntu-latest
31+
python-version: 3.7
32+
- os: ubuntu-latest
33+
python-version: 3.8
34+
- os: ubuntu-latest
35+
python-version: 3.9
36+
# TODO: make pypy runnable
37+
#- os: ubuntu-latest
38+
# python-version: pypy2
39+
#- os: ubuntu-latest
40+
# python-version: pypy3
41+
# then test with the different optional dependencies installed
42+
- os: ubuntu-latest
43+
python-version: 3.6
44+
opt-deps: ['tackpy']
45+
- os: ubuntu-16.04
46+
python-version: 2.7
47+
opt-deps: ['m2crypto']
48+
- os: ubuntu-latest
49+
python-version: 3.6
50+
opt-deps: ['m2crypto']
51+
- os: ubuntu-latest
52+
python-version: 3.7
53+
opt-deps: ['m2crypto']
54+
- os: ubuntu-latest
55+
python-version: 3.8
56+
opt-deps: ['m2crypto']
57+
- os: ubuntu-latest
58+
python-version: 3.9
59+
opt-deps: ['m2crypto']
60+
- os: ubuntu-latest
61+
python-version: 2.7
62+
opt-deps: ['pycrypto']
63+
- os: ubuntu-latest
64+
python-version: 3.6
65+
opt-deps: ['pycrypto']
66+
- os: ubuntu-latest
67+
# note: 3.7 is the last version where pycrypto is installable
68+
python-version: 3.7
69+
opt-deps: ['pycrypto']
70+
- os: ubuntu-latest
71+
python-version: 3.9
72+
# we don't support pycryptodome, just test that when it's installed
73+
# it doesn't break pycrypto code
74+
opt-deps: ['pycryptodome']
75+
- os: ubuntu-latest
76+
python-version: 2.7
77+
opt-deps: ['gmpy']
78+
- os: ubuntu-latest
79+
python-version: 3.6
80+
opt-deps: ['gmpy']
81+
- os: ubuntu-latest
82+
python-version: 3.7
83+
opt-deps: ['gmpy']
84+
- os: ubuntu-latest
85+
python-version: 3.8
86+
opt-deps: ['gmpy']
87+
- os: ubuntu-latest
88+
python-version: 3.9
89+
opt-deps: ['gmpy']
90+
- os: ubuntu-latest
91+
python-version: 2.7
92+
opt-deps: ['gmpy2']
93+
- os: ubuntu-latest
94+
python-version: 3.6
95+
opt-deps: ['gmpy2']
96+
- os: ubuntu-latest
97+
python-version: 3.7
98+
opt-deps: ['gmpy2']
99+
- os: ubuntu-latest
100+
python-version: 3.8
101+
opt-deps: ['gmpy2']
102+
- os: ubuntu-latest
103+
python-version: 3.9
104+
opt-deps: ['gmpy2']
105+
# finally test with multiple dependencies installed at the same time
106+
- os: ubuntu-latest
107+
python-version: 2.7
108+
opt-deps: ['m2crypto', 'pycrypto', 'gmpy', 'gmpy2']
109+
- os: ubuntu-latest
110+
python-version: 3.6
111+
opt-deps: ['m2crypto', 'pycrypto', 'gmpy', 'gmpy2']
112+
- os: ubuntu-latest
113+
python-version: 3.7
114+
opt-deps: ['m2crypto', 'pycrypto', 'gmpy', 'gmpy2']
115+
- os: ubuntu-latest
116+
python-version: 3.8
117+
opt-deps: ['m2crypto', 'gmpy', 'gmpy2']
118+
- os: ubuntu-latest
119+
python-version: 3.9
120+
# coverage to codeclimate can be submitted just once
121+
opt-deps: ['m2crypto', 'gmpy', 'gmpy2', 'codeclimate']
122+
steps:
123+
- uses: actions/checkout@v2
124+
with:
125+
fetch-depth: 50
126+
- name: Verify git status
127+
run: |
128+
git status
129+
git remote -v
130+
- name: Ensure we have baseline branch for quality coverage
131+
run: git fetch origin master:refs/remotes/origin/master
132+
- name: Set up Python ${{ matrix.python-version }}
133+
uses: actions/setup-python@v2
134+
with:
135+
python-version: ${{ matrix.python-version }}
136+
- name: Display Python version
137+
run: python -c "import sys; print(sys.version)"
138+
- name: Display installed python package versions
139+
run: pip list
140+
- name: Ensure working pip on 3.3
141+
#if: ${{ matrix.python-version == '3.3.7' }}
142+
if: ${{ matrix.python-version == '3.3' }}
143+
run: |
144+
curl -o get-pip.py https://bootstrap.pypa.io/3.3/get-pip.py;
145+
python get-pip.py
146+
- name: Install M2Crypto
147+
if: ${{ contains(matrix.opt-deps, 'm2crypto') }}
148+
run: pip install --pre m2crypto
149+
- name: Install tackpy
150+
if: ${{ contains(matrix.opt-deps, 'tackpy') }}
151+
run: pip install tackpy
152+
- name: Install pycrypto
153+
if: ${{ contains(matrix.opt-deps, 'pycrypto') }}
154+
run: pip install pycrypto
155+
- name: Install pycryptodome
156+
if: ${{ contains(matrix.opt-deps, 'pycryptodome') }}
157+
run: pip install pycryptodome
158+
- name: Install gmpy
159+
if: ${{ contains(matrix.opt-deps, 'gmpy') }}
160+
run: pip install gmpy
161+
- name: Install gmpy2 dependencies
162+
if: ${{ contains(matrix.opt-deps, 'gmpy2') }}
163+
run: sudo apt-get install -y libmpfr-dev libmpc-dev
164+
- name: Install gmpy2
165+
if: ${{ contains(matrix.opt-deps, 'gmpy2') }}
166+
run: pip install gmpy2
167+
- name: Install build dependencies
168+
run: |
169+
if [[ -e build-requirements-${{ matrix.python-version }}.txt ]]; then
170+
pip install -r build-requirements-${{ matrix.python-version }}.txt;
171+
else
172+
pip install -r build-requirements.txt;
173+
fi
174+
- name: Install dependencies
175+
run: pip install -r requirements.txt
176+
- name: Display installed python package versions
177+
run: pip list
178+
- name: Prepare Codeclimate environment
179+
if: ${{ contains(matrix.opt-deps, 'codeclimate') }}
180+
env:
181+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
182+
run: |
183+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
184+
chmod +x ./cc-test-reporter
185+
./cc-test-reporter before-build
186+
- name: Run unit tests
187+
run: coverage run --branch --source tlslite -m unittest discover
188+
- name: Run connection tests
189+
run: make test-local
190+
- name: Combine coverage from both test suites
191+
run: |
192+
coverage combine --append
193+
coverage report -m
194+
195+
- name: Verify instability
196+
run: ./setup.py install
197+
- name: Verify install
198+
run: make test
199+
- name: Lint the code
200+
run: |
201+
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" tlslite > pylint_report.txt || :
202+
diff-quality --violations=pylint --fail-under=90 pylint_report.txt
203+
204+
- name: Publish coverage to Coveralls
205+
env:
206+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
207+
run: coveralls
208+
- name: Publish coverage to Codeclimate
209+
if: ${{ contains(matrix.opt-deps, 'codeclimate') }}
210+
env:
211+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
212+
run: |
213+
coverage xml
214+
./cc-test-reporter after-build

build-requirements-3.3.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
six>=1.10.0
12
enum34
23
coverage<5.0
34
hypothesis<3.44
@@ -7,3 +8,4 @@ diff_cover<2.5.0
78
typed-ast<1.3.0
89
inflect<4.0.0
910
typing<3.7.4
11+
isort==4.2.5

0 commit comments

Comments
 (0)