goldberg_emulator/.gitlab-ci.yml

316 lines
12 KiB
YAML

stages:
- dependencies
- build
- deploy
- page_deploy
static:linux:deps:
stage: dependencies
image: nemirtingas/linux_vcpkg:ubuntu18
#when: manual
script:
- apt update && apt -y install libgl1-mesa-dev libgl1-mesa-dev:i386
- dependencies=("glew" "protobuf[zlib]" "curl[core,openssl]" "nlohmann-json" "nlohmann-fifo-map" "stb")
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TRIPLET=x86-linux-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- TRIPLET=x64-linux-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- exit 0
cache:
key: static-linux-deps-cache
paths:
- vcpkg
artifacts:
paths:
- vcpkg
expire_in: 1 day
static:windows:deps:
stage: dependencies
image: nemirtingas/windowscross_vcpkg:msvc2019_win10.0.18362.0
#when: manual
script:
- dependencies=("glew" "protobuf[zlib]" "curl[core,winssl]" "nlohmann-json" "nlohmann-fifo-map" "stb")
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TRIPLET=x64-linux
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf:${TRIPLET} || exit 1
- TRIPLET=x86-windows-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- TRIPLET=x64-windows-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- exit 0
cache:
key: static-windows-deps-cache
paths:
- vcpkg
artifacts:
paths:
- vcpkg
expire_in: 1 day
static:macosx:deps:
stage: dependencies
image: nemirtingas/osxcross_vcpkg:SDK10.13
#when: manual
script:
- dependencies=("protobuf[zlib]" "curl[core,openssl]" "nlohmann-json" "nlohmann-fifo-map" "stb")
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TRIPLET=x64-linux
- vcpkg "--x-install-root=${VCPKG_PATH}" install protobuf:${TRIPLET} || exit 1
- TRIPLET=x86-macosx-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- TRIPLET=x64-macosx-goldberg
- vcpkg "--x-install-root=${VCPKG_PATH}" install --triplet=${TRIPLET} "${dependencies[@]}" || exit 1
- exit 0
cache:
key: static-macosx-deps-cache
paths:
- vcpkg/
artifacts:
paths:
- vcpkg/
expire_in: 1 day
build:linux:
stage: build
image: nemirtingas/linux_vcpkg:ubuntu18
dependencies:
- static:linux:deps
needs:
- static:linux:deps
script:
- apt update && apt -y install libgl1-mesa-dev libgl1-mesa-dev:i386
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- TRIPLET=x86-linux-goldberg
- OUT=linux32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- TRIPLET=x64-linux-goldberg
- OUT=linux64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- exit 0
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
build:windows:
stage: build
image: nemirtingas/windowscross_vcpkg:msvc2019_win10.0.18362.0
dependencies:
- static:windows:deps
needs:
- static:windows:deps
script:
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- CHAINLOAD="/clang_windows_sdk/clang-cl-msvc.cmake"
- export HOST_ARCH=x86
- TRIPLET=x86-windows-goldberg
- OUT=win32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- export HOST_ARCH=x64
- TRIPLET=x64-windows-goldberg
- OUT=win64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
build:macosx:
stage: build
image: nemirtingas/osxcross_vcpkg:SDK10.13
dependencies:
- static:macosx:deps
needs:
- static:macosx:deps
script:
- cp -f vcpkg_triplets/*.cmake /vcpkg/triplets/
- VCPKG_PATH=$(pwd)/vcpkg
- TOOLCHAIN="/vcpkg/scripts/buildsystems/vcpkg.cmake"
- CHAINLOAD="/osxcross/target/toolchain.cmake"
- export OSXCROSS_HOST=i386-apple-${OSXCROSS_TARGET}
- TRIPLET=x86-macosx-goldberg
- OUT=macosx32/Release
- cmake -G Ninja -Wno-dev -DX86=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- export OSXCROSS_HOST=x86_64-apple-${OSXCROSS_TARGET}
- TRIPLET=x64-macosx-goldberg
- OUT=macosx64/Release
- cmake -G Ninja -Wno-dev -DX64=ON -DCMAKE_BUILD_TYPE=Release "-DVCPKG_TARGET_TRIPLET=${TRIPLET}" "-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${CHAINLOAD}" "-D_VCPKG_INSTALLED_DIR=${VCPKG_PATH}" -S . -B "${OUT}"
- cmake --build "${OUT}"
- cmake --install "${OUT}"
- mkdir release/macosx
- x86_64-apple-${OSXCROSS_TARGET}-lipo -create release/macosx*/steamclient.dylib -output release/macosx/steamclient.dylib
- x86_64-apple-${OSXCROSS_TARGET}-lipo -create release/macosx*/libsteam_api.dylib -output release/macosx/libsteam_api.dylib
artifacts:
paths:
- release/
- debug/
expire_in: 1 day
protobuf_static_steamos:
stage: dependencies
image: tianon/steamos
when: manual
script:
# don't rebuild every time
- test -e ./protobuf/prefix && exit 0
- apt update && apt -y install gcc-4.9 g++-4.9 git autotools-dev automake libtool g++-4.9-multilib gcc-4.9-multilib build-essential
- export BASE_PREFIX_PATH=$(pwd)
- echo $BASE_PREFIX_PATH
- mkdir deps
- cd deps
- git clone https://github.com/protocolbuffers/protobuf.git
- cd protobuf
- sh autogen.sh
- ./configure "CC=gcc-4.9 -m32" "CXX=g++-4.9 -m32" CPPFLAGS="-fPIC -Ofast" CXXFLAGS="-fPIC -Ofast" --prefix=$BASE_PREFIX_PATH/protobuf/prefix_x86/ --disable-shared --enable-static
- make -j8 install
- make clean
- ./configure "CC=gcc-4.9" "CXX=g++-4.9" "CPPFLAGS=-fPIC -Ofast" "CXXFLAGS=-fPIC -Ofast" --prefix=$BASE_PREFIX_PATH/protobuf/prefix/ --disable-shared --enable-static
- make -j8 install
cache:
key: protobuf-static-steamos-cache
# policy: push
paths:
- protobuf/
artifacts:
paths:
- protobuf/
expire_in: 1 day
build_steamos:
stage: build
image: tianon/steamos
dependencies:
- protobuf_static_steamos
needs:
- protobuf_static_steamos
before_script:
- apt update && apt -y install gcc-4.9 g++-4.9 git libtool g++-4.9-multilib gcc-4.9-multilib
script:
- ls -lah
- uname -a
- sed -i 's/^g++ /g++-4.9 /g' build_steamos.sh
- sed -i 's/..\/protobuf\/prefix/.\/protobuf\/prefix/g' build_steamos.sh
- sh build_steamos.sh
artifacts:
paths:
- linux/
expire_in: 1 day
build_windows:
stage: build
image: fedora:29
needs:
- protobuf_static_steamos
script:
- dnf -y install wine wget p7zip sed dos2unix
- unix2dos *.txt
- unix2dos files_example/*.txt files_example/*/*.txt
- sed -i 's/..\\vcpkg\\installed\\/.\\protobuf_/g' build_set_protobuf_directories.bat
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z'
- 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static
- 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static
- 7za x sdk_standalone.7z -osdk_standalone
- DLL_FILES="$(ls dll/*.cpp | tr "\n" " ")"; sed "s|dll/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls detours/*.cpp | tr "\n" " ")"; sed "s|detours/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls overlay_experimental/*.cpp | tr "\n" " ")"; sed "s|overlay_experimental/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls overlay_experimental/windows/*.cpp | tr "\n" " ")"; sed "s|overlay_experimental/windows/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls ImGui/*.cpp | tr "\n" " ")"; sed "s|ImGui/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls ImGui/impls/*.cpp | tr "\n" " ")"; sed "s|ImGui/impls/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls ImGui/impls/windows/*.cpp | tr "\n" " ")"; sed "s|ImGui/impls/windows/\*.cpp|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls dll/*.proto | tr "\n" " " | sed "s/.proto/.pb.cc/g")"; sed "s|dll/\*.cc|$DLL_FILES|g" -i *.bat
- DLL_FILES="$(ls steamclient_loader/*.cpp | tr "\n" " ")"; sed "s|steamclient_loader/\*.cpp|$DLL_FILES|g" -i *.bat
- sed "s| /MP12 | /MP4 |g" -i *.bat
- export WINEDEBUG=-all
- wine cmd /c build_win_debug_experimental.bat
- wine cmd /c build_win_release.bat
- mkdir release/debug_experimental
- mv steam_api.dll steam_api64.dll release/debug_experimental/
- rm -f steamclient.dll steamclient64.dll
- wine cmd /c build_win_debug_experimental_steamclient.bat
- mkdir release/debug_experimental_steamclient
- mv steamclient.dll steamclient64.dll release/debug_experimental_steamclient/
- cp Readme_debug.txt release/debug_experimental/Readme.txt
artifacts:
paths:
- release/
expire_in: 1 day
deploy_all:
stage: deploy
image: alpine
dependencies:
- build:windows
- build:linux
- build:macosx
script:
- apk --no-cache add git tree
- ls -lah
- mkdir -p release/source_code
- git bundle create release/source_code/source_code.bundle --all
- "echo \"This is a git bundle of the full repo, to use: git clone source_code.bundle --branch master\" > release/source_code/Readme.txt"
- find . -mindepth 1 -maxdepth 1 ! -name release -exec rm -rf '{}' \;
- mv release/* ./
- rm -rf release
- echo $CI_JOB_ID > job_id
- tree
artifacts:
name: "Goldberg_Lan_Steam_Emu_$CI_COMMIT_REF_NAME-$CI_COMMIT_TAG-$CI_COMMIT_SHORT_SHA"
paths:
- ./
expire_in: never
pages:
image: fedora
stage: page_deploy
dependencies:
- deploy_all
script:
- DEPLOY_ALL_JOBID=$(cat job_id)
- mkdir public
- cat website/template.html | sed 's|X_LATEST_BUILD_URL_X|https://gitlab.com/Mr_Goldberg/goldberg_emulator/-/jobs/'$DEPLOY_ALL_JOBID'/artifacts/download|g' > public/index.html
- sed -i 's|X_LATEST_BUILD_COMMIT_HASH_X|'$CI_COMMIT_SHA'|g' public/index.html
artifacts:
paths:
- public/
only:
- master