Skip to content

Commit 1873e9a

Browse files
authored
Merge pull request #277 from getyoti/sdk-1853-github-actions
SDK-1853: Add github workflows for tests and sonar
2 parents ae40e85 + 0f18e6e commit 1873e9a

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

.github/workflows/sonar.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sonar Scan
2+
on: [push, pull_request_target]
3+
4+
jobs:
5+
sonar:
6+
name: Sonar Scan
7+
runs-on: ubuntu-latest
8+
# always run on push events
9+
# only run on pull_request_target event when pull request pulls from fork repository
10+
if: >
11+
github.event_name == 'push' ||
12+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/[email protected]
20+
with:
21+
python-version: 3.9
22+
23+
- run: pip install -r requirements.txt
24+
25+
- run: pip install -e .[dev]
26+
27+
- run: pytest --cov=yoti_python_sdk yoti_python_sdk/tests --cov-report=xml:coverage-reports/coverage-new.xml
28+
29+
- run: sed -i 's+<source>.*</source>+<source>/home/travis/build/getyoti/yoti-python-sdk/yoti_python_sdk</source>+g' coverage-reports/coverage-new.xml
30+
31+
- uses: sonarsource/sonarcloud-github-action@master
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
35+

.github/workflows/tests.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Unit Tests
2+
on: [push, pull_request_target]
3+
4+
jobs:
5+
test:
6+
name: Test (Python ${{ matrix.python-version }})
7+
runs-on: ubuntu-latest
8+
# always run on push events
9+
# only run on pull_request_target event when pull request pulls from fork repository
10+
if: >
11+
github.event_name == 'push' ||
12+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [2.7, 3.6, 3.7, 3.8, 3.9, "3.10-dev"]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: actions/[email protected]
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- run: pip install -U setuptools
26+
27+
- run: pip install -r requirements.txt
28+
29+
- run: pip install -e .[dev]
30+
31+
- run: pytest -v
32+
33+
examples:
34+
name: Check Examples
35+
runs-on: ubuntu-latest
36+
if: >
37+
github.event_name == 'push' ||
38+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
43+
- uses: actions/[email protected]
44+
45+
- run: pip install -U setuptools==45
46+
47+
- run: pushd examples/aml && pip install -r requirements.txt && popd
48+
49+
- run: pushd examples/yoti_example_django && pip install -r requirements.txt && popd
50+
51+
- run: pushd examples/yoti_example_flask && pip install -r requirements.txt && popd
52+
53+
- run: pushd examples/doc_scan && pip install -r requirements.txt && popd

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Yoti Python SDK #
22

3-
[![Build Status](https://travis-ci.com/getyoti/yoti-python-sdk.svg?branch=master)](https://travis-ci.com/getyoti/yoti-python-sdk)
3+
[![Build Status](https://github.com/getyoti/yoti-python-sdk/workflows/Unit%20Tests/badge.svg?branch=master)](https://github.com/getyoti/yoti-python-sdk/actions)
44
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Apython&metric=coverage)](https://sonarcloud.io/dashboard?id=getyoti%3Apython)
55
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Apython&metric=bugs)](https://sonarcloud.io/dashboard?id=getyoti%3Apython)
66
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Apython&metric=code_smells)](https://sonarcloud.io/dashboard?id=getyoti%3Apython)

0 commit comments

Comments
 (0)