diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..1668d6ebb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,137 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_on_ubuntu: + name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Ubuntu + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + config: + - { plat: "Linux", bits: 64 } + - { plat: "Linux", bits: 32 } + - { plat: "Windows", bits: 64 } + - { plat: "Windows", bits: 32 } + + steps: + - uses: actions/checkout@v2 + + - name: Install Shared Dependencies + run: | + sudo apt-get -y update && + sudo apt-get -y install build-essential + + # Install platform specific dependencies + - name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Linux' && matrix.config.bits == 64 + run: | + sudo apt-get -y install libx11-dev libxi-dev libgl1-mesa-dev + + - name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Linux' && matrix.config.bits == 32 + run: | + sudo dpkg --add-architecture i386 \ + && sudo apt-get -y update \ + && sudo apt-get -y install gcc-multilib libx11-dev:i386 libxi-dev:i386 libgl1-mesa-dev:i386 + + - name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 64 + run: | + sudo apt-get -y install gcc-mingw-w64-x86-64 + + - name: Install Dependencies for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 32 + run: | + sudo apt-get -y install gcc-mingw-w64-i686 + + # Build + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Linux' && matrix.config.bits == 64 + run: | + cd src + make linux + + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Linux' && matrix.config.bits == 32 + run: | + cd src + # Note, this overwrites the previous flags + make linux CFLAGS="-m32" LDFLAGS="-m32" + + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 64 + run: | + cd src + make mingw CC="x86_64-w64-mingw32-gcc" + + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 32 + run: | + cd src + make mingw CC="i686-w64-mingw32-gcc" + + build_on_windows: + name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Windows + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + config: + - { plat: "Windows", bits: 64 } + - { plat: "Windows", bits: 32 } + + steps: + - uses: actions/checkout@v2 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.1 + + # Build + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 64 + run: | + msbuild src\ClassiCube.vcxproj ` + -property:Configuration=Debug -property:Platform=x64 ` + -property:WindowsTargetPlatformVersion=10 -property:PlatformToolset=v142 + + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Windows' && matrix.config.bits == 32 + run: | + msbuild src\ClassiCube.vcxproj ` + -property:Configuration=Debug -property:Platform=Win32 ` + -property:WindowsTargetPlatformVersion=10 -property:PlatformToolset=v142 + + build_on_mac: + name: Build ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) on Mac + runs-on: macOS-latest + + strategy: + fail-fast: false + matrix: + config: + - { plat: "Mac", bits: 64 } + # "ld: warning: ignoring file ..., missing required architecture i386 in file ..." + # "Undefined symbols for architecture i386" + # - { plat: "Mac", bits: 32 } + + steps: + - uses: actions/checkout@v2 + + # Build + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Mac' && matrix.config.bits == 64 + run: | + cd src + # fix for "error: implicit declaration of function 'CGDisplayBitsPerPixel'" + sed -i '' 's|#include |&\'$'\nextern size_t CGDisplayBitsPerPixel(CGDirectDisplayID display);|' interop_cocoa.m + make mac_x64 + + - name: Build for ${{ matrix.config.plat }} (${{ matrix.config.bits }} bit) + if: matrix.config.plat == 'Mac' && matrix.config.bits == 32 + run: | + cd src + make mac_x32 diff --git a/misc/buildbot.sh b/misc/buildbot.sh index 87627e51c..75e71df14 100644 --- a/misc/buildbot.sh +++ b/misc/buildbot.sh @@ -21,7 +21,7 @@ ROOT_DIR=~/client # can be changed ALL_FLAGS="-O1 -s -fno-stack-protector -fno-math-errno -Qn -w" # log file that errors are written to -ERR_FILES=$ROOT_DIR/cc_errors.txt +ERRS_FILE=$ROOT_DIR/cc_errors.txt rm "$ERRS_FILE" # ----------------------------- compile windows @@ -213,4 +213,4 @@ run_timed build_rpi run_timed build_android cd ~ -python3 notify.py \ No newline at end of file +python3 notify.py