Repository navigation
135 lines (132 loc) · 5.12 KB
/
Copy pathci.yml
File metadata and controls
135 lines (132 loc) · 5.12 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
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
---
name: CI
# yamllint disable-line rule:truthy
on:
push:
branches: [master]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
permissions: {}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
strategy:
fail-fast: false
matrix:
include:
- folder: components/collector
name: components-collector
language: python
- folder: components/notifier
name: components-notifier
language: python
- folder: components/api_server
name: components-api_server
language: python
- folder: components/shared_code
name: components-shared_code
language: python
- folder: components/frontend
name: components-frontend
language: js
- folder: components/renderer
name: components-renderer
language: js
- folder: tools/just
name: tools-just
language: python
- folder: tools/release
name: tools-release
language: python
- folder: tools/third_party
name: tools-third_party
language: python
- folder: tests/application_tests
name: tests-application_tests
language: python
- folder: tests/feature_tests
name: tests-feature_tests
language: python
- folder: tests/shared_test_code
name: tests-shared_test_code
language: python
- folder: .
name: root
language: misc
steps:
- name: Login to DockerHub
if: env.SONAR_TOKEN != null
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
version-file: tools/third_party/pyproject.toml
- name: Setup Node.js
if: matrix.language == 'js'
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: ${{ matrix.folder }}/package.json
- name: Run tests and quality checks
run: uv tool run --directory ${{ matrix.folder }} --from $(uv export --project tools/third_party --only-group just --quiet --no-hashes --no-header) just ci # yamllint disable-line rule:line-length
- name: Upload build artifacts
if: env.SONAR_TOKEN != null
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: sonar-${{ matrix.name }}
path: ${{ matrix.folder }}/build
if-no-files-found: ignore
retention-days: 1
scan:
needs: test
runs-on: ubuntu-latest
permissions: {}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: env.SONAR_TOKEN != null
with:
fetch-depth: 0 # Disabling shallow clone is recommended for improving relevancy of reporting
persist-credentials: false
- name: Download build artifacts
if: env.SONAR_TOKEN != null
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: artifacts
pattern: sonar-*
- name: Restore artifacts to component build directories
if: env.SONAR_TOKEN != null
# yamllint disable rule:line-length
run: |
for dir in components/api_server components/collector components/notifier components/shared_code components/frontend components/renderer tools/just tools/release; do
mkdir -p $dir/build
cp -r artifacts/sonar-${dir//\//-}/. $dir/build/
done
# yamllint enable rule:line-length
- name: Create packages
if: env.SONAR_TOKEN != null
# yamllint disable rule:line-length
run: |
touch components/__init__.py
touch tools/__init__.py
for dir in components/api_server components/collector components/notifier components/shared_code tools/just tools/release; do
touch $dir/__init__.py
touch $dir/src/__init__.py
sed --in-place "s#name=\"\([^\"]*\)\" filename=\"\([^\"]*\)\"#name=\"$GITHUB_WORKSPACE/$dir/\2\" filename=\"$GITHUB_WORKSPACE/$dir/\2\"#g" $dir/build/unittest-coverage.xml
sed --in-place "s#file=\"#file=\"$GITHUB_WORKSPACE/$dir/#g" $dir/build/unittests.xml
sed --in-place "s#classname=\"#classname=\"${dir//\//-}.#g" $dir/build/unittests.xml
done
# yamllint enable rule:line-length
- name: Sonarcloud scan
if: env.SONAR_TOKEN != null
uses: sonarsource/sonarqube-scan-action@4d1dc0c91ee400dcf8a6dddf2f705ac36542e304 # v8.4.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}