This commit is contained in:
2026-05-02 02:54:58 +03:00
parent fa7241c0a7
commit e342c1527b
2 changed files with 28 additions and 83 deletions
Vendored
+13 -58
View File
@@ -1,75 +1,30 @@
pipeline { pipeline {
agent any agent none
options {
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages { stages {
stage('Build Docker Image') {
steps {
sh '''
docker build \
-t cpp-mingw-vcpkg:latest \
-f docker/cpp-mingw-vcpkg/Dockerfile .
'''
}
}
stage('Build Linux') { stage('Build Linux') {
agent { label 'linux' }
steps { steps {
sh ''' sh '''
docker run --rm \ cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release
-v "$PWD:/workspace" \
-w /workspace \
cpp-mingw-vcpkg:latest \
bash -c "
rm -rf build/linux &&
cmake -S . -B build/linux -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake &&
cmake --build build/linux cmake --build build/linux
"
''' '''
} }
} }
stage('Build Windows MinGW') { stage('Check Windows Agent') {
agent { label 'windows' }
steps { steps {
sh ''' bat '''
docker run --rm \ echo Windows agent works
-v "$PWD:/workspace" \ hostname
-w /workspace \ where cl
cpp-mingw-vcpkg:latest \ where cmake
bash -c " where ninja
rm -rf build/windows && where git
cmake -S . -B build/windows -G Ninja \ java -version
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ &&
cmake --build build/windows
"
''' '''
} }
} }
stage('Package') {
steps {
sh '''
mkdir -p artifacts
tar -czf artifacts/linux-build.tar.gz -C build linux
zip -r artifacts/windows-build.zip build/windows
'''
}
}
stage('Archive') {
steps {
archiveArtifacts artifacts: 'artifacts/*', fingerprint: true
}
}
} }
} }
+10 -20
View File
@@ -1,24 +1,14 @@
FROM ubuntu:24.04 FROM mcr.microsoft.com/windows/servercore:ltsc2022
ENV DEBIAN_FRONTEND=noninteractive SHELL ["cmd", "/S", "/C"]
ENV VCPKG_ROOT=/opt/vcpkg
ENV PATH="${VCPKG_ROOT}:${PATH}"
RUN apt-get update && apt-get install -y \ RUN powershell -Command `
build-essential \ Invoke-WebRequest https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile C:\vs_buildtools.exe; `
mingw-w64 \ Start-Process C:\vs_buildtools.exe -ArgumentList '--quiet --wait --norestart --nocache --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.CMake.Project' -Wait; `
cmake \ Remove-Item C:\vs_buildtools.exe
ninja-build \
git \
curl \
zip \
unzip \
tar \
pkg-config \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/microsoft/vcpkg.git ${VCPKG_ROOT} \ RUN powershell -Command `
&& ${VCPKG_ROOT}/bootstrap-vcpkg.sh git clone https://github.com/microsoft/vcpkg C:\vcpkg; `
C:\vcpkg\bootstrap-vcpkg.bat
WORKDIR /workspace WORKDIR C:\workspace