v0.2.0: clang + import std; isolated Windows cross-build (llvm-mingw + SDL3)

This commit is contained in:
EnderTheCoder
2026-09-12 02:04:25 +08:00
parent b35372da52
commit 1d12e4e099
23 changed files with 393 additions and 267 deletions
+72 -40
View File
@@ -6,14 +6,11 @@ variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
# Where to push the dev image. Leave empty to not push at all.
# Examples: "192.168.1.11:9090/<group>/openra3" or "docker.io/<user>/openra3"
IMAGE_NAME: ""
DOCKER_BUILDKIT: "1"
# apt mirror used inside both images (override per pipeline if needed)
APT_MIRROR: "http://mirrors.tuna.tsinghua.edu.cn/ubuntu"
image_build:
stage: image
image: docker:latest
.dind: &dind
services:
- name: docker:dind
# Pull docker.io images through the intranet Harbor pull-through cache;
@@ -21,44 +18,79 @@ image_build:
command:
- --registry-mirror=http://192.168.1.11:9090/dockerhub
- --insecure-registry=192.168.1.11:9090
script:
- docker build --target dev -t openra3-dev:local --build-arg APT_MIRROR=$APT_MIRROR .
- docker save openra3-dev:local -o dev-image.tar
- |
if [ -n "$IMAGE_NAME" ]; then
# add `docker login` here if IMAGE_NAME points to a private registry
docker tag openra3-dev:local $IMAGE_NAME:$CI_COMMIT_SHORT_SHA
docker push $IMAGE_NAME:$CI_COMMIT_SHORT_SHA
fi
artifacts:
name: "dev-image-$CI_COMMIT_SHORT_SHA"
paths:
- dev-image.tar
expire_in: 1 day
# --- build the two isolated toolchain images ---------------------------------
linux_image:
stage: image
image: docker:latest
services: *dind
tags:
- docker
script:
- docker build --target dev -t openra3-linux:local --build-arg APT_MIRROR=$APT_MIRROR .
- docker save openra3-linux:local -o linux-image.tar
artifacts:
name: "linux-image-$CI_COMMIT_SHORT_SHA"
paths:
- linux-image.tar
expire_in: 1 day
build_test_package:
windows_image:
stage: image
image: docker:latest
services: *dind
tags:
- docker
script:
- docker build -f Dockerfile.win --target dev -t openra3-windows:local --build-arg APT_MIRROR=$APT_MIRROR .
- docker save openra3-windows:local -o windows-image.tar
artifacts:
name: "windows-image-$CI_COMMIT_SHORT_SHA"
paths:
- windows-image.tar
expire_in: 1 day
# --- build and test each target ----------------------------------------------
build_linux:
stage: build
image: docker:latest
services:
- name: docker:dind
command:
- --registry-mirror=http://192.168.1.11:9090/dockerhub
- --insecure-registry=192.168.1.11:9090
needs:
- image_build
before_script:
- docker load -i dev-image.tar
script:
- docker run --rm -v "$(pwd):/work" -w /work openra3-dev:local cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- docker run --rm -v "$(pwd):/work" -w /work openra3-dev:local cmake --build build -j
- docker run --rm -v "$(pwd):/work" -w /work openra3-dev:local ctest --test-dir build --output-on-failure
- docker run --rm -v "$(pwd):/work" -w /work openra3-dev:local bash -c "mkdir -p artifacts_bin && cp build/bin/openra3 artifacts_bin/"
artifacts:
name: "$CI_PROJECT_NAME-executables-$CI_COMMIT_SHORT_SHA"
paths:
- artifacts_bin/
expire_in: 7 days
services: *dind
tags:
- docker
needs:
- linux_image
before_script:
- docker load -i linux-image.tar
script:
- docker run --rm -v "$(pwd):/work" -w /work openra3-linux:local cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release
- docker run --rm -v "$(pwd):/work" -w /work openra3-linux:local cmake --build build/linux -j
- docker run --rm -v "$(pwd):/work" -w /work openra3-linux:local ctest --test-dir build/linux --output-on-failure
- docker run --rm -v "$(pwd):/work" -w /work openra3-linux:local bash -c "mkdir -p artifacts/linux && cp build/linux/bin/openra3 artifacts/linux/"
artifacts:
name: "$CI_PROJECT_NAME-linux-$CI_COMMIT_SHORT_SHA"
paths:
- artifacts/linux/
expire_in: 7 days
build_windows:
stage: build
image: docker:latest
services: *dind
tags:
- docker
needs:
- windows_image
before_script:
- docker load -i windows-image.tar
script:
- docker run --rm -v "$(pwd):/work" -w /work openra3-windows:local
cmake -S . -B build/windows -G Ninja
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/llvm-mingw-x86_64.cmake
-DCMAKE_BUILD_TYPE=Release
- docker run --rm -v "$(pwd):/work" -w /work openra3-windows:local cmake --build build/windows -j
- docker run --rm -v "$(pwd):/work" -w /work openra3-windows:local bash -c "mkdir -p artifacts/windows && cp build/windows/bin/openra3.exe build/windows/bin/SDL3.dll artifacts/windows/"
artifacts:
name: "$CI_PROJECT_NAME-windows-$CI_COMMIT_SHORT_SHA"
paths:
- artifacts/windows/
expire_in: 7 days