From 02f85f830c0e0122db1b6bc1cf2d3d7574e0175d Mon Sep 17 00:00:00 2001 From: kimden <23140380+kimden@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:27:56 +0400 Subject: [PATCH] Try to fix switch build --- .github/workflows/apple.yml | 388 ++++++++++----------- .github/workflows/linux.yml | 322 +++++++++--------- .github/workflows/switch.yml | 3 + .github/workflows/windows.yml | 620 +++++++++++++++++----------------- 4 files changed, 668 insertions(+), 665 deletions(-) diff --git a/.github/workflows/apple.yml b/.github/workflows/apple.yml index 2e72e8683ba..b08906df67b 100644 --- a/.github/workflows/apple.yml +++ b/.github/workflows/apple.yml @@ -1,196 +1,196 @@ -name: apple -on: - push: - branches: - - master - tags: - - '*' - pull_request: {} - workflow_dispatch: +# name: apple +# on: +# push: +# branches: +# - master +# tags: +# - '*' +# pull_request: {} +# workflow_dispatch: -jobs: - build: +# jobs: +# build: - strategy: - fail-fast: true - matrix: - platform: [iPhoneOS, MacOSX] - arch: [arm64, x86_64] - exclude: - - platform: iPhoneOS - arch: x86_64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: true - - id: sysroot - uses: ASzc/change-string-case-action@v1 - with: - string: ${{ matrix.platform }} - - name: Download cctools and ISPC - run: | - cd /opt - wget https://github.com/kimden/stk-dependencies/releases/download/cctools/cctools-14.1.tar.xz - tar xf cctools-14.1.tar.xz - rm cctools-14.1.tar.xz - wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz - tar xf ispc-cross-1.26.0.tar.xz - rm ispc-cross-1.26.0.tar.xz - - name: Restore timestamps - run: | - wget https://github.com/MestreLion/git-tools/archive/refs/heads/main.zip - unzip main.zip - python git-tools-main/git-restore-mtime - - name: List build cache restore keys - run: | - # Look for the last 9 build caches (GitHub supports max 10 including current one) - for number in 1 2 3 4 5 6 7 8 9 - do - id=$((${{ github.run_number }} - number)) - echo "cache_$number=apple-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.platform }}-$id" >> $GITHUB_ENV - done - - name: Handle build cache - uses: actions/cache@v3 - with: - path: | - build - key: apple-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.platform }}-${{ github.run_number }} - restore-keys: | - ${{ env.cache_1 }} - ${{ env.cache_2 }} - ${{ env.cache_3 }} - ${{ env.cache_4 }} - ${{ env.cache_5 }} - ${{ env.cache_6 }} - ${{ env.cache_7 }} - ${{ env.cache_8 }} - ${{ env.cache_9 }} - - name: Download dependencies - run: | - wget https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-${{ steps.sysroot.outputs.lowercase }}.tar.xz - tar xf dependencies-${{ steps.sysroot.outputs.lowercase }}.tar.xz - - name: Configure clang runtime name - run: | - if [ ${{ matrix.platform }} = "MacOSX" ]; then - echo "rt=osx" >> $GITHUB_ENV - elif [ ${{ matrix.platform }} = "iPhoneOS" ]; then - echo "rt=ios" >> $GITHUB_ENV - elif [ ${{ matrix.platform }} = "AppleTVOS" ]; then - echo "rt=tvos" >> $GITHUB_ENV - elif [ ${{ matrix.platform }} = "iPhoneSimulator" ]; then - echo "rt=iossim" >> $GITHUB_ENV - elif [ ${{ matrix.platform }} = "AppleTVSimulator" ]; then - echo "rt=tvossim" >> $GITHUB_ENV - fi - - name: Configure bulid - run: | - mkdir -p build - cd build - cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_ARCH=${{ matrix.arch }} -DCCTOOLS_PLATFORM=${{ matrix.platform }} \ - -DRT=/opt/cctools/darwin/libclang_rt.${{ env.rt }}.a -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cctools.cmake -DCHECK_ASSETS=OFF \ - -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc - - name: Build - run: | - cd build - make -j4 - mv bin ../${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} - - name: Upload binaries - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} - path: ${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} - packaging: - name: Packaging STK - needs: build - runs-on: macos-latest - steps: - - name: Configure packaging name for git master branch - if: ${{ github.ref == 'refs/heads/master' }} - run: | - echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV - echo "release_name=preview" >> $GITHUB_ENV - - name: Configure packaging name for tag - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: | - echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV - echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV - - name: Configure packaging name for non-releasing branch - if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }} - run: | - echo "release_tag=" >> $GITHUB_ENV - echo "release_name=" >> $GITHUB_ENV - - name: Check for prerelease - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} - run: | - echo "release_pre=true" >> $GITHUB_ENV - - name: Check for non-prerelease - if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} - run: | - echo "release_pre=false" >> $GITHUB_ENV - - name: Show packaging name - run : | - echo "${{ env.release_tag }}" - echo "${{ env.release_name }}" - echo "${{ env.release_pre }}" - - name: Download binaries - uses: actions/download-artifact@v4 - #- name: Mask developer name - # run: | - # echo "::add-mask::${{ secrets.MAC_DEVELOPER_NAME }}" - #- name: Import certificates - # if: ${{ env.release_tag != '' }} - # uses: apple-actions/import-codesign-certs@v1 - # with: - # p12-file-base64: ${{ secrets.MAC_DEVELOPER_ID_P12_FILE }} - # p12-password: ${{ secrets.MAC_DEVELOPER_ID_P12_PASSWORD }} - - name: Run dylibbundler and sign STK - if: ${{ env.release_tag != '' }} - # env: - # developer_id: "Developer ID Application: ${{ secrets.MAC_DEVELOPER_NAME }} (${{ secrets.MAC_DEVELOPER_TEAM }})" - run: | - wget https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-macosx.tar.xz - tar xf dependencies-macosx.tar.xz - HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler - lipo -create ./macosx-x86_64/supertuxkart.app/Contents/MacOS/supertuxkart ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -output ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart - chmod 755 ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart - install_name_tool -delete_rpath @loader_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib - install_name_tool -delete_rpath @executable_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib - dylibbundler -od -b -x ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -d ./macosx-arm64/supertuxkart.app/Contents/libs/ -p @executable_path/../libs/ -s ./dependencies-macosx/lib -ns - # We use SDL_Vulkan_LoadLibrary for 10.9 compatibility, so otool -L supertuxkart has no libMoltenVK.dylib - cp ./dependencies-macosx/lib/libMoltenVK.dylib ./macosx-arm64/supertuxkart.app/Contents/libs/ - cd ./macosx-arm64/supertuxkart.app/Contents/Resources/data - wget https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip - unzip stk-assets-full.zip - rm stk-assets-full.zip - cd ../../../../.. - mv ./macosx-arm64/supertuxkart.app SuperTuxKart.app - # Use Ad Hoc certificate for now, previous certificate has been expired. - codesign --force -s - SuperTuxKart.app/Contents/libs/*.dylib - codesign --force --deep -s - SuperTuxKart.app - #codesign --force --sign "$developer_id" SuperTuxKart.app/Contents/libs/*.dylib - #codesign --force --options=runtime --deep --sign "$developer_id" SuperTuxKart.app - #- name: "Notarize release build" - # if: ${{ env.release_tag != '' && github.ref != 'refs/heads/master' }} - # run: | - # ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app tmp.zip - # xcrun notarytool submit tmp.zip --apple-id ${{ secrets.STK_NOTARIZATION_USERNAME }} \ - # --password ${{ secrets.STK_NOTARIZATION_PASSWORD }} \ - # --team-id ${{ secrets.MAC_DEVELOPER_TEAM }} --wait - # xcrun stapler staple SuperTuxKart.app - - name: Archive - if: ${{ env.release_tag != '' }} - run: | - ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app SuperTuxKart-${{ env.release_tag }}-mac.zip - - name: Create release - if: ${{ env.release_tag != '' }} - uses: ncipollo/release-action@v1.8.8 - with: - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "SuperTuxKart*.zip" - tag: ${{ env.release_name }} - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - allowUpdates: true - prerelease: ${{ env.release_pre }} +# strategy: +# fail-fast: true +# matrix: +# platform: [iPhoneOS, MacOSX] +# arch: [arm64, x86_64] +# exclude: +# - platform: iPhoneOS +# arch: x86_64 +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# submodules: true +# - id: sysroot +# uses: ASzc/change-string-case-action@v1 +# with: +# string: ${{ matrix.platform }} +# - name: Download cctools and ISPC +# run: | +# cd /opt +# wget https://github.com/kimden/stk-dependencies/releases/download/cctools/cctools-14.1.tar.xz +# tar xf cctools-14.1.tar.xz +# rm cctools-14.1.tar.xz +# wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz +# tar xf ispc-cross-1.26.0.tar.xz +# rm ispc-cross-1.26.0.tar.xz +# - name: Restore timestamps +# run: | +# wget https://github.com/MestreLion/git-tools/archive/refs/heads/main.zip +# unzip main.zip +# python git-tools-main/git-restore-mtime +# - name: List build cache restore keys +# run: | +# # Look for the last 9 build caches (GitHub supports max 10 including current one) +# for number in 1 2 3 4 5 6 7 8 9 +# do +# id=$((${{ github.run_number }} - number)) +# echo "cache_$number=apple-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.platform }}-$id" >> $GITHUB_ENV +# done +# - name: Handle build cache +# uses: actions/cache@v3 +# with: +# path: | +# build +# key: apple-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.platform }}-${{ github.run_number }} +# restore-keys: | +# ${{ env.cache_1 }} +# ${{ env.cache_2 }} +# ${{ env.cache_3 }} +# ${{ env.cache_4 }} +# ${{ env.cache_5 }} +# ${{ env.cache_6 }} +# ${{ env.cache_7 }} +# ${{ env.cache_8 }} +# ${{ env.cache_9 }} +# - name: Download dependencies +# run: | +# wget https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-${{ steps.sysroot.outputs.lowercase }}.tar.xz +# tar xf dependencies-${{ steps.sysroot.outputs.lowercase }}.tar.xz +# - name: Configure clang runtime name +# run: | +# if [ ${{ matrix.platform }} = "MacOSX" ]; then +# echo "rt=osx" >> $GITHUB_ENV +# elif [ ${{ matrix.platform }} = "iPhoneOS" ]; then +# echo "rt=ios" >> $GITHUB_ENV +# elif [ ${{ matrix.platform }} = "AppleTVOS" ]; then +# echo "rt=tvos" >> $GITHUB_ENV +# elif [ ${{ matrix.platform }} = "iPhoneSimulator" ]; then +# echo "rt=iossim" >> $GITHUB_ENV +# elif [ ${{ matrix.platform }} = "AppleTVSimulator" ]; then +# echo "rt=tvossim" >> $GITHUB_ENV +# fi +# - name: Configure bulid +# run: | +# mkdir -p build +# cd build +# cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_ARCH=${{ matrix.arch }} -DCCTOOLS_PLATFORM=${{ matrix.platform }} \ +# -DRT=/opt/cctools/darwin/libclang_rt.${{ env.rt }}.a -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cctools.cmake -DCHECK_ASSETS=OFF \ +# -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc +# - name: Build +# run: | +# cd build +# make -j4 +# mv bin ../${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} +# - name: Upload binaries +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} +# path: ${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} +# packaging: +# name: Packaging STK +# needs: build +# runs-on: macos-latest +# steps: +# - name: Configure packaging name for git master branch +# if: ${{ github.ref == 'refs/heads/master' }} +# run: | +# echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV +# echo "release_name=preview" >> $GITHUB_ENV +# - name: Configure packaging name for tag +# if: ${{ startsWith(github.ref, 'refs/tags/') }} +# run: | +# echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV +# echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV +# - name: Configure packaging name for non-releasing branch +# if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }} +# run: | +# echo "release_tag=" >> $GITHUB_ENV +# echo "release_name=" >> $GITHUB_ENV +# - name: Check for prerelease +# if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=true" >> $GITHUB_ENV +# - name: Check for non-prerelease +# if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=false" >> $GITHUB_ENV +# - name: Show packaging name +# run : | +# echo "${{ env.release_tag }}" +# echo "${{ env.release_name }}" +# echo "${{ env.release_pre }}" +# - name: Download binaries +# uses: actions/download-artifact@v4 +# #- name: Mask developer name +# # run: | +# # echo "::add-mask::${{ secrets.MAC_DEVELOPER_NAME }}" +# #- name: Import certificates +# # if: ${{ env.release_tag != '' }} +# # uses: apple-actions/import-codesign-certs@v1 +# # with: +# # p12-file-base64: ${{ secrets.MAC_DEVELOPER_ID_P12_FILE }} +# # p12-password: ${{ secrets.MAC_DEVELOPER_ID_P12_PASSWORD }} +# - name: Run dylibbundler and sign STK +# if: ${{ env.release_tag != '' }} +# # env: +# # developer_id: "Developer ID Application: ${{ secrets.MAC_DEVELOPER_NAME }} (${{ secrets.MAC_DEVELOPER_TEAM }})" +# run: | +# wget https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-macosx.tar.xz +# tar xf dependencies-macosx.tar.xz +# HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler +# lipo -create ./macosx-x86_64/supertuxkart.app/Contents/MacOS/supertuxkart ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -output ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart +# chmod 755 ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart +# install_name_tool -delete_rpath @loader_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib +# install_name_tool -delete_rpath @executable_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib +# dylibbundler -od -b -x ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -d ./macosx-arm64/supertuxkart.app/Contents/libs/ -p @executable_path/../libs/ -s ./dependencies-macosx/lib -ns +# # We use SDL_Vulkan_LoadLibrary for 10.9 compatibility, so otool -L supertuxkart has no libMoltenVK.dylib +# cp ./dependencies-macosx/lib/libMoltenVK.dylib ./macosx-arm64/supertuxkart.app/Contents/libs/ +# cd ./macosx-arm64/supertuxkart.app/Contents/Resources/data +# wget https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip +# unzip stk-assets-full.zip +# rm stk-assets-full.zip +# cd ../../../../.. +# mv ./macosx-arm64/supertuxkart.app SuperTuxKart.app +# # Use Ad Hoc certificate for now, previous certificate has been expired. +# codesign --force -s - SuperTuxKart.app/Contents/libs/*.dylib +# codesign --force --deep -s - SuperTuxKart.app +# #codesign --force --sign "$developer_id" SuperTuxKart.app/Contents/libs/*.dylib +# #codesign --force --options=runtime --deep --sign "$developer_id" SuperTuxKart.app +# #- name: "Notarize release build" +# # if: ${{ env.release_tag != '' && github.ref != 'refs/heads/master' }} +# # run: | +# # ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app tmp.zip +# # xcrun notarytool submit tmp.zip --apple-id ${{ secrets.STK_NOTARIZATION_USERNAME }} \ +# # --password ${{ secrets.STK_NOTARIZATION_PASSWORD }} \ +# # --team-id ${{ secrets.MAC_DEVELOPER_TEAM }} --wait +# # xcrun stapler staple SuperTuxKart.app +# - name: Archive +# if: ${{ env.release_tag != '' }} +# run: | +# ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app SuperTuxKart-${{ env.release_tag }}-mac.zip +# - name: Create release +# if: ${{ env.release_tag != '' }} +# uses: ncipollo/release-action@v1.8.8 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# artifacts: "SuperTuxKart*.zip" +# tag: ${{ env.release_name }} +# omitBodyDuringUpdate: true +# omitNameDuringUpdate: true +# allowUpdates: true +# prerelease: ${{ env.release_pre }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index add1375097c..b5b60285f72 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,168 +1,168 @@ -# Copyright (C) 2020-2021 Jacob Burroughs -# 2020-2021 A. Semphris -# -# Released under the Creative Commons Zero (CC0) license, available at: -# Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode -# Information: https://creativecommons.org/share-your-work/public-domain/cc0/ +# # Copyright (C) 2020-2021 Jacob Burroughs +# # 2020-2021 A. Semphris +# # +# # Released under the Creative Commons Zero (CC0) license, available at: +# # Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode +# # Information: https://creativecommons.org/share-your-work/public-domain/cc0/ -# Note: Parts of this code were taken from the SuperTux project. -# ~ Semphris (responsible for transfering and adapting the file) +# # Note: Parts of this code were taken from the SuperTux project. +# # ~ Semphris (responsible for transfering and adapting the file) -name: linux -on: - push: - branches: - - master - tags: - - '*' - pull_request: {} - workflow_dispatch: +# name: linux +# on: +# push: +# branches: +# - master +# tags: +# - '*' +# pull_request: {} +# workflow_dispatch: -jobs: - build: +# jobs: +# build: - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest] - compiler: [gcc, clang] - build_type: [Debug, RelWithDebInfo, Release] - server_only: [ON, OFF] - exclude: - - os: macos-latest - compiler: gcc - - os: macos-latest - build_type: Debug +# strategy: +# fail-fast: true +# matrix: +# os: [ubuntu-latest] +# compiler: [gcc, clang] +# build_type: [Debug, RelWithDebInfo, Release] +# server_only: [ON, OFF] +# exclude: +# - os: macos-latest +# compiler: gcc +# - os: macos-latest +# build_type: Debug - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - submodules: true - - name: Configure packaging name for git master branch - if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' && - github.ref == 'refs/heads/master' }} - run: | - echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV - echo "release_name=preview" >> $GITHUB_ENV - - name: Configure packaging name for tag - if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' && - startsWith(github.ref, 'refs/tags/') }} - run: | - echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV - echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV - - name: Configure packaging name for non-releasing branch - if: ${{ matrix.build_type != 'Release' || matrix.server_only != 'OFF' || - !(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }} - run: | - echo "release_tag=" >> $GITHUB_ENV - echo "release_name=" >> $GITHUB_ENV - - name: Check for prerelease - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} - run: | - echo "release_pre=true" >> $GITHUB_ENV - - name: Check for non-prerelease - if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} - run: | - echo "release_pre=false" >> $GITHUB_ENV - - name: Show packaging name - run : | - echo "${{ env.release_tag }}" - echo "${{ env.release_name }}" - echo "${{ env.release_pre }}" - - name: Install linux dependencies - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - sudo apt-get update - sudo apt install -y build-essential cmake libbluetooth-dev libcurl4-gnutls-dev \ - libfreetype6-dev libharfbuzz-dev libjpeg-dev libogg-dev libopenal-dev \ - libpng-dev libsdl2-dev libvorbis-dev pkg-config zlib1g-dev clang - - name: Install dylibbundler for packaging osx binary - if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} - run: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler - - name: Install macos dependencies - if: ${{ matrix.os == 'macos-latest' }} - run: | - # Something funky happens with freetype if mono is left - sudo mv /Library/Frameworks/Mono.framework /Library/Frameworks/Mono.framework-disabled - wget https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-mac.tar.xz - # Remove any existing installation to avoid conflict with bundled dependencies - rm -rf /usr/local/include/* - rm -rf /usr/local/opt/openssl@1.1/include - rm -rf /usr/local/opt/freetype - rm -rf /usr/local/opt/harfbuzz - tar xf dependencies-mac.tar.xz -C /usr/local - rm dependencies-mac.tar.xz - - 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-latest' }} - 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 bulid (linux) - if: ${{ matrix.os != 'macos-latest' }} - env: - BUILD_TYPE: ${{ matrix.build_type }} - SERVER_ONLY: ${{ matrix.server_only }} - run: | - cmake --version - $CXX --version - mkdir "build" - cd "build" - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off -DNO_SHADERC=on; - - name: Configure bulid (macos) - if: ${{ matrix.os == 'macos-latest' }} - env: - BUILD_TYPE: ${{ matrix.build_type }} - SERVER_ONLY: ${{ matrix.server_only }} - run: | - cmake --version - $CXX --version - mkdir "build" - cd "build" - CFLAGS="-mmacosx-version-min=10.13" CXXFLAGS="-mmacosx-version-min=10.13" LINKFLAGS="-mmacosx-version-min=10.13" LDFLAGS="-mmacosx-version-min=10.13" /usr/local/opt/cmake/bin/cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off; - - name: Build and install - working-directory: build - run: | - make -j3 VERBOSE=1 - make install DESTDIR="/tmp/stk" VERBOSE=1 - - name: Packaging (macos) - if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} - working-directory: build - run: | - /usr/local/opt/dylibbundler/bin/dylibbundler -od -b -x ./bin/SuperTuxKart.app/Contents/MacOS/supertuxkart -d ./bin/SuperTuxKart.app/Contents/libs/ -p @executable_path/../libs/ - wget https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip - unzip stk-assets-full.zip -d ../data - rm stk-assets-full.zip - cd bin - # Fix the name on case insensitive filesystem - mv supertuxkart.app stk.app - mv stk.app SuperTuxKart.app - zip -r ../SuperTuxKart-${{ env.release_tag }}-mac.zip . - - name: Create Release (macos) - if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "build/SuperTuxKart-${{ env.release_tag }}-mac.zip" - tag: ${{ env.release_name }} - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - allowUpdates: true - prerelease: ${{ env.release_pre }} +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 1 +# submodules: true +# - name: Configure packaging name for git master branch +# if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' && +# github.ref == 'refs/heads/master' }} +# run: | +# echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV +# echo "release_name=preview" >> $GITHUB_ENV +# - name: Configure packaging name for tag +# if: ${{ matrix.build_type == 'Release' && matrix.server_only == 'OFF' && +# startsWith(github.ref, 'refs/tags/') }} +# run: | +# echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV +# echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV +# - name: Configure packaging name for non-releasing branch +# if: ${{ matrix.build_type != 'Release' || matrix.server_only != 'OFF' || +# !(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }} +# run: | +# echo "release_tag=" >> $GITHUB_ENV +# echo "release_name=" >> $GITHUB_ENV +# - name: Check for prerelease +# if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=true" >> $GITHUB_ENV +# - name: Check for non-prerelease +# if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=false" >> $GITHUB_ENV +# - name: Show packaging name +# run : | +# echo "${{ env.release_tag }}" +# echo "${{ env.release_name }}" +# echo "${{ env.release_pre }}" +# - name: Install linux dependencies +# if: ${{ matrix.os == 'ubuntu-latest' }} +# run: | +# sudo apt-get update +# sudo apt install -y build-essential cmake libbluetooth-dev libcurl4-gnutls-dev \ +# libfreetype6-dev libharfbuzz-dev libjpeg-dev libogg-dev libopenal-dev \ +# libpng-dev libsdl2-dev libvorbis-dev pkg-config zlib1g-dev clang +# - name: Install dylibbundler for packaging osx binary +# if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} +# run: | +# HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler +# - name: Install macos dependencies +# if: ${{ matrix.os == 'macos-latest' }} +# run: | +# # Something funky happens with freetype if mono is left +# sudo mv /Library/Frameworks/Mono.framework /Library/Frameworks/Mono.framework-disabled +# wget https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-mac.tar.xz +# # Remove any existing installation to avoid conflict with bundled dependencies +# rm -rf /usr/local/include/* +# rm -rf /usr/local/opt/openssl@1.1/include +# rm -rf /usr/local/opt/freetype +# rm -rf /usr/local/opt/harfbuzz +# tar xf dependencies-mac.tar.xz -C /usr/local +# rm dependencies-mac.tar.xz +# - 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-latest' }} +# 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 bulid (linux) +# if: ${{ matrix.os != 'macos-latest' }} +# env: +# BUILD_TYPE: ${{ matrix.build_type }} +# SERVER_ONLY: ${{ matrix.server_only }} +# run: | +# cmake --version +# $CXX --version +# mkdir "build" +# cd "build" +# cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off -DNO_SHADERC=on; +# - name: Configure bulid (macos) +# if: ${{ matrix.os == 'macos-latest' }} +# env: +# BUILD_TYPE: ${{ matrix.build_type }} +# SERVER_ONLY: ${{ matrix.server_only }} +# run: | +# cmake --version +# $CXX --version +# mkdir "build" +# cd "build" +# CFLAGS="-mmacosx-version-min=10.13" CXXFLAGS="-mmacosx-version-min=10.13" LINKFLAGS="-mmacosx-version-min=10.13" LDFLAGS="-mmacosx-version-min=10.13" /usr/local/opt/cmake/bin/cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSERVER_ONLY=$SERVER_ONLY -DCHECK_ASSETS=off -DBUILD_RECORDER=off; +# - name: Build and install +# working-directory: build +# run: | +# make -j3 VERBOSE=1 +# make install DESTDIR="/tmp/stk" VERBOSE=1 +# - name: Packaging (macos) +# if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} +# working-directory: build +# run: | +# /usr/local/opt/dylibbundler/bin/dylibbundler -od -b -x ./bin/SuperTuxKart.app/Contents/MacOS/supertuxkart -d ./bin/SuperTuxKart.app/Contents/libs/ -p @executable_path/../libs/ +# wget https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip +# unzip stk-assets-full.zip -d ../data +# rm stk-assets-full.zip +# cd bin +# # Fix the name on case insensitive filesystem +# mv supertuxkart.app stk.app +# mv stk.app SuperTuxKart.app +# zip -r ../SuperTuxKart-${{ env.release_tag }}-mac.zip . +# - name: Create Release (macos) +# if: ${{ env.release_tag != '' && matrix.os == 'macos-latest' && matrix.build_type == 'Release' && matrix.server_only == 'OFF' }} +# uses: ncipollo/release-action@v1 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# artifacts: "build/SuperTuxKart-${{ env.release_tag }}-mac.zip" +# tag: ${{ env.release_name }} +# omitBodyDuringUpdate: true +# omitNameDuringUpdate: true +# allowUpdates: true +# prerelease: ${{ env.release_pre }} diff --git a/.github/workflows/switch.yml b/.github/workflows/switch.yml index 372f0db9453..f0ed1c53332 100644 --- a/.github/workflows/switch.yml +++ b/.github/workflows/switch.yml @@ -22,6 +22,9 @@ jobs: # We need 0 so we get all commits for mtime! fetch-depth: 0 path: "./stk-code" + - name: Install additional dependencies + run: | + sudo apt-get update && sudo apt-get install -y libfreetype6-dev - name: Grab assets run: | wget -q https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f1aa25cd0ea..204ddd1b988 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,312 +1,312 @@ -name: windows -on: - push: - branches: - - master - tags: - - '*' - pull_request: {} - workflow_dispatch: +# name: windows +# on: +# push: +# branches: +# - master +# tags: +# - '*' +# pull_request: {} +# workflow_dispatch: -jobs: - build: - strategy: - fail-fast: true - matrix: - arch: [i686, x86_64, armv7, aarch64] - os: [windows-latest, ubuntu-latest] - exclude: - - arch: armv7 - os: windows-latest - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: false - - name: Set up environment for windows-latest - shell : bash - if: ${{ matrix.os == 'windows-latest' }} - run: | - echo "wget=C:\msys64\usr\bin\wget.exe" >> $GITHUB_ENV - echo "unzip=unzip" >> $GITHUB_ENV - if [ ${{ matrix.arch }} = "i686" ]; then - echo "cmake_arch=Win32" >> $GITHUB_ENV - elif [ ${{ matrix.arch }} = "x86_64" ]; then - echo "cmake_arch=x64" >> $GITHUB_ENV - elif [ ${{ matrix.arch }} = "armv7" ]; then - echo "cmake_arch=ARM" >> $GITHUB_ENV - else - echo "cmake_arch=ARM64" >> $GITHUB_ENV - fi - - name: Set up environment for ubuntu-latest - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - echo "wget=wget" >> $GITHUB_ENV - echo "unzip=unzip" >> $GITHUB_ENV - - name: Restore timestamps - run: | - ${{ env.wget }} https://github.com/MestreLion/git-tools/archive/refs/heads/main.zip - ${{ env.unzip }} main.zip - python git-tools-main/git-restore-mtime - - name: List build cache restore keys - shell : bash - run: | - # Look for the last 9 build caches (GitHub supports max 10 including current one) - for number in 1 2 3 4 5 6 7 8 9 - do - id=$((${{ github.run_number }} - number)) - echo "cache_$number=windows-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.os }}-$id" >> $GITHUB_ENV - done - - name: Handle build cache - uses: actions/cache@v3 - with: - path: | - build - key: windows-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.os }}-${{ github.run_number }} - restore-keys: | - ${{ env.cache_1 }} - ${{ env.cache_2 }} - ${{ env.cache_3 }} - ${{ env.cache_4 }} - ${{ env.cache_5 }} - ${{ env.cache_6 }} - ${{ env.cache_7 }} - ${{ env.cache_8 }} - ${{ env.cache_9 }} - - name: Download dependencies - run: | - ${{ env.wget }} https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-win-${{ matrix.arch }}.zip - ${{ env.unzip }} dependencies-win-${{ matrix.arch }}.zip - - name: Download ISPC for MinGW - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - cd /opt - wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz - tar xf ispc-cross-1.26.0.tar.xz - rm ispc-cross-1.26.0.tar.xz - - name: Install MinGW for i686 or x86_64 - if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'i686' || matrix.arch == 'x86_64' ) }} - run: | - cd / - sudo mkdir -p /data/mxe/usr - cd /data/mxe/usr - # It's compiled from https://github.com/mxe/mxe - sudo wget https://github.com/kimden/stk-dependencies/releases/download/preview/mxe_static_mingw.zip - sudo unzip mxe_static_mingw.zip - sudo rm mxe_static_mingw.zip - # For libfl.so.2 - sudo apt install -y libfl-dev - - name: Install MinGW for armv7 or aarch64 - if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }} - run: | - cd / - sudo wget https://github.com/mstorsjo/llvm-mingw/releases/download/20210423/llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz - sudo tar xf llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz - sudo mv llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64 llvm-mingw - - name: Set up MinGW Toolchain for i686 - if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686' }} - run: | - echo "SET(CMAKE_SYSTEM_NAME Windows)" > toolchain.cmake - echo "SET(CMAKE_C_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-gcc)" >> toolchain.cmake - echo "SET(CMAKE_CXX_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-g++)" >> toolchain.cmake - echo "SET(CMAKE_RC_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-windres)" >> toolchain.cmake - echo "SET(CMAKE_FIND_ROOT_PATH \${PROJECT_SOURCE_DIR}/dependencies-win-i686 /data/mxe/usr/i686-w64-mingw32.static.posix.dw2/ /data/mxe/usr/lib/gcc/i686-w64-mingw32.static.posix.dw2/11.5.0/)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake - echo 'set(ISPC_ARCH "x86")' >> toolchain.cmake - - name: Set up MinGW Toolchain for x86_64 - if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' }} - run: | - echo "SET(CMAKE_SYSTEM_NAME Windows)" > toolchain.cmake - echo "SET(CMAKE_C_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-gcc)" >> toolchain.cmake - echo "SET(CMAKE_CXX_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-g++)" >> toolchain.cmake - echo "SET(CMAKE_RC_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-windres)" >> toolchain.cmake - echo "SET(CMAKE_FIND_ROOT_PATH \${PROJECT_SOURCE_DIR}/dependencies-win-x86_64 /data/mxe/usr/x86_64-w64-mingw32.static.posix.seh/ /data/mxe/usr/lib/gcc/x86_64-w64-mingw32.static.posix.seh/11.5.0/)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake - echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake - echo 'set(ISPC_ARCH "x86-64")' >> toolchain.cmake - # Manually specify CMAKE_SYSTEM_PROCESSOR, it can only be set together with -DDCMAKE_SYSTEM_NAME - - name: Configure build for MSVC - if: ${{ matrix.os == 'windows-latest' }} - run: | - mkdir -Force build - cd build - cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -A ${{ env.cmake_arch }} -DCHECK_ASSETS=OFF - - name: Configure build for MinGW (i686 or x86_64) - if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch != 'armv7' && matrix.arch != 'aarch64' }} - run: | - mkdir -p build - cd build - cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc - - name: Configure build for MinGW (armv7 or aarch64) - if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }} - run: | - mkdir -p build - cd build - cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc - - name: Build for MSVC - if: ${{ matrix.os == 'windows-latest' }} - working-directory: build - run: | - cmake --build . --config Debug - - name: Build for MinGW - if: ${{ matrix.os == 'ubuntu-latest' }} - working-directory: build - run: | - make -j4 - cd .. - mv COPYING tools - - name: Upload binaries of MinGW - if: ${{ matrix.os == 'ubuntu-latest' }} - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.arch }} - path: build/bin/* - - name: Upload stk-code/data - # We only need to upload stk-code/data once - if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686'}} - uses: actions/upload-artifact@v4 - with: - name: data - path: data - - name: Upload stk-code/tools - # We only need to upload stk-code/tools once - if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686'}} - uses: actions/upload-artifact@v4 - with: - name: tools - path: tools - - name: Remove built binaries for less cache size - shell : bash - run: | - rm -rf build/Debug - rm -rf build/bin +# jobs: +# build: +# strategy: +# fail-fast: true +# matrix: +# arch: [i686, x86_64, armv7, aarch64] +# os: [windows-latest, ubuntu-latest] +# exclude: +# - arch: armv7 +# os: windows-latest +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# submodules: false +# - name: Set up environment for windows-latest +# shell : bash +# if: ${{ matrix.os == 'windows-latest' }} +# run: | +# echo "wget=C:\msys64\usr\bin\wget.exe" >> $GITHUB_ENV +# echo "unzip=unzip" >> $GITHUB_ENV +# if [ ${{ matrix.arch }} = "i686" ]; then +# echo "cmake_arch=Win32" >> $GITHUB_ENV +# elif [ ${{ matrix.arch }} = "x86_64" ]; then +# echo "cmake_arch=x64" >> $GITHUB_ENV +# elif [ ${{ matrix.arch }} = "armv7" ]; then +# echo "cmake_arch=ARM" >> $GITHUB_ENV +# else +# echo "cmake_arch=ARM64" >> $GITHUB_ENV +# fi +# - name: Set up environment for ubuntu-latest +# if: ${{ matrix.os == 'ubuntu-latest' }} +# run: | +# echo "wget=wget" >> $GITHUB_ENV +# echo "unzip=unzip" >> $GITHUB_ENV +# - name: Restore timestamps +# run: | +# ${{ env.wget }} https://github.com/MestreLion/git-tools/archive/refs/heads/main.zip +# ${{ env.unzip }} main.zip +# python git-tools-main/git-restore-mtime +# - name: List build cache restore keys +# shell : bash +# run: | +# # Look for the last 9 build caches (GitHub supports max 10 including current one) +# for number in 1 2 3 4 5 6 7 8 9 +# do +# id=$((${{ github.run_number }} - number)) +# echo "cache_$number=windows-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.os }}-$id" >> $GITHUB_ENV +# done +# - name: Handle build cache +# uses: actions/cache@v3 +# with: +# path: | +# build +# key: windows-${{ github.ref }}-${{ matrix.arch }}-${{ matrix.os }}-${{ github.run_number }} +# restore-keys: | +# ${{ env.cache_1 }} +# ${{ env.cache_2 }} +# ${{ env.cache_3 }} +# ${{ env.cache_4 }} +# ${{ env.cache_5 }} +# ${{ env.cache_6 }} +# ${{ env.cache_7 }} +# ${{ env.cache_8 }} +# ${{ env.cache_9 }} +# - name: Download dependencies +# run: | +# ${{ env.wget }} https://github.com/kimden/stk-dependencies/releases/download/preview/dependencies-win-${{ matrix.arch }}.zip +# ${{ env.unzip }} dependencies-win-${{ matrix.arch }}.zip +# - name: Download ISPC for MinGW +# if: ${{ matrix.os == 'ubuntu-latest' }} +# run: | +# cd /opt +# wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz +# tar xf ispc-cross-1.26.0.tar.xz +# rm ispc-cross-1.26.0.tar.xz +# - name: Install MinGW for i686 or x86_64 +# if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'i686' || matrix.arch == 'x86_64' ) }} +# run: | +# cd / +# sudo mkdir -p /data/mxe/usr +# cd /data/mxe/usr +# # It's compiled from https://github.com/mxe/mxe +# sudo wget https://github.com/kimden/stk-dependencies/releases/download/preview/mxe_static_mingw.zip +# sudo unzip mxe_static_mingw.zip +# sudo rm mxe_static_mingw.zip +# # For libfl.so.2 +# sudo apt install -y libfl-dev +# - name: Install MinGW for armv7 or aarch64 +# if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }} +# run: | +# cd / +# sudo wget https://github.com/mstorsjo/llvm-mingw/releases/download/20210423/llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz +# sudo tar xf llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz +# sudo mv llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64 llvm-mingw +# - name: Set up MinGW Toolchain for i686 +# if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686' }} +# run: | +# echo "SET(CMAKE_SYSTEM_NAME Windows)" > toolchain.cmake +# echo "SET(CMAKE_C_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-gcc)" >> toolchain.cmake +# echo "SET(CMAKE_CXX_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-g++)" >> toolchain.cmake +# echo "SET(CMAKE_RC_COMPILER /data/mxe/usr/bin/i686-w64-mingw32.static.posix.dw2-windres)" >> toolchain.cmake +# echo "SET(CMAKE_FIND_ROOT_PATH \${PROJECT_SOURCE_DIR}/dependencies-win-i686 /data/mxe/usr/i686-w64-mingw32.static.posix.dw2/ /data/mxe/usr/lib/gcc/i686-w64-mingw32.static.posix.dw2/11.5.0/)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake +# echo 'set(ISPC_ARCH "x86")' >> toolchain.cmake +# - name: Set up MinGW Toolchain for x86_64 +# if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' }} +# run: | +# echo "SET(CMAKE_SYSTEM_NAME Windows)" > toolchain.cmake +# echo "SET(CMAKE_C_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-gcc)" >> toolchain.cmake +# echo "SET(CMAKE_CXX_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-g++)" >> toolchain.cmake +# echo "SET(CMAKE_RC_COMPILER /data/mxe/usr/bin/x86_64-w64-mingw32.static.posix.seh-windres)" >> toolchain.cmake +# echo "SET(CMAKE_FIND_ROOT_PATH \${PROJECT_SOURCE_DIR}/dependencies-win-x86_64 /data/mxe/usr/x86_64-w64-mingw32.static.posix.seh/ /data/mxe/usr/lib/gcc/x86_64-w64-mingw32.static.posix.seh/11.5.0/)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake +# echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake +# echo 'set(ISPC_ARCH "x86-64")' >> toolchain.cmake +# # Manually specify CMAKE_SYSTEM_PROCESSOR, it can only be set together with -DDCMAKE_SYSTEM_NAME +# - name: Configure build for MSVC +# if: ${{ matrix.os == 'windows-latest' }} +# run: | +# mkdir -Force build +# cd build +# cmake .. -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -A ${{ env.cmake_arch }} -DCHECK_ASSETS=OFF +# - name: Configure build for MinGW (i686 or x86_64) +# if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch != 'armv7' && matrix.arch != 'aarch64' }} +# run: | +# mkdir -p build +# cd build +# cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc +# - name: Configure build for MinGW (armv7 or aarch64) +# if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }} +# run: | +# mkdir -p build +# cd build +# cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc +# - name: Build for MSVC +# if: ${{ matrix.os == 'windows-latest' }} +# working-directory: build +# run: | +# cmake --build . --config Debug +# - name: Build for MinGW +# if: ${{ matrix.os == 'ubuntu-latest' }} +# working-directory: build +# run: | +# make -j4 +# cd .. +# mv COPYING tools +# - name: Upload binaries of MinGW +# if: ${{ matrix.os == 'ubuntu-latest' }} +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ matrix.arch }} +# path: build/bin/* +# - name: Upload stk-code/data +# # We only need to upload stk-code/data once +# if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686'}} +# uses: actions/upload-artifact@v4 +# with: +# name: data +# path: data +# - name: Upload stk-code/tools +# # We only need to upload stk-code/tools once +# if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'i686'}} +# uses: actions/upload-artifact@v4 +# with: +# name: tools +# path: tools +# - name: Remove built binaries for less cache size +# shell : bash +# run: | +# rm -rf build/Debug +# rm -rf build/bin - packaging: - name: Packaging STK - needs: build - runs-on: windows-latest - steps: - - name: Configure packaging name for git master branch - shell : bash - if: ${{ github.ref == 'refs/heads/master' }} - run: | - echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV - echo "release_name=preview" >> $GITHUB_ENV - - name: Configure packaging name for tag - shell : bash - if: ${{ startsWith(github.ref, 'refs/tags/') }} - run: | - echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV - echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV - - name: Configure packaging name for non-releasing branch - shell : bash - if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }} - run: | - echo "release_tag=" >> $GITHUB_ENV - echo "release_name=" >> $GITHUB_ENV - - name: Check for prerelease - shell : bash - if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} - run: | - echo "release_pre=true" >> $GITHUB_ENV - - name: Check for non-prerelease - shell : bash - if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} - run: | - echo "release_pre=false" >> $GITHUB_ENV - - name: Show packaging name - shell : bash - run : | - echo "${{ env.release_tag }}" - echo "${{ env.release_name }}" - echo "${{ env.release_pre }}" - - name: Download MinGW binaries and data - uses: actions/download-artifact@v4 - - name: Generate .pdb files - if: ${{ env.release_tag != '' }} - run: | - C:\msys64\usr\bin\wget.exe https://github.com/rainers/cv2pdb/releases/download/v0.50/cv2pdb-0.50.zip - unzip cv2pdb-0.50.zip - cd i686 - ..\cv2pdb.exe supertuxkart.exe - cd .. - cd x86_64 - ..\cv2pdb.exe supertuxkart.exe - - name: Downloading stk-assets - if: ${{ env.release_tag != '' }} - run: | - C:\msys64\usr\bin\wget.exe https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip - mkdir stk-assets - cd stk-assets - unzip ..\stk-assets-full.zip - - name: Move folders - shell : bash - if: ${{ env.release_tag != '' }} - run: | - mkdir SuperTuxKart-${{ env.release_tag }}-win - mv stk-assets SuperTuxKart-${{ env.release_tag }}-win - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code - mv data SuperTuxKart-${{ env.release_tag }}-win/stk-code - mv tools/run_game.bat SuperTuxKart-${{ env.release_tag }}-win - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686 - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64 - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7 - mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64 - mv i686 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686/bin - mv x86_64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64/bin - mv armv7 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin - mv aarch64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin - # libwinpthread-1.dll is useless because we statically link - rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin/libwinpthread-1.dll - rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin/libwinpthread-1.dll - - name: Start packaging STK - if: ${{ env.release_tag != '' }} - run: | - Compress-Archive -LiteralPath SuperTuxKart-${{ env.release_tag }}-win -DestinationPath SuperTuxKart-${{ env.release_tag }}-win.zip - - name: Configure NSIS script - shell : bash - if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} - run: | - mv tools SuperTuxKart-${{ env.release_tag }}-win/stk-code - cd SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer - for arch in i686 x86_64 aarch64 - do - cp supertuxkart-github-actions.nsi $arch.nsi - sed -i "s/define APPNAMEANDVERSION \"\"/define APPNAMEANDVERSION \"SuperTuxKart ${{ env.release_tag }}\"/g" $arch.nsi - sed -i "s/define ARCH \"\"/define ARCH \"$arch\"/g" $arch.nsi - sed -i "s/define VERSION \"\"/define VERSION \"${{ env.release_tag }}\"/g" $arch.nsi - sed -i "s/OutFile \"\"/OutFile \"SuperTuxKart-${{ env.release_tag }}-installer-$arch.exe\"/g" $arch.nsi - for filename in $(ls ../../build-$arch/bin) - do - file="\\\\$filename" - sed -i "288a\ DELETE /REBOOTOK \"\$INSTDIR$file\"" $arch.nsi - done - # Print result - #cat $arch.nsi - done - mv ../COPYING ../.. - - name: Run makensis.exe - if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} - run: | - cd SuperTuxKart-${{ env.release_tag }}-win\stk-code\tools\windows_installer - C:\msys64\usr\bin\wget.exe https://nsis.sourceforge.io/mediawiki/images/6/6c/Shelllink.zip - unzip Shelllink.zip - Move-Item Unicode\Plugins\ShellLink.dll . - & "C:\Program Files (x86)\NSIS\makensis.exe" i686.nsi - & "C:\Program Files (x86)\NSIS\makensis.exe" x86_64.nsi - & "C:\Program Files (x86)\NSIS\makensis.exe" aarch64.nsi - - name: Create release - uses: ncipollo/release-action@v1.8.8 - if: ${{ env.release_tag != '' }} - with: - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "SuperTuxKart-*.zip, SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer/*.exe" - tag: ${{ env.release_name }} - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - allowUpdates: true - prerelease: ${{ env.release_pre }} +# packaging: +# name: Packaging STK +# needs: build +# runs-on: windows-latest +# steps: +# - name: Configure packaging name for git master branch +# shell : bash +# if: ${{ github.ref == 'refs/heads/master' }} +# run: | +# echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV +# echo "release_name=preview" >> $GITHUB_ENV +# - name: Configure packaging name for tag +# shell : bash +# if: ${{ startsWith(github.ref, 'refs/tags/') }} +# run: | +# echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV +# echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV +# - name: Configure packaging name for non-releasing branch +# shell : bash +# if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }} +# run: | +# echo "release_tag=" >> $GITHUB_ENV +# echo "release_name=" >> $GITHUB_ENV +# - name: Check for prerelease +# shell : bash +# if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=true" >> $GITHUB_ENV +# - name: Check for non-prerelease +# shell : bash +# if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} +# run: | +# echo "release_pre=false" >> $GITHUB_ENV +# - name: Show packaging name +# shell : bash +# run : | +# echo "${{ env.release_tag }}" +# echo "${{ env.release_name }}" +# echo "${{ env.release_pre }}" +# - name: Download MinGW binaries and data +# uses: actions/download-artifact@v4 +# - name: Generate .pdb files +# if: ${{ env.release_tag != '' }} +# run: | +# C:\msys64\usr\bin\wget.exe https://github.com/rainers/cv2pdb/releases/download/v0.50/cv2pdb-0.50.zip +# unzip cv2pdb-0.50.zip +# cd i686 +# ..\cv2pdb.exe supertuxkart.exe +# cd .. +# cd x86_64 +# ..\cv2pdb.exe supertuxkart.exe +# - name: Downloading stk-assets +# if: ${{ env.release_tag != '' }} +# run: | +# C:\msys64\usr\bin\wget.exe https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip +# mkdir stk-assets +# cd stk-assets +# unzip ..\stk-assets-full.zip +# - name: Move folders +# shell : bash +# if: ${{ env.release_tag != '' }} +# run: | +# mkdir SuperTuxKart-${{ env.release_tag }}-win +# mv stk-assets SuperTuxKart-${{ env.release_tag }}-win +# mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code +# mv data SuperTuxKart-${{ env.release_tag }}-win/stk-code +# mv tools/run_game.bat SuperTuxKart-${{ env.release_tag }}-win +# mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686 +# mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64 +# mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7 +# mkdir SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64 +# mv i686 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-i686/bin +# mv x86_64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-x86_64/bin +# mv armv7 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin +# mv aarch64 SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin +# # libwinpthread-1.dll is useless because we statically link +# rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-armv7/bin/libwinpthread-1.dll +# rm -f SuperTuxKart-${{ env.release_tag }}-win/stk-code/build-aarch64/bin/libwinpthread-1.dll +# - name: Start packaging STK +# if: ${{ env.release_tag != '' }} +# run: | +# Compress-Archive -LiteralPath SuperTuxKart-${{ env.release_tag }}-win -DestinationPath SuperTuxKart-${{ env.release_tag }}-win.zip +# - name: Configure NSIS script +# shell : bash +# if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} +# run: | +# mv tools SuperTuxKart-${{ env.release_tag }}-win/stk-code +# cd SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer +# for arch in i686 x86_64 aarch64 +# do +# cp supertuxkart-github-actions.nsi $arch.nsi +# sed -i "s/define APPNAMEANDVERSION \"\"/define APPNAMEANDVERSION \"SuperTuxKart ${{ env.release_tag }}\"/g" $arch.nsi +# sed -i "s/define ARCH \"\"/define ARCH \"$arch\"/g" $arch.nsi +# sed -i "s/define VERSION \"\"/define VERSION \"${{ env.release_tag }}\"/g" $arch.nsi +# sed -i "s/OutFile \"\"/OutFile \"SuperTuxKart-${{ env.release_tag }}-installer-$arch.exe\"/g" $arch.nsi +# for filename in $(ls ../../build-$arch/bin) +# do +# file="\\\\$filename" +# sed -i "288a\ DELETE /REBOOTOK \"\$INSTDIR$file\"" $arch.nsi +# done +# # Print result +# #cat $arch.nsi +# done +# mv ../COPYING ../.. +# - name: Run makensis.exe +# if: ${{ env.release_tag != '' && startsWith(github.ref, 'refs/tags/') }} +# run: | +# cd SuperTuxKart-${{ env.release_tag }}-win\stk-code\tools\windows_installer +# C:\msys64\usr\bin\wget.exe https://nsis.sourceforge.io/mediawiki/images/6/6c/Shelllink.zip +# unzip Shelllink.zip +# Move-Item Unicode\Plugins\ShellLink.dll . +# & "C:\Program Files (x86)\NSIS\makensis.exe" i686.nsi +# & "C:\Program Files (x86)\NSIS\makensis.exe" x86_64.nsi +# & "C:\Program Files (x86)\NSIS\makensis.exe" aarch64.nsi +# - name: Create release +# uses: ncipollo/release-action@v1.8.8 +# if: ${{ env.release_tag != '' }} +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# artifacts: "SuperTuxKart-*.zip, SuperTuxKart-${{ env.release_tag }}-win/stk-code/tools/windows_installer/*.exe" +# tag: ${{ env.release_name }} +# omitBodyDuringUpdate: true +# omitNameDuringUpdate: true +# allowUpdates: true +# prerelease: ${{ env.release_pre }}