1111 POETRY_VIRTUALENVS_PATH : " ~/.cache/poetry/venvs"
1212 POETRY_CACHE_DIR : " ~/.cache/poetry/pypoetry"
1313 SONARQUBE_VERSION : 25.3.0.104237
14+ # Use bash (instead of sh on linux or cmd.exe on windows)
15+ CIRRUS_SHELL : bash
1416
1517only_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
1719 dockerfile : .cirrus/poetry.Dockerfile
1820 cluster_name : ${CIRRUS_CLUSTER_NAME}
1921 region : eu-central-1
@@ -27,14 +29,59 @@ container_definition: &CONTAINER_DEFINITION
2729 cpu : 3
2830 memory : 8G
2931
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+
3079poetry_cache_template : &POETRY_CACHE
3180 poetry_cache :
3281 folder : ~/.cache/poetry/
3382 fingerprint_script : cat poetry.lock
3483
3584.poetry_template : &POETRY_TEMPLATE
36- eks_container :
37- << : *CONTAINER_DEFINITION
3885 << : *POETRY_CACHE
3986 poetry_install_script :
4087 - source set_poetry_build_version "$CI_BUILD_NUMBER"
@@ -43,8 +90,13 @@ poetry_cache_template: &POETRY_CACHE
4390 - jfrog poetry-config --server-id-resolve repox --repo-resolve sonarsource-pypi
4491 - jfrog poetry install --build-name="$CIRRUS_REPO_NAME" --build-number="$CI_BUILD_NUMBER"
4592
46- mend_scan_task :
93+ .poetry_linux_template : &POETRY_LINUX_TEMPLATE
4794 << : *POETRY_TEMPLATE
95+ eks_container :
96+ << : *LINUX_CONTAINER_DEFINITION
97+
98+ mend_scan_task :
99+ << : *POETRY_LINUX_TEMPLATE
48100 depends_on :
49101 - build
50102 # run only on master and long-living branches
@@ -67,7 +119,7 @@ mend_scan_task:
67119 path : " whitesource/**/*"
68120
69121formatting_task :
70- << : *POETRY_TEMPLATE
122+ << : *POETRY_LINUX_TEMPLATE
71123 alias : formatting
72124 name : " Formatting"
73125 formatting_script :
@@ -76,8 +128,8 @@ formatting_task:
76128 - poetry run licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2024 -n "Sonar Scanner Python" -E .py -d tests/
77129 - git diff --name-only --exit-code ./src ./tests
78130
79- analysis_task :
80- << : *POETRY_TEMPLATE
131+ analysis_linux_task :
132+ << : *POETRY_LINUX_TEMPLATE
81133 alias : analysis
82134 name : " NEXT Analysis"
83135 analysis_script :
@@ -115,12 +167,20 @@ qa_task:
115167 eks_container :
116168 docker_arguments :
117169 PYTHON_VERSION : 3.13.2
118- << : *POETRY_TEMPLATE
170+ << : *POETRY_LINUX_TEMPLATE
119171 qa_script :
120172 - poetry run pytest tests/
121173
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+
122182build_task :
123- << : *POETRY_TEMPLATE
183+ << : *POETRY_LINUX_TEMPLATE
124184 alias : build
125185 name : " Build"
126186 build_script : regular_poetry_build_publish
@@ -132,7 +192,7 @@ its_task:
132192 folder : sonarqube_cache/
133193 populate_script : mkdir -p sonarqube_cache && wget -q https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONARQUBE_VERSION.zip -O sonarqube_cache/sonarqube.zip
134194 fingerprint_script : echo "sonarqube-$SONARQUBE_VERSION"
135- << : *POETRY_TEMPLATE
195+ << : *POETRY_LINUX_TEMPLATE
136196 its_script :
137197 - unzip -q sonarqube_cache/sonarqube.zip -d sonarqube
138198 - cd $(ls -d sonarqube/*/)
@@ -149,10 +209,11 @@ promote_task:
149209 - formatting
150210 - analysis
151211 - qa
212+ - qa_windows
152213 - build
153214 - its
154215 env :
155216 ARTIFACTORY_PROMOTE_ACCESS_TOKEN : VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
156217 GITHUB_TOKEN : VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
157- << : *POETRY_TEMPLATE
218+ << : *POETRY_LINUX_TEMPLATE
158219 promote_script : cirrus_promote
0 commit comments