Merge pull request #27 from jackeri/stable #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake on multiple platforms | |
on: | |
push: | |
branches: [ "stable" ] | |
pull_request: | |
branches: [ "stable" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | |
fail-fast: false | |
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
build_type: [Release] | |
bits: [64, 32] | |
include: | |
- os: windows-latest | |
c_compiler: cl | |
cpp_compiler: cl | |
- os: ubuntu-latest | |
c_compiler: gcc | |
cpp_compiler: g++ | |
- os: macos-latest | |
c_compiler: clang | |
cpp_compiler: clang++ | |
exclude: | |
- os: macos-latest | |
bits: 32 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 1 | |
fetch-tags: true | |
- name: Set reusable strings | |
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/0.83/Omnibot/build" >> "$GITHUB_OUTPUT" | |
echo "build-libs-dir=${{ github.workspace }}/build/libs/download" >> "$GITHUB_OUTPUT" | |
echo "BOOST_ROOT=${{ github.workspace }}/build/libs/boost-1.84.0" >> "$GITHUB_OUTPUT" | |
- name: Install Linux multilib | |
if: matrix.os == 'ubuntu-latest' && matrix.bits == 32 | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt install -y gcc-multilib g++-multilib | |
- name: Install boost on macos | |
if: matrix.os == 'macos-latest' | |
id: install-boost-macos | |
run: | | |
mkdir -p ${{ steps.strings.outputs.build-libs-dir }} | |
cd ${{ steps.strings.outputs.build-libs-dir }} | |
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz | |
tar -xf boost-1.84.0.tar.gz | |
cd boost-1.84.0 | |
./bootstrap.sh --with-libraries=system,filesystem,regex,date_time | |
./b2 architecture=arm+x86 cxxflags="-arch x86_64 \ | |
-arch arm64 -mmacosx-version-min=10.12" \ | |
link=static --prefix=${{ steps.strings.outputs.BOOST_ROOT }} \ | |
install | |
- name: Install boost on linux | |
if: matrix.os == 'ubuntu-latest' | |
id: install-boost-linux | |
run: | | |
mkdir -p ${{ steps.strings.outputs.build-libs-dir }} | |
cd ${{ steps.strings.outputs.build-libs-dir }} | |
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz | |
tar -xf boost-1.84.0.tar.gz | |
cd boost-1.84.0 | |
./bootstrap.sh --with-libraries=system,filesystem,regex,date_time | |
./b2 address-model=${{ matrix.bits }} cxxflags="-fPIC" link=static \ | |
--prefix=${{ steps.strings.outputs.BOOST_ROOT }} \ | |
install | |
- name: Install boost on windows | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
id: install-boost-windows | |
run: | | |
mkdir ${{ steps.strings.outputs.build-libs-dir }} | |
cd ${{ steps.strings.outputs.build-libs-dir }} | |
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.zip | |
unzip -qq boost-1.84.0.zip | |
cd boost-1.84.0 | |
call .\bootstrap.bat | |
b2 address-model=${{ matrix.bits }} link=static runtime-link=static ^ | |
--with-system --with-filesystem --with-regex --with-date_time ^ | |
--variant=release --prefix=${{ steps.strings.outputs.BOOST_ROOT }} ^ | |
install | |
- name: Configure CMake macOS | |
if: matrix.os == 'macos-latest' | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
"-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 | |
-S ${{ github.workspace }}/0.83/Omnibot | |
env: | |
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }} | |
- name: Configure CMake Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
-DCMAKE_C_FLAGS=-m${{ matrix.bits }} | |
-DCMAKE_CXX_FLAGS=-m${{ matrix.bits }} | |
-DCMAKE_SHARED_LINKER_FLAGS=-m${{ matrix.bits }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-S ${{ github.workspace }}/0.83/Omnibot | |
env: | |
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }} | |
- name: Configure CMake Windows | |
if: matrix.os == 'windows-latest' | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-S ${{ github.workspace }}\0.83\Omnibot | |
-A ${{ matrix.bits == 32 && 'Win32' || 'x64' }} | |
env: | |
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }} | |
- name: Build | |
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest --build-config ${{ matrix.build_type }} | |
- uses: actions/upload-artifact@v4 | |
name: Upload ET artifacts | |
with: | |
name: "${{ matrix.os }}-${{ matrix.bits }}bit-omnibot-ET" | |
path: "${{ steps.strings.outputs.build-output-dir }}/ET/omnibot_et*" | |
retention-days: 1 | |
- uses: actions/upload-artifact@v4 | |
name: Upload RTCW artifacts | |
with: | |
name: "${{ matrix.os }}-${{ matrix.bits }}bit-omnibot-RTCW" | |
path: "${{ steps.strings.outputs.build-output-dir }}/RTCW/omnibot_rtcw*" | |
retention-days: 1 | |
collect: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/download-artifact@v4 | |
name: download all artifacts | |
with: | |
path: packages | |
merge-multiple: true | |
- uses: geekyeggo/delete-artifact@v4 | |
with: | |
name: | | |
*bit-omnibot-* | |
- uses: actions/upload-artifact@v4 | |
name: Upload final ET artifact | |
with: | |
name: "omnibot-ET" | |
path: "${{ github.workspace }}/packages/omnibot_et*" | |
retention-days: 1 | |
- uses: actions/upload-artifact@v4 | |
name: Upload final RTCW artifact | |
with: | |
name: "omnibot-RTCW" | |
path: "${{ github.workspace }}/packages/omnibot_rtcw*" | |
retention-days: 1 |