123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- # SuperTux
- # Copyright (C) 2020-2021 Jacob Burroughs <maths22@gmail.com>
- # 2020-2022 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, see <https://www.gnu.org/licenses/>.
- name: Windows
- on:
- workflow_dispatch:
- push:
- branches:
- - master
- tags:
- - '*'
- pull_request: {}
- jobs:
- windows:
- strategy:
- fail-fast: false
- matrix:
- arch: [x64, x86]
- build_type: [Debug, RelWithDebInfo]
- glbinding: [OFF] # [ON, OFF] # FIXME: Fix Windows glbinding builds
- include:
- - build_type: RelWithDebInfo
- arch: x64
- glbinding: OFF
- release: ON
- - build_type: RelWithDebInfo
- arch: x86
- glbinding: OFF
- release: ON
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v4
- with:
- # Fetch the whole tree so git describe works
- fetch-depth: 0
- submodules: recursive
- - name: Use cached dependencies
- id: cache-dependencies
- uses: actions/cache@v3
- with:
- path: C:/vcpkg/installed
- key: ${{ runner.os }}-${{ matrix.arch }}-dependencies-${{ hashFiles('.github/workflows/windows.yml') }}
- - name: Install dependencies
- if: steps.cache-dependencies.outputs.cache-hit != 'true'
- env:
- ARCH: ${{ matrix.arch }}
- run: |
- vcpkg integrate install
- vcpkg install gtest:$Env:ARCH-windows
- vcpkg install curl:$Env:ARCH-windows
- vcpkg install --recurse freetype:$Env:ARCH-windows
- vcpkg install glew:$Env:ARCH-windows
- vcpkg install glbinding:$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:
- ARCH: ${{ matrix.arch }}
- BUILD_TYPE: ${{ matrix.build_type }}
- GLBINDING: ${{ matrix.glbinding }}
- run: |
- cmake --version
- mkdir build
- cd build
- cmake .. -G "Visual Studio 17 2022" -A $Env:ARCH.replace("x86", "Win32") "-DGLBINDING_ENABLED=$Env:GLBINDING" -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: Run Tests
- working-directory: build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- run: |
- "./$Env:BUILD_TYPE/run_tests.exe"
- - name: Package MSI Installer
- shell: pwsh
- working-directory: build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- run: |
- cpack -C $Env:BUILD_TYPE
- if ($LASTEXITCODE -ne 0)
- {
- $code = $LASTEXITCODE
- type ./_CPack_Packages/win64/WIX/wix.log
- exit $code
- }
- else
- {
- mkdir upload
- mv *.msi upload/
- }
- - name: Upload MSI Installer
- uses: actions/upload-artifact@v4
- with:
- name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-installer"
- path: build/upload/*.msi
- if-no-files-found: ignore
- - name: Package Portable Archive
- working-directory: build
- env:
- BUILD_TYPE: ${{ matrix.build_type }}
- run: |
- mkdir -Force SuperTux-${{ github.sha }}-portable
- cmake --install . --config $Env:BUILD_TYPE --prefix .\SuperTux-${{ github.sha }}-portable
- # Because github puts assets in zips, if you upload a zip,
- # it will upload another zip. I have disabled this code because
- # of that, but in case you wanted to know how to generate a portable release,
- # here it is.
- <#
- cpack -C $Env:BUILD_TYPE -G ZIP
- mv *.zip SuperTux-${{ github.sha }}-portable/
- #>
- - name: Upload Portable Package
- uses: actions/upload-artifact@v4
- with:
- name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-portable"
- path: build/SuperTux-${{ github.sha }}-portable
- if-no-files-found: ignore
- - uses: anshulrgoyal/upload-s3-action@master
- if: matrix.release && 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 && 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 }}
- BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- IS_WINDOWS: true
- - name: Create Release
- if: startsWith(github.ref, 'refs/tags/') && matrix.release && github.repository_owner == 'supertux'
- uses: softprops/action-gh-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: 'build/upload/SuperTux-*.msi'
- draft: true
|