Update credits for 5.11.0 (#15753)
[minetest.git] / .github / workflows / windows.yml
blob670ce12f8f873a93f626a8f4adc602b8e5febf38
1 name: windows
3 # build on c/cpp changes or workflow changes
4 on:
5   push:
6     paths:
7       - 'lib/**.[ch]'
8       - 'lib/**.cpp'
9       - 'src/**.[ch]'
10       - 'src/**.cpp'
11       - 'irr/**.[ch]'
12       - 'irr/**.cpp'
13       - '**/CMakeLists.txt'
14       - 'cmake/Modules/**'
15       - 'po/**.po'
16       - 'util/buildbot/**'
17       - 'misc/*.manifest'
18       - '.github/workflows/windows.yml'
19   pull_request:
20     paths:
21       - 'lib/**.[ch]'
22       - 'lib/**.cpp'
23       - 'src/**.[ch]'
24       - 'src/**.cpp'
25       - 'irr/**.[ch]'
26       - 'irr/**.cpp'
27       - '**/CMakeLists.txt'
28       - 'cmake/Modules/**'
29       - 'po/**.po'
30       - 'util/buildbot/**'
31       - 'misc/*.manifest'
32       - '.github/workflows/windows.yml'
34 jobs:
35   mingw:
36     name: "MinGW cross-compiler (${{ matrix.bits }}-bit)"
37     runs-on: ubuntu-22.04
38     strategy:
39       fail-fast: false
40       matrix:
41         bits: [32, 64]
42     steps:
43       - uses: actions/checkout@v4
44       - name: Install compiler
45         run: |
46           sudo dpkg --add-architecture i386
47           sudo apt-get update
48           sudo apt-get install -y --no-install-recommends gettext wine wine${{ matrix.bits }}
49           sudo ./util/buildbot/download_toolchain.sh /usr
51       - name: Build
52         run: |
53            EXISTING_MINETEST_DIR=$PWD \
54            ./util/buildbot/buildwin${{ matrix.bits }}.sh B
56       # Check that the resulting binary can run (DLLs etc.)
57       - name: Runtime test
58         run: |
59           dest=$(mktemp -d)
60           unzip -q -d "$dest" B/build/*.zip
61           cd "$dest"/luanti-*-win*
62           wine bin/luanti.exe --version
64       - uses: actions/upload-artifact@v4
65         with:
66           name: "mingw${{ matrix.bits }}"
67           path: B/build/*.zip
68           if-no-files-found: error
70   msvc:
71     name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
72     runs-on: windows-2019
73     env:
74       VCPKG_VERSION: 01f602195983451bc83e72f4214af2cbc495aa94
75       # 2024.05.24
76       vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry
77     strategy:
78       fail-fast: false
79       matrix:
80         config:
81           - {
82               arch: x86,
83               generator: "-G'Visual Studio 16 2019' -A Win32",
84               vcpkg_triplet: x86-windows
85             }
86           - {
87               arch: x64,
88               generator: "-G'Visual Studio 16 2019' -A x64",
89               vcpkg_triplet: x64-windows
90             }
91         type: [portable]
92 #        type: [portable, installer]
93 # The installer type is working, but disabled, to save runner jobs.
94 # Enable it, when working on the installer.
96     steps:
97       - uses: actions/checkout@v4
99       - name: Restore from cache and run vcpkg
100         uses: lukka/run-vcpkg@v7
101         with:
102           vcpkgArguments: ${{env.vcpkg_packages}}
103           vcpkgDirectory: '${{ github.workspace }}\vcpkg'
104           appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
105           vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
106           vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
108       - name: CMake
109         run: |
110           cmake ${{matrix.config.generator}}  `
111           -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake"  `
112           -DCMAKE_BUILD_TYPE=Release  `
113           -DENABLE_POSTGRESQL=OFF  `
114           -DENABLE_LUAJIT=TRUE  `
115           -DREQUIRE_LUAJIT=TRUE  `
116           -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
118       - name: Build
119         run: cmake --build . --config Release
121       - name: Unittests
122         # need this workaround for stdout to work
123         run: |
124           $proc = start .\bin\Release\luanti.exe --run-unittests -NoNewWindow -Wait -PassThru
125           exit $proc.ExitCode
126         continue-on-error: true # FIXME!!
128       - name: CPack
129         run: |
130           If ($env:TYPE -eq "installer")
131           {
132             cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
133           }
134           ElseIf($env:TYPE -eq "portable")
135           {
136             cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
137           }
138           rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
139         env:
140           TYPE: ${{matrix.type}}
142       - uses: actions/upload-artifact@v4
143         with:
144           name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
145           path: .\Package\
146           if-no-files-found: error