-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Build a windows docker image and publish it to the registry
This change allows to build a windows docker image of `sfcgal` and publish it to the registry. The docker image is built on 3 different occasions: - a new Merge Request (manual, does not block the next stages) - a new tag (automatic) - a push to master (automatic) The merge request job one is manual because this CI is quite slow. Indeed, windows runners are still in beta and the VMs take some time to start (up to 5 minutes) and they do not have a lot of compute ressources. According to gitlab tickets, the situation should improve in Q4 2024. The `dockerfile` uses a base docker image which already contains `sfcgal` dependencies built with vcpkg (mostly boost and cgal). Indeed, windows base image provided by gitlab already contain `vcpkg`, `cmake` and visual studio c++ compiler but compiling `boost` and `cgal` with `vcpkg` can take longer than the runner timeout (2h). These images will be used by `pysfcgal` to build a windows wheel.
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
build:windows: | ||
stage: build | ||
tags: | ||
- saas-windows-medium-amd64 | ||
rules: | ||
# on default branch | ||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH | ||
when: always | ||
# on a tag | ||
- if: $CI_COMMIT_TAG | ||
when: always | ||
# on a MR if previous jobs are successful | ||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
when: manual | ||
allow_failure: true | ||
before_script: | ||
- Start-Service -Name "docker" | ||
- docker login -u $env:CI_REGISTRY_USER -p $env:CI_REGISTRY_PASSWORD $env:CI_REGISTRY | ||
script: | ||
- (docker pull $env:CI_REGISTRY_IMAGE':'windows-latest) -or ($true) | ||
- docker build | ||
--pull | ||
--cache-from $env:CI_REGISTRY_IMAGE':'windows-latest | ||
--tag $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA | ||
-f docker\Dockerfile.windows | ||
. | ||
- docker push $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA | ||
after_script: | ||
- docker logout $env:CI_REGISTRY | ||
|
||
|
||
push:windows-latest: | ||
stage: deploy | ||
tags: | ||
- saas-windows-medium-amd64 | ||
only: | ||
refs: | ||
- master | ||
before_script: | ||
- Start-Service -Name "docker" | ||
- docker login -u $env:CI_REGISTRY_USER -p $env:CI_REGISTRY_PASSWORD $env:CI_REGISTRY | ||
script: | ||
- docker pull $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA | ||
- docker tag $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA $env:CI_REGISTRY_IMAGE':'windows-latest | ||
- docker push $env:CI_REGISTRY_IMAGE':'windows-latest | ||
after_script: | ||
- docker logout $env:CI_REGISTRY | ||
|
||
|
||
push:windows-tag: | ||
stage: deploy | ||
tags: | ||
- saas-windows-medium-amd64 | ||
only: | ||
refs: | ||
- tags | ||
before_script: | ||
- Start-Service -Name "docker" | ||
- docker login -u $env:CI_REGISTRY_USER -p $env:CI_REGISTRY_PASSWORD $env:CI_REGISTRY | ||
script: | ||
- docker pull $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA | ||
- docker tag $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_SHA $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_REF_NAME | ||
- docker push $env:CI_REGISTRY_IMAGE':'windows-$env:CI_COMMIT_REF_NAME | ||
after_script: | ||
- docker logout $env:CI_REGISTRY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Use sfcgal dependencies images | ||
FROM sfcgal/sfcgal-build-deps:windows-latest | ||
|
||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
|
||
WORKDIR "c:\SFCGAL" | ||
COPY . ./ | ||
|
||
RUN cmake -S . -B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DSFCGAL_BUILD_TESTS=OFF \ | ||
-DCMAKE_TOOLCHAIN_FILE="\"$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake\""; \ | ||
cmake --build build --config Release | ||
|
||
# Restore the default Windows shell for correct batch processing. | ||
SHELL ["cmd", "/S", "/C"] | ||
|
||
ENTRYPOINT ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] |