97 lines
3.1 KiB
YAML
97 lines
3.1 KiB
YAML
stages:
|
|
- image
|
|
- build
|
|
|
|
variables:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_DRIVER: overlay2
|
|
DOCKER_TLS_CERTDIR: ""
|
|
DOCKER_BUILDKIT: "1"
|
|
# apt mirror used inside both images (override per pipeline if needed)
|
|
APT_MIRROR: "http://mirrors.tuna.tsinghua.edu.cn/ubuntu"
|
|
|
|
.dind: &dind
|
|
services:
|
|
- name: docker:dind
|
|
# Pull docker.io images through the intranet Harbor pull-through cache;
|
|
# plain HTTP registry, hence --insecure-registry.
|
|
command:
|
|
- --registry-mirror=http://192.168.1.11:9090/dockerhub
|
|
- --insecure-registry=192.168.1.11:9090
|
|
|
|
# --- 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
|
|
|
|
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: *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
|