raylib/.github/workflows/windows.yml

136 lines
4.6 KiB
YAML
Raw Normal View History

2020-08-17 21:40:17 +03:00
name: Windows
on:
workflow_dispatch:
2020-08-18 14:51:25 +03:00
push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows.yml'
2020-08-18 14:51:25 +03:00
pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows.yml'
2020-08-18 14:51:25 +03:00
release:
types: [published]
2020-08-17 21:40:17 +03:00
permissions:
contents: read
2020-08-17 21:40:17 +03:00
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
2020-08-17 21:40:17 +03:00
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
2020-08-20 20:23:42 +03:00
compiler: [mingw-w64, msvc16]
2020-08-17 21:40:17 +03:00
bits: [32, 64]
include:
- compiler: mingw-w64
bits: 32
2020-08-20 18:41:08 +03:00
ARCH: "i686"
2020-08-20 13:38:56 +03:00
COMPILER_PATH: "C:\\msys64\\mingw32\\bin"
2020-08-20 19:00:14 +03:00
WINDRES_ARCH: pe-i386
2020-08-17 21:40:17 +03:00
- compiler: mingw-w64
bits: 64
2020-08-20 18:41:08 +03:00
ARCH: "x86_64"
2020-08-20 13:38:56 +03:00
COMPILER_PATH: "C:\\msys64\\mingw64\\bin"
2020-08-20 19:17:14 +03:00
WINDRES_ARCH: pe-x86-64
2020-08-17 21:40:17 +03:00
- compiler: msvc16
bits: 32
2020-08-18 14:00:59 +03:00
ARCH: "x86"
2021-02-09 17:51:34 +03:00
VSARCHPATH: "Win32"
2020-08-17 21:40:17 +03:00
- compiler: msvc16
bits: 64
ARCH: "x64"
2021-02-09 17:51:34 +03:00
VSARCHPATH: "x64"
2020-08-20 18:41:08 +03:00
2020-08-18 14:00:59 +03:00
env:
2020-08-21 14:16:35 +03:00
RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
2020-08-20 19:00:14 +03:00
GNUTARGET: default
2020-08-17 21:40:17 +03:00
steps:
- name: Checkout
uses: actions/checkout@master
2020-08-21 14:16:35 +03:00
- name: Setup Release Version
run: |
2020-12-25 04:03:33 +03:00
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
2020-08-21 14:16:35 +03:00
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
2020-08-17 21:40:17 +03:00
- name: Setup Environment
run: |
2020-08-17 22:42:37 +03:00
dir
2020-08-17 21:40:17 +03:00
mkdir build
cd build
2020-08-18 14:00:59 +03:00
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
2020-08-17 21:40:17 +03:00
mkdir include
2020-08-18 14:00:59 +03:00
mkdir lib
2020-08-17 22:10:34 +03:00
cd ../../../raylib
2020-08-17 21:40:17 +03:00
# Setup MSBuild.exe path if required
2020-08-17 21:46:25 +03:00
- name: Setup MSBuild
2020-11-19 22:21:05 +03:00
uses: microsoft/setup-msbuild@v1.0.2
2020-08-17 21:40:17 +03:00
if: matrix.compiler == 'msvc16'
2020-08-20 18:41:08 +03:00
2020-08-20 00:13:48 +03:00
- name: Build Library (MinGW-w64)
run: |
cd src
2020-08-20 21:51:55 +03:00
set PATH=%PATH%;${{ matrix.COMPILER_PATH }}
2020-08-20 21:53:32 +03:00
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
${{ matrix.COMPILER_PATH }}/windres.exe --version
2020-08-20 18:41:08 +03:00
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
2020-08-20 19:17:14 +03:00
${{ matrix.COMPILER_PATH }}/windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
2020-08-20 18:41:08 +03:00
make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
2020-08-20 00:13:48 +03:00
cd ..
shell: cmd
2020-08-20 18:41:08 +03:00
if: matrix.compiler == 'mingw-w64'
2020-08-17 22:07:03 +03:00
- name: Build Library (MSVC16)
2020-08-17 21:40:17 +03:00
run: |
2022-08-11 21:04:59 +03:00
cd projects/VS2022
2020-08-18 00:41:17 +03:00
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
2021-02-09 17:51:34 +03:00
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
2020-08-18 01:15:33 +03:00
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
2021-02-09 17:51:34 +03:00
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
2020-08-17 21:40:17 +03:00
cd ../..
2020-08-18 01:24:53 +03:00
shell: cmd
2020-08-17 21:40:17 +03:00
if: matrix.compiler == 'msvc16'
2020-08-20 18:41:08 +03:00
2020-08-17 22:07:03 +03:00
- name: Generate Artifacts
2020-08-17 21:40:17 +03:00
run: |
2020-08-18 14:00:59 +03:00
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
copy /Y .\CHANGELOG .\build\${{ env.RELEASE_NAME }}\CHANGELOG
2021-02-09 17:51:34 +03:00
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
2020-08-18 00:41:17 +03:00
cd build
2020-08-18 14:00:59 +03:00
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
2020-08-18 01:39:57 +03:00
dir
2020-08-18 01:24:53 +03:00
shell: cmd
2020-08-20 18:41:08 +03:00
2020-08-17 22:07:03 +03:00
- name: Upload Artifacts
uses: actions/upload-artifact@v2
2020-08-17 21:40:17 +03:00
with:
2020-08-18 14:00:59 +03:00
name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip
2020-08-18 14:51:25 +03:00
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/${{ env.RELEASE_NAME }}.zip
asset_name: ${{ env.RELEASE_NAME }}.zip
asset_content_type: application/zip
2020-08-18 15:07:55 +03:00
if: github.event_name == 'release' && github.event.action == 'published'