Files
PyG2O/.gitlab-ci.yml
2024-03-08 20:26:11 +01:00

147 lines
4.0 KiB
YAML

variables:
GIT_SUBMODULE_STRATEGY: recursive
PROJECT_NAME: ${CI_PROJECT_NAME}
VERSION: "0.1"
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
stages:
- build
- release
.build:
stage: build
when: manual
script:
- cmake . --preset ${SYSTEM}-${ARCHITECTURE}-Release
- cmake --build --preset ${SYSTEM}-${ARCHITECTURE}-Release
- cp out/build/${SYSTEM}-${ARCHITECTURE}-Release/${PROJECT_NAME}.${ARCHITECTURE}${SHARED_LIB_SUFFIX} ./
artifacts:
name: ${PROJECT_NAME}
paths:
- ${PROJECT_NAME}.${ARCHITECTURE}${SHARED_LIB_SUFFIX}
expire_in: never
reports:
dotenv: job.env
build:windows:
extends: .build
tags: [windows]
variables:
SYSTEM: "Windows"
SHARED_LIB_SUFFIX: ".dll"
before_script: |
function loadenv($bat_file)
{
$env_file = New-TemporaryFile
cmd /c " `"$bat_file`" $args && set > `"$env_file`" "
foreach($line in Get-Content "$env_file")
{
if($line -match "^(.*?)=(.*)$")
{
Set-Content "env:\$($matches[1])" $matches[2]
}
}
Remove-Item "$env_file"
}
loadenv "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" ${ARCHITECTURE}
after_script:
- Add-Content -Path job.env -Value "${SYSTEM}_${ARCHITECTURE}_job_id=${CI_JOB_ID}"
parallel:
matrix:
- ARCHITECTURE: [x86, x64]
build:linux:
extends: .build
image: registry.gitlab.com/gothicmultiplayerteam/buildimage:ubuntu-20.04-${ARCHITECTURE}
variables:
SYSTEM: "Linux"
SHARED_LIB_SUFFIX: ".so"
after_script:
- echo "${SYSTEM}_${ARCHITECTURE}_job_id=${CI_JOB_ID}" >> job.env
parallel:
matrix:
- ARCHITECTURE: [x64, arm, arm64]
build:docs:
stage: build
image: "python:3.9-alpine"
when: manual
before_script:
- apk add git
- git clone https://gitlab.com/GothicMultiplayerTeam/docsgenerator.git
script:
- pip install -r docs/requirements.txt
- pip install -r docsgenerator/requirements.txt
- python docsgenerator/generate.py ${VERSION} src --builddir "docs/docs/script-reference" --markdown
artifacts:
paths:
- docs/docs/script-reference/
pages:
stage: build
image: "python:3.9-alpine"
needs: [build:docs]
script:
- cd docs
- pip install -r requirements.txt
- mkdocs build -d "../public"
after_script:
- 'echo "Online documentation available under: ${CI_PAGES_URL}"'
artifacts:
paths:
- public
docs:
stage: build
image: "python:3.9-alpine"
needs: [build:docs]
script:
- cd docs
- pip install -r requirements.txt
- mkdocs build -d "../${PROJECT_NAME}_docs" --no-directory-urls
after_script:
- echo "Docs_job_id=${CI_JOB_ID}" >> job.env
artifacts:
name: "${PROJECT_NAME}_docs"
paths:
- ${PROJECT_NAME}_docs
expire_in: never
reports:
dotenv: job.env
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
when: manual
needs: [build:windows, build:linux, pages, docs]
script:
- echo "Created ${VERSION} release"
release:
tag_name: "${VERSION}"
description: "./CHANGELOG.md"
assets:
links:
- name: "${PROJECT_NAME}.x86.dll"
url: "${CI_PROJECT_URL}/-/jobs/${Windows_x86_job_id}/artifacts/download"
link_type: "package"
- name: "${PROJECT_NAME}.x64.dll"
url: "${CI_PROJECT_URL}/-/jobs/${Windows_x64_job_id}/artifacts/download"
link_type: "package"
- name: "${PROJECT_NAME}.x64.so"
url: "${CI_PROJECT_URL}/-/jobs/${Linux_x64_job_id}/artifacts/download"
link_type: "package"
- name: "${PROJECT_NAME}.arm.so"
url: "${CI_PROJECT_URL}/-/jobs/${Linux_arm_job_id}/artifacts/download"
link_type: "package"
- name: "${PROJECT_NAME}.arm64.so"
url: "${CI_PROJECT_URL}/-/jobs/${Linux_arm64_job_id}/artifacts/download"
link_type: "package"
- name: "${PROJECT_NAME}_docs"
url: "${CI_PROJECT_URL}/-/jobs/${Docs_job_id}/artifacts/download"