Skip to content

Commit

Permalink
Merge branch 'windows-dockerfile' into 'master'
Browse files Browse the repository at this point in the history
ci: Build a windows docker image

See merge request sfcgal/SFCGAL!311
  • Loading branch information
ptitjano committed May 14, 2024
2 parents 5712f42 + ee7f446 commit 6e0504c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include:
- local: /.gitlab/pipeline/sonar.yml
- local: /.gitlab/pipeline/lint-code.yml
- local: /.gitlab/pipeline/test-code.yml
- local: /.gitlab/pipeline/build-windows.yml

sast:
stage: test
65 changes: 65 additions & 0 deletions .gitlab/pipeline/build-windows.yml
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
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.5.2 (2024-03-XX):
* Expose as_vtk to C Api (Loïc Bartoletti)
* Fix build with boost 1.85 (Dirk Stöcker, Fixes #266)
* Add a CI job to build a windows docker image (Jean Felder)
1.5.1 (2023-12-21):
* Rewrite and fix visibility algorithm (Loïc Bartoletti)
* Apply clang-tidy fixes (Loïc Bartoletti)
Expand Down
18 changes: 18 additions & 0 deletions docker/Dockerfile.windows
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"]

0 comments on commit 6e0504c

Please sign in to comment.