GitHub workflows: Use matrix strategy and update checkout and upload-… #277
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
arch: [x86, x86_64] | |
include: | |
# Windows | |
- os: windows-latest | |
arch: x86 | |
platform: windows | |
- os: windows-latest | |
arch: x86_64 | |
platform: windows | |
# Linux | |
- os: ubuntu-latest | |
arch: x86 | |
platform: linux | |
- os: ubuntu-latest | |
arch: x86_64 | |
platform: linux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
if: ${{ matrix.os != 'windows-latest' }} | |
shell: bash | |
run: | | |
sudo apt-get update # && sudo apt-get upgrade -y | |
sudo apt-get install -y build-essential libc6-dev-i386 g++-multilib gcc-mingw-w64 p7zip-full | |
- name: Build for ${{ matrix.os }} ${{ matrix.arch }} | |
shell: bash | |
run: | | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
# Windows build steps | |
./build.bat | |
else | |
# Linux build steps | |
make -j8 release ARCH="${{ matrix.arch }}" | |
make -j8 debug ARCH="${{ matrix.arch }}" | |
# that also works: | |
make -j8 release PLATFORM=windows ARCH="${{ matrix.arch }}" | |
make -j8 debug PLATFORM=windows ARCH="${{ matrix.arch }}" | |
# Get wine32-development package | |
# sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y wine32-development | |
# Build QVM using wine | |
# wine cmd /c build.bat | |
sudo chmod 777 tools/bin/linux/* # make all of them executable | |
make -f MakefileQVM -j8 | |
fi | |
env: | |
ARCHIVE: 1 | |
- name: Store QVM artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: QVMs-${{ matrix.platform }}-${{ matrix.arch }} | |
path: | | |
*.pk3 | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Store Linux ${{ matrix.arch }} .so artifacts | |
if: ${{ matrix.os != 'windows-latest' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }}-${{ matrix.arch }} | |
path: | | |
build/release-${{ matrix.platform }}-${{ matrix.arch }} | |
build/debug-${{ matrix.platform }}-${{ matrix.arch }} | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Store Windows ${{ matrix.arch }} DLL artifacts (compiled on Linux) | |
if: ${{ matrix.os != 'windows-latest' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{ matrix.arch }} | |
path: | | |
build/release-windows-${{ matrix.arch }} | |
build/debug-windows-${{ matrix.arch }} | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Publish a release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
*.pk3 | |
build/* |