diff --git a/Jenkinsfile b/Jenkinsfile index e208826..75d6a38 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,75 +1,30 @@ pipeline { - agent any - - options { - timestamps() - buildDiscarder(logRotator(numToKeepStr: '10')) - } + agent none stages { - stage('Build Docker Image') { - steps { - sh ''' - docker build \ - -t cpp-mingw-vcpkg:latest \ - -f docker/cpp-mingw-vcpkg/Dockerfile . - ''' - } - } - stage('Build Linux') { + agent { label 'linux' } steps { sh ''' - 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 - " + cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release + 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 - " - ''' - } - } - - 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 - } - } +stage('Check Windows Agent') { + agent { label 'windows' } + steps { + bat ''' + echo Windows agent works + hostname + where cl + where cmake + where ninja + where git + java -version + ''' + } +} } } \ No newline at end of file diff --git a/docker/cpp-mingw-vcpkg/Dockerfile b/docker/cpp-mingw-vcpkg/Dockerfile index bedfb04..e89ce25 100644 --- a/docker/cpp-mingw-vcpkg/Dockerfile +++ b/docker/cpp-mingw-vcpkg/Dockerfile @@ -1,24 +1,14 @@ -FROM ubuntu:24.04 +FROM mcr.microsoft.com/windows/servercore:ltsc2022 -ENV DEBIAN_FRONTEND=noninteractive -ENV VCPKG_ROOT=/opt/vcpkg -ENV PATH="${VCPKG_ROOT}:${PATH}" +SHELL ["cmd", "/S", "/C"] -RUN apt-get update && apt-get install -y \ - build-essential \ - mingw-w64 \ - cmake \ - ninja-build \ - git \ - curl \ - zip \ - unzip \ - tar \ - pkg-config \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* +RUN powershell -Command ` + Invoke-WebRequest https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile C:\vs_buildtools.exe; ` + 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; ` + Remove-Item C:\vs_buildtools.exe -RUN git clone https://github.com/microsoft/vcpkg.git ${VCPKG_ROOT} \ - && ${VCPKG_ROOT}/bootstrap-vcpkg.sh +RUN powershell -Command ` + git clone https://github.com/microsoft/vcpkg C:\vcpkg; ` + C:\vcpkg\bootstrap-vcpkg.bat -WORKDIR /workspace \ No newline at end of file +WORKDIR C:\workspace \ No newline at end of file