-
Notifications
You must be signed in to change notification settings - Fork 9
135 lines (130 loc) · 4.4 KB
/
composed-tox-sonar-cloud.yaml
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
---
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2023 The Linux Foundation
name: Composed Tox Sonar Cloud
# yamllint disable-line rule:truthy
on:
workflow_call:
inputs:
GERRIT_BRANCH:
description: "Branch that change is against"
required: true
type: string
GERRIT_CHANGE_ID:
description: "The ID for the change"
required: true
type: string
GERRIT_CHANGE_NUMBER:
description: "The Gerrit number"
required: true
type: string
GERRIT_CHANGE_URL:
description: "URL to the change"
required: true
type: string
GERRIT_EVENT_TYPE:
description: "Type of Gerrit event"
required: true
type: string
GERRIT_PATCHSET_NUMBER:
description: "The patch number for the change"
required: true
type: string
GERRIT_PATCHSET_REVISION:
description: "The revision sha"
required: true
type: string
GERRIT_PROJECT:
description: "Project in Gerrit"
required: true
type: string
GERRIT_REFSPEC:
description: "Gerrit refspec of change"
required: true
type: string
SONAR_ARGS:
description: "Additional arguments to the SonarCloud scanner"
required: false
type: string
default: ""
SONAR_PROJECTBASEDIR:
description: "Set the sonar.projectBaseDir analysis property"
required: false
type: string
default: .
TOX_DIR:
description: "Directory containing tox.ini file"
required: false
default: "."
type: string
TOX_ENVS:
description: >
List of envs to run. These MUST be passed as a string representing
a list of strings, e.g.:
'["lint", "build"]'
required: true
type: string
PYTHON_VERSION:
description: "Version of python to use"
required: false
default: "3.12"
type: string
PARALLEL:
description: "Whether to run jobs in parallel"
required: false
type: string
PRE_BUILD_SCRIPT:
description: "Pre-build script to trigger before verify run"
required: false
default: ""
type: string
PRE_BUILD_SCRIPT_PATH:
description: "Path to pre-build script to trigger before verify run"
required: false
default: ""
type: string
PRE_BUILD_SCRIPT_URL:
description: "URL of pre-build script to trigger before verify run"
required: false
default: ""
type: string
secrets:
SONAR_TOKEN:
description: "Sonar Cloud access token"
required: true
concurrency:
# yamllint disable-line rule:line-length
group: composed-tox-sonar-cloud-${{ github.workflow }}-${{ github.event.inputs.GERRIT_BRANCH}}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
cancel-in-progress: true
jobs:
run-tox-sonar-cloud-scan:
runs-on: ubuntu-latest
steps:
- name: Run tox verify
id: tox-verify
# yamllint disable-line rule:line-length
uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-tox-verify.yaml@main
with:
GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
TOX_DIR: ${{ inputs.TOX_DIR }}
TOX_ENVS: ${{ inputs.TOX_ENVS }}
PYTHON_VERSION: ${{ inputs.PYTHON_VERSION }}
PARALLEL: ${{ inputs.PARALLEL }}
PRE_BUILD_SCRIPT: ${{ inputs.PRE_BUILD_SCRIPT }}
PRE_BUILD_SCRIPT_PATH: ${{ inputs.PRE_BUILD_SCRIPT_PATH }}
PRE_BUILD_SCRIPT_URL: ${{ inputs. PRE_BUILD_SCRIPT_URL }}
- name: Run Sonar Cloud scan
uses: sonarsource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: ${{ inputs.SONAR_ARGS }}
projectBaseDir: ${{ inputs.SONAR_PROJECTBASEDIR }}