raylib/.github/workflows/windows.yml

111 lines
3.6 KiB
YAML
Raw Normal View History

2020-08-17 21:40:17 +03:00
name: Windows
2020-08-18 14:51:25 +03:00
on:
push:
pull_request:
release:
types: [published]
2020-08-17 21:40:17 +03:00
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
compiler: [mingw-w64, msvc16]
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"
VSBINPATH: "Win32"
2020-08-17 21:40:17 +03:00
- compiler: msvc16
bits: 64
ARCH: "x64"
2020-08-18 14:00:59 +03:00
VSBINPATH: "x64"
2020-08-20 18:41:08 +03:00
2020-08-18 14:00:59 +03:00
env:
RELEASE_NAME: raylib-3.1_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
- 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
uses: microsoft/setup-msbuild@v1.0.1
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 19:34:22 +03:00
set PATH=%PATH%;${{ matrix.COMPILER_PATH }}
${{ matrix.ARCH }}-w64-mingw32-gcc.exe -v
${{ matrix.COMPILER_PATH }}/windres.exe -h
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: |
cd projects/VS2017
2020-08-18 00:41:17 +03:00
msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
2020-08-18 14:00:59 +03:00
copy /Y .\bin\${{ matrix.VSBINPATH }}\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 }}
2020-08-18 14:00:59 +03:00
copy /Y .\bin\${{ matrix.VSBINPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
copy /Y .\bin\${{ matrix.VSBINPATH }}\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
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'