Test docker build

This commit is contained in:
2026-05-01 22:02:33 +03:00
parent 10bb22bb01
commit 895ea59d44
3 changed files with 54 additions and 22 deletions
+8
View File
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.20)
project(Testing LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(test_app main.cpp)
Vendored
+41 -22
View File
@@ -7,32 +7,51 @@ pipeline {
} }
stages { stages {
stage('Build Linux') { stage('Build Docker Image') {
steps { steps {
sh ''' sh '''
mkdir -p build/linux docker build \
g++ main.cpp -o build/linux/test_app -t cpp-mingw-vcpkg:latest \
-f docker/cpp-mingw-vcpkg/Dockerfile .
''' '''
} }
} }
stage('Build Windows') { stage('Build Linux') {
steps {
sh '''
mkdir -p build/windows
x86_64-w64-mingw32-g++ main.cpp \
-static \
-static-libgcc \
-static-libstdc++ \
-o build/windows/test_app.exe
'''
}
}
stage('Run Linux') {
steps { steps {
sh ''' sh '''
./build/linux/test_app docker run --rm \
-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
"
'''
}
}
stage('Build Windows MinGW') {
steps {
sh '''
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
cpp-mingw-vcpkg:latest \
bash -c "
rm -rf build/windows &&
cmake -S . -B build/windows -G Ninja \
-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
"
''' '''
} }
} }
@@ -40,16 +59,16 @@ pipeline {
stage('Package') { stage('Package') {
steps { steps {
sh ''' sh '''
cd build mkdir -p artifacts
tar -czf linux-build.tar.gz linux tar -czf artifacts/linux-build.tar.gz -C build linux
zip -r windows-build.zip windows zip -r artifacts/windows-build.zip build/windows
''' '''
} }
} }
stage('Archive') { stage('Archive') {
steps { steps {
archiveArtifacts artifacts: 'build/linux-build.tar.gz, build/windows-build.zip', fingerprint: true archiveArtifacts artifacts: 'artifacts/*', fingerprint: true
} }
} }
} }
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": [
]
}