11
11
POETRY_VIRTUALENVS_PATH : " ~/.cache/poetry/venvs"
12
12
POETRY_CACHE_DIR : " ~/.cache/poetry/pypoetry"
13
13
SONARQUBE_VERSION : 25.3.0.104237
14
+ # Use bash (instead of sh on linux or cmd.exe on windows)
15
+ CIRRUS_SHELL : bash
14
16
15
17
only_if : $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == 'master' || $CIRRUS_BRANCH =~ "branch-.*")
16
- container_definition : &CONTAINER_DEFINITION
18
+ linux_container_definition : &LINUX_CONTAINER_DEFINITION
17
19
dockerfile : .cirrus/poetry.Dockerfile
18
20
cluster_name : ${CIRRUS_CLUSTER_NAME}
19
21
region : eu-central-1
@@ -27,14 +29,59 @@ container_definition: &CONTAINER_DEFINITION
27
29
cpu : 3
28
30
memory : 8G
29
31
32
+
33
+ win_vm_definition : &WINDOWS_VM_DEFINITION
34
+ ec2_instance :
35
+ experimental : true # see https://github.com/cirruslabs/cirrus-ci-docs/issues/1051
36
+ image : base-windows-jdk17-v*
37
+ platform : windows
38
+ region : eu-central-1
39
+ type : c6id.4xlarge
40
+ preemptible : false
41
+ use_ssd : true
42
+
43
+ win_ssd_and_clone :
44
+ &WIN_SSD_AND_CLONE # copy&paste from https://github.com/SonarSource/sonar-cpp/blob/a8c6f1e45a12393508682a013ac7ee35eb92bece/.cirrus.yml#L45
45
+ prepare_disk_script :
46
+ - ps : |
47
+ Get-Disk -Number 2 | Initialize-Disk -PassThru | New-Partition -UseMaximumSize -DriveLetter Z
48
+ Format-Volume -DriveLetter Z -FileSystem NTFS -Confirm:$false
49
+ - echo "CIRRUS_WORKING_DIR=Z:/cirrus-ci-build" >> $CIRRUS_ENV
50
+ # we don't clone submodules because they are not needed for the tests
51
+ clone_script : |
52
+ git config --system core.longpaths true
53
+ if [ -z "$CIRRUS_PR" ]; then
54
+ git clone --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
55
+ git reset --hard $CIRRUS_CHANGE_IN_REPO
56
+ else
57
+ git clone https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
58
+ git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
59
+ git reset --hard $CIRRUS_CHANGE_IN_REPO
60
+ fi
61
+
62
+ poetry_win_install : &POETRY_WIN_INSTALL
63
+ << : *WINDOWS_VM_DEFINITION
64
+ << : *WIN_SSD_AND_CLONE
65
+ env :
66
+ PYTHON_VERSION : 3.12.1
67
+ POETRY_VERSION : 2.0.1
68
+ jfrog_win_install_script :
69
+ - powershell "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/[RELEASE]/jfrog-cli-windows-amd64/jf.exe -OutFile $env:SYSTEMROOT\system32\jf.exe'"
70
+ - jf intro
71
+ poetry_win_install_script :
72
+ - source cirrus-env QA
73
+ - pip install poetry=="$POETRY_VERSION"
74
+ - source set_poetry_build_version "$CI_BUILD_NUMBER"
75
+ - jf config add repox --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_PRIVATE_ACCESS_TOKEN"
76
+ - jf poetry-config --server-id-resolve repox --repo-resolve sonarsource-pypi
77
+ - jf poetry install --build-name="$CIRRUS_REPO_NAME" --build-number="$CI_BUILD_NUMBER"
78
+
30
79
poetry_cache_template : &POETRY_CACHE
31
80
poetry_cache :
32
81
folder : ~/.cache/poetry/
33
82
fingerprint_script : cat poetry.lock
34
83
35
84
.poetry_template : &POETRY_TEMPLATE
36
- eks_container :
37
- << : *CONTAINER_DEFINITION
38
85
<< : *POETRY_CACHE
39
86
poetry_install_script :
40
87
- source set_poetry_build_version "$CI_BUILD_NUMBER"
@@ -43,8 +90,13 @@ poetry_cache_template: &POETRY_CACHE
43
90
- jfrog poetry-config --server-id-resolve repox --repo-resolve sonarsource-pypi
44
91
- jfrog poetry install --build-name="$CIRRUS_REPO_NAME" --build-number="$CI_BUILD_NUMBER"
45
92
46
- mend_scan_task :
93
+ .poetry_linux_template : &POETRY_LINUX_TEMPLATE
47
94
<< : *POETRY_TEMPLATE
95
+ eks_container :
96
+ << : *LINUX_CONTAINER_DEFINITION
97
+
98
+ mend_scan_task :
99
+ << : *POETRY_LINUX_TEMPLATE
48
100
depends_on :
49
101
- build
50
102
# run only on master and long-living branches
@@ -67,7 +119,7 @@ mend_scan_task:
67
119
path : " whitesource/**/*"
68
120
69
121
formatting_task :
70
- << : *POETRY_TEMPLATE
122
+ << : *POETRY_LINUX_TEMPLATE
71
123
alias : formatting
72
124
name : " Formatting"
73
125
formatting_script :
@@ -76,8 +128,8 @@ formatting_task:
76
128
- poetry run licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2024 -n "Sonar Scanner Python" -E .py -d tests/
77
129
- git diff --name-only --exit-code ./src ./tests
78
130
79
- analysis_task :
80
- << : *POETRY_TEMPLATE
131
+ analysis_linux_task :
132
+ << : *POETRY_LINUX_TEMPLATE
81
133
alias : analysis
82
134
name : " NEXT Analysis"
83
135
analysis_script :
@@ -115,12 +167,20 @@ qa_task:
115
167
eks_container :
116
168
docker_arguments :
117
169
PYTHON_VERSION : 3.13.2
118
- << : *POETRY_TEMPLATE
170
+ << : *POETRY_LINUX_TEMPLATE
119
171
qa_script :
120
172
- poetry run pytest tests/
121
173
174
+ qa_windows_task :
175
+ name : " Test Windows"
176
+ << : *POETRY_WIN_INSTALL
177
+ alias : qa_windows
178
+ qa_script :
179
+ - poetry run pytest tests/
180
+ - exit $LASTEXITCODE
181
+
122
182
build_task :
123
- << : *POETRY_TEMPLATE
183
+ << : *POETRY_LINUX_TEMPLATE
124
184
alias : build
125
185
name : " Build"
126
186
build_script : regular_poetry_build_publish
@@ -132,7 +192,7 @@ its_task:
132
192
folder : sonarqube_cache/
133
193
populate_script : mkdir -p sonarqube_cache && wget -q https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONARQUBE_VERSION.zip -O sonarqube_cache/sonarqube.zip
134
194
fingerprint_script : echo "sonarqube-$SONARQUBE_VERSION"
135
- << : *POETRY_TEMPLATE
195
+ << : *POETRY_LINUX_TEMPLATE
136
196
its_script :
137
197
- unzip -q sonarqube_cache/sonarqube.zip -d sonarqube
138
198
- cd $(ls -d sonarqube/*/)
@@ -149,10 +209,11 @@ promote_task:
149
209
- formatting
150
210
- analysis
151
211
- qa
212
+ - qa_windows
152
213
- build
153
214
- its
154
215
env :
155
216
ARTIFACTORY_PROMOTE_ACCESS_TOKEN : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
156
217
GITHUB_TOKEN : VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
157
- << : *POETRY_TEMPLATE
218
+ << : *POETRY_LINUX_TEMPLATE
158
219
promote_script : cirrus_promote
0 commit comments