MBHaxe/.circleci/config.yml
RandomityGuy e40625d451 typo
2024-07-12 01:27:28 +05:30

471 lines
No EOL
21 KiB
YAML

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
orbs:
win: circleci/windows@4.1.1 # The Windows orb give you everything you need to start using the Windows executor.
macos: circleci/macos@2.5.1
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build:
macos:
xcode: 14.1.0 # Specify the Xcode version to use
resource_class: macos.m1.medium.gen1
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
NPROC: 4
COMMIT_TAG: pipeline.git.tag
steps:
- add_ssh_keys:
fingerprints:
- "82:42:56:a0:57:43:95:4e:00:c0:8c:c1:7f:70:74:47"
- checkout:
path: ~/MBHaxe
- macos/install-rosetta
- run:
name: Install brew dependencies
command: |
brew install cmake
brew install pkg-config
brew install libpthread-stubs
brew install nasm
- run:
name: Install Haxe
command: |
set -eux
download_url="https://github.com/HaxeFoundation/haxe/releases/download/4.3.4/haxe-4.3.4-osx.tar.gz"
echo "Downloading [$download_url]..."
mkdir ~/haxe
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o ~/haxe.tar.gz
tar xzvf ~/haxe.tar.gz -C ~/haxe --strip-components=1
download_url="https://github.com/HaxeFoundation/neko/releases/download/v2-4-0-rc/neko-2.4.0-rc-osx-universal.tar.gz"
echo "Downloading [$download_url]..."
mkdir ~/neko
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o ~/neko.tar.gz
tar xzvf ~/neko.tar.gz -C ~/neko --strip-components=1
export PATH=~/haxe/:"$PATH"
export PATH=~/neko/:"$PATH"
export HAXE_STD_PATH=~/haxe/std
export DYLD_LIBRARY_PATH=~/neko
sudo chmod +x ~/neko/neko
haxelib setup ~/haxelib
haxelib list
haxelib install hashlink
- run:
name: Compile zlib
command: |
mkdir -p ~/deps
cd ~/deps
curl https://www.zlib.net/zlib-1.3.1.tar.xz | tar xz
cd zlib-1.3.1
if [ ! -f /usr/local/lib/libz.1.3.1.dylib ]; then
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
fi
- run:
name: Compile alsoft
command: |
mkdir -p ~/deps
cd ~/deps
curl https://openal-soft.org/openal-releases/openal-soft-1.22.2.tar.bz2 | tar xz
cd openal-soft-1.22.2
if [ ! -f /usr/local/lib/libopenal.1.22.2.dylib ]; then
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DALSOFT_BACKEND_SNDIO=NO -DALSOFT_BACKEND_PORTAUDIO=NO -DALSOFT_BACKEND_WAVE=NO -DALSOFT_UTILS=NO -DALSOFT_EXAMPLES=NO -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
fi
- run:
name: Compile jpeg-turbo (x86)
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.sourceforge.net/project/libjpeg-turbo/2.1.4/libjpeg-turbo-2.1.4.tar.gz | tar xz
cd libjpeg-turbo-2.1.4
if [ ! -f /usr/local/lib/libturbojpeg.0.2.0.dylib ]; then
cmake -S. -Bbuild-x86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build-x86 --config release -j$NPROC
fi
- run:
name: Compile jpeg-turbo (ARM64)
command: |
cd ~/deps/libjpeg-turbo-2.1.4
if [ ! -f /usr/local/lib/libturbojpeg.0.2.0.dylib ]; then
cmake -S. -Bbuild-arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build-arm64 --config release -j$NPROC
fi
- run:
name: Install jpeg-turbo (Universal)
command: |
if [ ! -f /usr/local/lib/libturbojpeg.0.2.0.dylib ]; then
cd ~/deps/libjpeg-turbo-2.1.4/build-arm64
for i in libjpeg.62.3.0.dylib cjpeg cjpeg-static djpeg djpeg-static jcstest jpegtran jpegtran-static libjpeg.a libturbojpeg.a libturbojpeg.0.2.0.dylib rdjpgcom strtest tjbench tjbench-static tjexample tjunittest tjunittest-static wrjpgcom
do
lipo -create -output $i ../build-x86/$i $i
done
sudo cmake --install .
fi
- run:
name: Compile libogg
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz | tar xz
cd libogg-1.3.5
if [ ! -f /usr/local/lib/libogg.0.8.5.dylib ]; then
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
fi
- run:
name: Compile libvorbis
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz | tar xz
cd libvorbis-1.3.7
if [ ! -f /usr/local/lib/libvorbis.0.4.9.dylib ]; then
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
fi
- run:
name: Compile libpng (x86)
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://download.sourceforge.net/libpng/libpng-1.6.39.tar.xz | tar xz
cd libpng-1.6.39
if [ ! -f /usr/local/lib/libpng16.16.dylib ]; then
cmake -S. -Bbuild-x86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build-x86 --config release -j$NPROC
fi
- run:
name: Compile libpng (arm64)
command: |
mkdir -p ~/deps
cd ~/deps
cd libpng-1.6.39
if [ ! -f /usr/local/lib/libpng16.16.dylib ]; then
cmake -S. -Bbuild-arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build-arm64 --config release -j$NPROC
fi
- run:
name: Install libpng (Universal)
command: |
if [ ! -f /usr/local/lib/libpng16.16.dylib ]; then
cd ~/deps/libpng-1.6.39/build-arm64
for i in libpng16.16.39.0.dylib libpng16.a png-fix-itxt pngfix pngimage pngstest pngtest pngunknown pngvalid
do
lipo -create -output $i ../build-x86/$i $i
done
sudo cmake --install .
fi
- run:
name: Compile SDL2
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://github.com/libsdl-org/SDL/releases/download/release-2.26.1/SDL2-2.26.1.tar.gz | tar xz
cd SDL2-2.26.1
if [ ! -f /usr/local/lib/libSDL2-2.0.0.dylib ]; then
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
fi
- run:
name: Compile libuv
command: |
mkdir -p ~/deps
cd ~/deps
curl -fsSL https://github.com/libuv/libuv/archive/refs/tags/v1.44.2.tar.gz | tar xz
cd libuv-1.44.2
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Install hashlink
command: |
mkdir -p ~/deps
cd ~/deps
git clone --depth=1 https://github.com/RandomityGuy/hashlink
cd hashlink
cd ~/deps
git clone https://github.com/RandomityGuy/hxDatachannel
cd hashlink
mv ~/deps/hxDatachannel/cpp libs/datachannel
echo -e "\nadd_subdirectory(datachannel)" >> libs/CMakeLists.txt
curl -L https://raw.githubusercontent.com/RandomityGuy/hashlink/master/libs/ssl/CMakeLists.txt > libs/ssl/CMakeLists.txt
# Fix OpenAL
# curl -L https://github.com/nullobsi/hashlink/commit/a09491918cc4b83c2cb9fcded855fe967857385f.diff | git apply
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_FIND_FRAMEWORK=LAST -DWITH_SQLITE=OFF -DBUILD_TESTING=OFF -DCMAKE_MACOSX_RPATH=TRUE -DHASHLINK_INCLUDE_DIR="~/deps/hashlink/src" -DHASHLINK_LIBRARY_DIR="/usr/local/lib/"
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Install haxe dependencies
command: |
export PATH=~/haxe/:"$PATH"
export HAXE_STD_PATH=~/haxe/std
export PATH=~/neko/:"$PATH"
export DYLD_LIBRARY_PATH=~/neko
haxelib git heaps https://github.com/RandomityGuy/heaps
haxelib dev hlopenal ~/deps/hashlink/libs/openal
haxelib dev hlsdl ~/deps/hashlink/libs/sdl
haxelib dev datachannel ~/deps/hxDatachannel
haxelib install colyseus-websocket
- save_cache:
key: mbhaxe-deps-v1
paths:
- /usr/local/lib/ui.hdll
- /usr/local/lib/openal.hdll
- /usr/local/lib/fmt.hdll
- /usr/local/lib/sdl.hdll
- /usr/local/lib/libSDL2-2.0.0.dylib
- /usr/local/lib/libhl.1.13.0.dylib
- /usr/local/lib/libogg.0.8.5.dylib
- /usr/local/lib/libopenal.1.22.2.dylib
- /usr/local/lib/libpng16.16.dylib
- /usr/local/lib/libturbojpeg.0.2.0.dylib
- /usr/local/lib/libvorbis.0.4.9.dylib
- /usr/local/lib/libvorbisfile.3.3.8.dylib
- /usr/local/lib/libvorbisenc.2.0.12.dylib
- /usr/local/lib/libz.1.3.1.dylib
- /usr/local/lib/datachannel.hdll
- run:
name: Compile MBHaxe
command: |
export PATH=~/haxe/:"$PATH"
export HAXE_STD_PATH=~/haxe/std
export PATH=~/neko/:"$PATH"
export DYLD_LIBRARY_PATH=~/neko
cd ~/MBHaxe
haxe compile-macos.hxml
cd native
cp ~/deps/hashlink/src/hlc_main.c .
clang -mmacosx-version-min=10.15 -arch x86_64 -arch arm64 -o marblegame -I . -L /usr/local/lib/ -std=c11 marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,uv.hdll,ssl.hdll,datachannel.hdll} -lsdl2 -lhl -luv
- run:
name: Package app bundle
command: |
cd ~/MBHaxe
./package-macos.sh v$COMMIT_TAG
cd "macos-dist/MarbleBlast Platinum.app/Contents/MacOS"
otool -L marblegame
cd ../Frameworks
cp /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,libSDL2-2.0.0.dylib,ssl.hdll,uv.hdll,datachannel.hdll} .
cp /usr/local/lib/libhl.1.13.0.dylib libhl.1.dylib
cp /usr/local/lib/libogg.0.8.5.dylib libogg.0.dylib
cp /usr/local/lib/libopenal.1.22.2.dylib libopenal.1.dylib
cp /usr/local/lib/libpng16.16.dylib libpng16.16.dylib
cp /usr/local/lib/libturbojpeg.0.2.0.dylib libturbojpeg.0.dylib
cp /usr/local/lib/libvorbis.0.4.9.dylib libvorbis.0.4.9.dylib
cp /usr/local/lib/libvorbisfile.3.3.8.dylib libvorbisfile.3.3.8.dylib
cp /usr/local/lib/libvorbisenc.2.0.12.dylib libvorbisenc.2.0.12.dylib
cp /usr/local/lib/libz.1.3.1.dylib libz.1.dylib
cp /usr/local/lib/libuv.1.dylib libuv.1.dylib
# These libraries have dangling RPATHs
install_name_tool -delete_rpath /usr/local/lib libturbojpeg.0.dylib
for i in fmt.hdll libpng16.16.dylib
do
install_name_tool -change /usr/lib/libz.1.dylib @rpath/libz.1.dylib $i
done
- run:
name: Sign app bundle
command: |
cd ~/MBHaxe/macos-dist
xattr -rc "MarbleBlast Platinum.app"
cp "MarbleBlast Platinum.app/Contents/Entitlements.plist" .
codesign --deep --entitlements Entitlements.plist -fs - "MarbleBlast Platinum.app"
- run:
name: ZIP Bundle
command: |
cd ~/MBHaxe/macos-dist
npm install -g create-dmg
create-dmg --dmg-title="Marble Blast Platinum" "MarbleBlast Platinum.app" || true
rm -rf "macos-dist/MarbleBlast Platinum.app.in"
mv "marblegame vpipeline.git.tag.dmg" "MBHaxe-Platinum-Mac.dmg"
# zip -r MBHaxe-Ultra-Mac.zip macos-dist/
- run:
name: Upload to Artifact Storage
command: |
scp -o StrictHostKeyChecking=no -i $KEYPATH -P $PORT ~/MBHaxe/macos-dist/MBHaxe-Platinum-Mac.dmg $REMOTEDIR/MBHaxe-Platinum-Mac.dmg
# - store_artifacts:
# path: ~/MBHaxe/MBHaxe-Platinum-Mac.zip
build-win:
executor:
name: win/server-2022
shell: bash.exe # executor type
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
steps:
- add_ssh_keys:
fingerprints:
- "82:42:56:a0:57:43:95:4e:00:c0:8c:c1:7f:70:74:47"
- checkout
- run:
name: Install dependencies
command: |
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/sdl.zip https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/openal.zip https://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/ffmpeg.zip https://github.com/HaxeFoundation/hashlink/files/5648056/ffmpeg-3.4.2-win64-dev.zip
cd /tmp
7z x /tmp/sdl.zip -oinclude; mv /tmp/include/SDL2* /tmp/include/sdl
7z x /tmp/openal.zip -oinclude; mv /tmp/include/openal* /tmp/include/openal
7z x /tmp/ffmpeg.zip -oinclude; mv /tmp/include/ffmpeg* /tmp/include/ffmpeg
- run:
name: Install Neko
command: |
choco install --no-progress neko -y
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
- run:
name: Install CMake
command: |
choco install --no-progress cmake -y
- run:
name: Install Haxe
command: |
download_url="https://github.com/HaxeFoundation/haxe/releases/download/4.3.4/haxe-4.3.4-win64.zip"
echo "Downloading [$download_url]..."
mkdir /tmp/haxe
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o /tmp/haxe.zip
7z x /tmp/haxe.zip -o/tmp
mv -v /tmp/haxe_* /tmp/haxe
cd /tmp/haxe
mv haxe_* haxe
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
haxelib setup ~/haxelib
haxelib list
- run:
name: Build Hashlink
command: |
mkdir ~/deps
cd ~/deps
git clone https://github.com/RandomityGuy/hashlink
cd hashlink
mv /tmp/include/sdl include/sdl
mv /tmp/include/openal include/openal
MSBuild.exe hl.sln -m -nologo -p:Configuration=Release -p:Platform=x64
- run:
name: Build datachannel
command: |
mkdir ~/deps
cd ~/deps
git clone https://github.com/RandomityGuy/hxDatachannel
cd hxDatachannel/cpp
"/c/Program Files/CMake/bin/cmake" -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHASHLINK_LIBRARY_DIR="~/deps/hashlink/x64/Release" -DHASHLINK_INCLUDE_DIR="../../hashlink/src"
"/c/Program Files/CMake/bin/cmake" --build build --config Release -j4
mv ~/deps/hxDatachannel/cpp/build/Release/datachannel.hdll ~/deps/hashlink/x64/Release
mv ~/deps/hxDatachannel/cpp/build/Release/datachannel.lib ~/deps/hashlink/x64/Release
- run:
name: Install haxe dependencies
command: |
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
haxelib git heaps https://github.com/RandomityGuy/heaps
haxelib dev hlopenal ~/deps/hashlink/libs/openal
haxelib dev hlsdl ~/deps/hashlink/libs/sdl
haxelib dev hashlink ~/deps/hashlink/other/haxelib
haxelib dev datachannel ~/deps/hxDatachannel
haxelib install colyseus-websocket
- run:
name: Compile MBHaxe
command: |
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
cd ~/project
haxe compile-c.hxml
cd native
HASHLINKPATH=~/deps/hashlink
MSBuild.exe -m -nologo -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v142 -p:HASHLINK=$HASHLINKPATH marblegame.sln
- run:
name: Package app bundle
command: |
cd ~/project
mkdir release
cd release
cp ../native/x64/Release/marblegame.exe .
mv marblegame.exe marbleblast.exe
cp -r ../data .
cp ~/deps/hashlink/x64/Release/libhl.dll .
cp ~/deps/hashlink/x64/Release/fmt.hdll .
cp ~/deps/hashlink/x64/Release/ui.hdll .
cp ~/deps/hashlink/x64/Release/openal.hdll .
cp ~/deps/hashlink/x64/Release/sdl.hdll .
cp ~/deps/hashlink/x64/Release/ssl.hdll .
cp ~/deps/hashlink/x64/Release/datachannel.hdll .
cp ~/deps/hashlink/x64/Release/uv.hdll .
cp ~/deps/hashlink/include/sdl/lib/x64/SDL2.dll .
cp ~/deps/hashlink/include/openal/bin/Win64/soft_oal.dll ./OpenAL32.dll
- run:
name: Zip bundle
command: |
cd ~/project
7z a MBHaxe-Platinum-Win.zip release/
- run:
name: Upload to Artifact Storage
command: |
scp -o StrictHostKeyChecking=no -i $KEYPATH -P $PORT ~/project/MBHaxe-Platinum-Win.zip $REMOTEDIR/MBHaxe-Platinum-Win.zip
# - store_artifacts:
# path: ~/project/MBHaxe-Platinum-Win.zip
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-mac:
jobs:
- build:
filters:
tags:
only: /^\d+.\d+.\d+$/
build-windows:
jobs:
- build-win:
filters:
tags:
only: /^\d+.\d+.\d+$/