123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- # SuperTux
- # Copyright (C) 2020-2021 Jacob Burroughs <maths22@gmail.com>
- # 2020-2021 A. Semphris <semphris@protonmail.com>
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 3
- # of the License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- name: main
- on:
- push:
- branches:
- - master
- tags:
- - '*'
- pull_request: {}
- # TODO the glbinding build
- jobs:
- build-unix:
- strategy:
- fail-fast: false
- matrix:
- arch: [32, 64]
- os: [ubuntu-latest, macos-10.15, macos-11]
- compiler: [gcc, clang]
- build_type: [Debug, Release]
- exclude:
- - os: macos-10.15
- compiler: gcc
- - os: macos-10.15
- arch: 32
- - os: macos-11
- compiler: gcc
- - os: macos-11
- arch: 32
- include:
- - os: ubuntu-latest
- build_type: Release
- compiler: gcc
- arch: 32
- release: 'ON'
- - os: ubuntu-latest
- build_type: Release
- compiler: gcc
- arch: 64
- release: 'ON'
- - os: macos-10.15
- build_type: Release
- release: 'ON'
- - os: macos-11
- build_type: Release
- release: 'ON'
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v2
- with:
- # Fetch the whole tree so git describe works
- fetch-depth: 0
- submodules: true
- - name: Install 64-bit linux dependencies
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 64 }}
- run: |
- sudo apt-get update
- sudo apt-get install -y \
- cmake \
- build-essential \
- automake \
- gtk-doc-tools \
- rpm \
- sshpass \
- clang-6.0 \
- g++-8 \
- gcc-multilib \
- g++-multilib \
- libgtest-dev \
- libc++-dev \
- libogg-dev \
- libvorbis-dev \
- libopenal-dev \
- libboost-all-dev \
- libsdl2-dev \
- libsdl2-image-dev \
- libfreetype6-dev \
- libharfbuzz-dev \
- libfribidi-dev \
- libglib2.0-dev \
- libraqm-dev \
- libglew-dev \
- libcurl4-openssl-dev \
- libglm-dev \
- zlib1g-dev
- - name: Install 32-bit linux dependencies
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 32 }}
- run: |
- sudo dpkg --add-architecture i386
- sudo apt-get update
- # Github is adding a lot of unnecessary deb.sury.org
- # packages into ubuntu-latest, this causes
- # libharfbuzz-dev:i386 to fail due to issues related to
- # libpcre2-8-0 from deb.sury.org. Remove all that and
- # downgrade to official versions.
- sudo apt-get remove --yes php.* libzip4:amd64
- sudo apt-get install --yes --allow-downgrades \
- libpcre2-16-0:amd64=10.34-7 \
- libpcre2-32-0:amd64=10.34-7 \
- libpcre2-8-0:amd64=10.34-7 \
- libpcre2-dev:amd64=10.34-7 \
- libpcre2-posix2:amd64=10.34-7
- sudo apt-get install -y \
- cmake \
- build-essential \
- automake \
- gtk-doc-tools \
- rpm \
- sshpass \
- gcc-multilib \
- g++-multilib \
- libgtest-dev:i386 \
- libogg-dev:i386 \
- libvorbis-dev:i386 \
- libopenal-dev:i386 \
- libboost-date-time-dev:i386 \
- libboost-filesystem-dev:i386 \
- libboost-locale-dev:i386 \
- libsdl2-dev:i386 \
- libsdl2-image-dev:i386 \
- libfreetype6-dev:i386 \
- libcurl4-openssl-dev:i386 \
- libharfbuzz-dev:i386 \
- libfribidi-dev:i386 \
- libglm-dev \
- zlib1g-dev
- # Nethier GLEW nor glbinding exist in 32-bit for Ubuntu 20.04, so snatch the debs from 16.04 instead
- wget archive.ubuntu.com/ubuntu/pool/main/g/glew/libglew1.13_1.13.0-2_i386.deb && sudo dpkg -i libglew1.13_1.13.0-2_i386.deb
- wget archive.ubuntu.com/ubuntu/pool/main/g/glew/libglew-dev_1.13.0-2_i386.deb && sudo dpkg -i libglew-dev_1.13.0-2_i386.deb
- - name: Install macos dependencies
- if: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-11' }}
- run: |
- brew install boost cmake googletest bash libogg libvorbis glew openal-soft sdl2 sdl2_image sdl2_ttf \
- freetype harfbuzz fribidi glib gtk-doc glbinding libraqm glm zlib
- # Something funky happens with freetype if mono is left
- sudo mv /Library/Frameworks/Mono.framework /Library/Frameworks/Mono.framework-disabled
- - name: Set compiler (gcc)
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'gcc' }}
- run: |
- echo "CXX=g++" >> $GITHUB_ENV
- echo "CC=gcc" >> $GITHUB_ENV
- - name: Set compiler (clang)
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' }}
- run: |
- echo "CXX=clang++" >> $GITHUB_ENV
- echo "CC=clang" >> $GITHUB_ENV
- - name: Set compiler (macos)
- if: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-11' }}
- run: |
- # This ensures for now we use clang11
- # Clang12 runs into a bunch of fun with `include location '/usr/local/include' is unsafe for cross-compilation`
- # that we don't care about for now
- echo "CXX=clang++" >> $GITHUB_ENV
- echo "CC=clang" >> $GITHUB_ENV
- - name: Configure build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- ARCH: ${{ matrix.arch == 32 && '-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32' || '' }}
- run: |
- cmake --version
- $CXX --version
- mkdir "build"
- cd "build"
- # TODO add -DGLBINDING_ENABLED=$USE_GLBINDING
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${ARCH} -DENABLE_DISCORD=ON -DWARNINGS=ON -DWERROR=ON -DBUILD_TESTS=ON -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SUBDIR_BIN=bin -DINSTALL_SUBDIR_SHARE=share/supertux2
- - name: Build and install
- working-directory: build
- run: |
- make -j3 VERBOSE=1
- make install DESTDIR="/tmp/supertux" VERBOSE=1
- - name: Run tests
- working-directory: build
- run: ./test_supertux2
- - name: Package
- if: ${{ matrix.os != 'ubuntu-latest' || matrix.arch != '32' }}
- env:
- OS_NAME: ${{ matrix.os }}
- ARCH: ${{ matrix.arch }}
- COMPILER_NAME: ${{ matrix.compiler }}
- BUILD_NAME: ${{ matrix.build_type }}
- PACKAGE: 'ON'
- working-directory: build
- run: ../.ci_scripts/package.sh
- - name: Package (Linux 32-bit)
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == '32' }}
- env:
- OS_NAME: ${{ matrix.os }}
- ARCH: ${{ matrix.arch }}
- COMPILER_NAME: ${{ matrix.compiler }}
- BUILD_NAME: ${{ matrix.build_type }}
- PACKAGE: 'ON'
- working-directory: build
- run: |
- cpack -G TGZ
- mkdir -p upload/
- mv SuperTux* upload/
- # Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
- - uses: actions/upload-artifact@v2
- with:
- name: "${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-${{ matrix.build_type }}-appimage"
- path: build/upload/*.AppImage
- if-no-files-found: ignore
- - uses: actions/upload-artifact@v2
- with:
- name: "source"
- path: build/upload/*Source.tar.gz
- if-no-files-found: ignore
- - uses: actions/upload-artifact@v2
- with:
- name: "${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.compiler }}-${{ matrix.build_type }}-tgz"
- path: build/upload/*Linux.tar.gz
- if-no-files-found: ignore
- - uses: actions/upload-artifact@v2
- with:
- name: "${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-dmg"
- path: build/upload/*.dmg
- if-no-files-found: ignore
- - uses: anshulrgoyal/upload-s3-action@master
- # These all have repository_owner conditions because the secret isn't available to other owners
- if: matrix.release == 'ON' && env.CI_KEY != null
- env:
- CI_KEY: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
- with:
- aws_bucket: supertux-ci-downloads
- aws_key_id: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
- aws_secret_access_key: ${{ secrets.CI_DOWNLOAD_SECRET_ACCESS_KEY }}
- source_dir: 'build/upload'
- destination_dir: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
- - name: Post uploaded file
- if: matrix.release == 'ON' && env.DOWNLOAD_APIKEY != null
- working-directory: build
- run: ../.ci_scripts/deploy.sh
- env:
- PREFIX: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
- DOWNLOAD_APIKEY: ${{ secrets.DOWNLOAD_APIKEY }}
- - name: Create Release
- if: startsWith(github.ref, 'refs/tags/') && matrix.release == 'ON' && github.repository_owner == 'supertux'
- uses: softprops/action-gh-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: 'build/upload/SuperTux-*'
- draft: true
- build-windows:
- strategy:
- fail-fast: false
- matrix:
- arch: [x64, x86]
- build_type: [Debug, Release]
- include:
- - build_type: Release
- release: 'ON'
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v2
- with:
- # Fetch the whole tree so git describe works
- fetch-depth: 0
- submodules: true
- - name: Install dependencies
- env:
- ARCH: ${{ matrix.arch }}
- run: |
- vcpkg integrate install
- vcpkg install gtest:$Env:ARCH-windows
- vcpkg install boost-date-time:$Env:ARCH-windows
- vcpkg install boost-filesystem:$Env:ARCH-windows
- vcpkg install boost-format:$Env:ARCH-windows
- vcpkg install boost-iostreams:$Env:ARCH-windows
- vcpkg install boost-locale:$Env:ARCH-windows
- vcpkg install boost-optional:$Env:ARCH-windows
- vcpkg install boost-system:$Env:ARCH-windows
- vcpkg install curl:$Env:ARCH-windows
- vcpkg install --recurse freetype:$Env:ARCH-windows
- vcpkg install glew:$Env:ARCH-windows
- vcpkg install libogg:$Env:ARCH-windows
- vcpkg install libraqm:$Env:ARCH-windows
- vcpkg install libvorbis:$Env:ARCH-windows
- vcpkg install openal-soft:$Env:ARCH-windows
- vcpkg install sdl2:$Env:ARCH-windows
- vcpkg install sdl2-image[libjpeg-turbo]:$Env:ARCH-windows
- vcpkg install glm:$Env:ARCH-windows
- vcpkg install zlib:$Env:ARCH-windows
- - name: Configure bulid
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- ARCH: ${{ matrix.arch }}
- run: |
- cmake --version
- mkdir build
- cd build
- cmake .. -G "Visual Studio 16 2019" -A $Env:ARCH.replace("x86", "Win32") -DENABLE_DISCORD=ON -DVCPKG_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DHAVE_SDL=true -DPACKAGE_VCREDIST=true -DCMAKE_BUILD_TYPE=$Env:BUILD_TYPE -DBUILD_TESTS=ON
- - name: Build and install
- working-directory: build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- run: |
- cmake --build . --config $Env:BUILD_TYPE
- - name: Package
- working-directory: build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- run: |
- cpack -C $Env:BUILD_TYPE
- mkdir upload
- mv *.msi upload/
- - uses: actions/upload-artifact@v2
- with:
- name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}-installer"
- path: build/upload/*.msi
- if-no-files-found: ignore
- - uses: anshulrgoyal/upload-s3-action@master
- # These all have repository_owner conditions because the secret isn't available to other owners
- if: matrix.release == 'ON' && env.CI_KEY != null
- env:
- CI_KEY: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
- with:
- aws_bucket: supertux-ci-downloads
- aws_key_id: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
- aws_secret_access_key: ${{ secrets.CI_DOWNLOAD_SECRET_ACCESS_KEY }}
- source_dir: 'build/upload'
- destination_dir: "${{ github.sha }}/gh-actions/windows-${{ matrix.arch }}/${{ github.run_id }}"
- - name: Post uploaded file
- shell: bash
- if: matrix.release == 'ON' && env.DOWNLOAD_APIKEY != null
- working-directory: build
- run: ../.ci_scripts/deploy.sh
- env:
- PREFIX: "${{ github.sha }}/gh-actions/windows-${{ matrix.arch }}/${{ github.run_id }}"
- DOWNLOAD_APIKEY: ${{ secrets.DOWNLOAD_APIKEY }}
- IS_WINDOWS: true
- - name: Create Release
- if: startsWith(github.ref, 'refs/tags/') && matrix.release == 'ON' && github.repository_owner == 'supertux'
- uses: softprops/action-gh-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: 'build/upload/SuperTux-*'
- draft: true
|