-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (89 loc) · 3.08 KB
/
Copy pathpython.release.yaml
File metadata and controls
99 lines (89 loc) · 3.08 KB
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
name: Test and release
on:
workflow_call:
secrets:
# required when `sonarCloudEnabled`
SONAR_TOKEN:
required: false
inputs:
#
# Technical
#
os:
description: "Operating system e.g. ubuntu-22.04"
type: string
default: ubuntu-22.04
pythonVersion:
description: "Python version"
type: string
default: "3.11"
#
# Testing
#
prepareCmd:
description: "Preparation command. Defaults to pipenv installation (skipped if empty)"
type: string
default: "python -m pip install --upgrade pipenv wheel"
testCmd:
description: "Test command (skipped if empty)"
type: string
default: "make test"
#
# Tests reporting
#
testReportEnabled:
type: boolean
default: false
testReportPattern:
type: string
default: "junit.xml"
coverageReportEnabled:
type: boolean
default: false
coverageReportPath:
type: string
default: "coverage.out"
sonarCloudEnabled:
type: boolean
default: false
jobs:
build-and-test:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare Python
uses: actions/setup-python@v3
with:
python-version: "${{ inputs.pythonVersion }}"
architecture: "x64"
- name: Prepare
if: "${{ inputs.prepareCmd }} != ''"
run: "${{ inputs.prepareCmd }}"
- name: Test
if: "${{ inputs.testCmd }} != ''"
run: "${{ inputs.testCmd }}"
#
# Reporting
#
- name: Test report
if: always() && inputs.testReportEnabled
uses: phoenix-actions/test-reporting@v8
with:
name: Tests
path: ${{ inputs.testReportPattern }}
reporter: java-junit
- name: Coverage report
if: always() && ! contains(github.event.pull_request.user.login, 'dependabot[bot]') && inputs.coverageReportEnabled
uses: slavcodev/coverage-monitor-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: ${{ inputs.coverageReportPath }}
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: github.ref == 'refs/heads/main' && inputs.sonarCloudEnabled
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}