Merge pull request #585 from ISSOtm/msvc-ci

Add MSVC in CI
This commit is contained in:
Eldred Habert
2020-10-06 17:48:13 +02:00
committed by GitHub
4 changed files with 88 additions and 9 deletions

View File

@@ -53,7 +53,78 @@ jobs:
run: | run: |
test/run-tests.sh test/run-tests.sh
windows-build: windows-testing:
strategy:
matrix:
bits: [32, 64]
include:
- bits: 32
arch: x86
platform: Win32
- bits: 64
arch: x86_x64
platform: x64
fail-fast: false
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Get zlib, libpng and bison
run: | # TODO: use an array
$wc = New-Object System.Net.WebClient
$wc.DownloadFile('https://www.zlib.net/zlib1211.zip', 'zlib.zip')
$hash = (Get-FileHash "zlib.zip" -Algorithm SHA256).Hash
if ($hash -ne 'd7510a8ee1918b7d0cad197a089c0a2cd4d6df05fee22389f67f115e738b178d') {
Write-Host "zlib SHA256 mismatch! ($hash)"
exit 1
}
$wc.DownloadFile('https://download.sourceforge.net/libpng/lpng1637.zip', 'libpng.zip')
$hash = (Get-FileHash "libpng.zip" -Algorithm SHA256).Hash
if ($hash -ne '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2') {
Write-Host "libpng SHA256 mismatch! ($hash)"
exit 1
}
$wc.DownloadFile('https://github.com/lexxmark/winflexbison/releases/download/v2.5.23/win_flex_bison-2.5.23.zip', 'winflexbison.zip')
$hash = (Get-FileHash "winflexbison.zip" -Algorithm SHA256).Hash
if ($hash -ne '6AA5C8EA662DA1550020A5804C28BE63FFAA53486DA9F6842E24C379EC422DFC') {
Write-Host "bison SHA256 mismatch! ($hash)"
}
Expand-Archive -DestinationPath . "zlib.zip"
Expand-Archive -DestinationPath . "libpng.zip"
Expand-Archive -DestinationPath install_dir "winflexbison.zip"
Move-Item zlib-1.2.11 zlib
Move-Item lpng1637 libpng
- name: Build zlib
run: | # BUILD_SHARED_LIBS causes the output DLL to be correctly called `zlib1.dll`
cmake -S zlib -B zbuild -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DBUILD_SHARED_LIBS=ON
cmake --build zbuild --config Release
cmake --install zbuild
- name: Build libpng
run: |
cmake -S libpng -B pngbuild -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DPNG_SHARED=ON -DPNG_STATIC=ON -DPNG_TESTS=OFF
cmake --build pngbuild --config Release
cmake --install pngbuild
- name: Build Windows binaries
run: |
cmake -S . -B build -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build
- name: Package binaries
shell: bash
run: |
mkdir bins
cp install_dir/bin/{rgbasm.exe,rgblink.exe,rgbfix.exe,rgbgfx.exe,zlib1.dll,libpng16.dll} bins
- name: Upload Windows binaries
uses: actions/upload-artifact@v1
with:
name: rgbds-canary-win${{ matrix.bits }}
path: bins
- name: Test
shell: bash
run: |
cp bins/* .
test/run-tests.sh
windows-xbuild:
strategy: strategy:
matrix: matrix:
bits: [32, 64] bits: [32, 64]
@@ -65,6 +136,7 @@ jobs:
- bits: 64 - bits: 64
arch: x86-64 arch: x86-64
triplet: x86_64-w64-mingw32 triplet: x86_64-w64-mingw32
fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
DIST_DIR: win${{ matrix.bits }} DIST_DIR: win${{ matrix.bits }}
@@ -80,7 +152,7 @@ jobs:
- name: Install libpng dev headers for MinGW - name: Install libpng dev headers for MinGW
run: | run: |
sudo ./.github/actions/mingw-w64-libpng-dev.sh ${{ matrix.triplet }} sudo ./.github/actions/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
- name: Build Windows binaries - name: Cross-build Windows binaries
run: | run: |
make mingw${{ matrix.bits }} -j Q= make mingw${{ matrix.bits }} -j Q=
- name: Package binaries - name: Package binaries
@@ -96,21 +168,22 @@ jobs:
- name: Upload Windows binaries - name: Upload Windows binaries
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: rgbds-canary-win${{ matrix.bits }} name: rgbds-canary-mingw-win${{ matrix.bits }}
path: bins path: bins
windows-testing: windows-xtesting:
needs: windows-build needs: windows-xbuild
strategy: strategy:
matrix: matrix:
bits: [32, 64] bits: [32, 64]
fail-fast: false
runs-on: windows-2019 runs-on: windows-2019
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Retrieve binaries - name: Retrieve binaries
uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
with: with:
name: rgbds-canary-win${{ matrix.bits }} name: rgbds-canary-mingw-win${{ matrix.bits }}
path: bins path: bins
- name: Extract binaries - name: Extract binaries
shell: bash shell: bash

View File

@@ -45,7 +45,7 @@ else()
if(MORE_WARNINGS) if(MORE_WARNINGS)
add_compile_options(-Werror -Wextra -Wno-type-limits add_compile_options(-Werror -Wextra -Wno-type-limits
-Wno-sign-compare -Wformat -Wformat-security -Wformat-overflow=2 -Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2
-Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused -Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused
-Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5 -Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5
-Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond -Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond

View File

@@ -187,7 +187,7 @@ checkpatch:
develop: develop:
$Qenv $(MAKE) -j WARNFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-type-limits \ $Qenv $(MAKE) -j WARNFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-type-limits \
-Wno-sign-compare -Wformat -Wformat-security -Wformat-overflow=2 \ -Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2 \
-Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused \ -Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused \
-Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5 \ -Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5 \
-Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond \ -Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond \

View File

@@ -19,7 +19,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include "extern/utf8decoder.h" #include "extern/utf8decoder.h"
#include "platform.h" /* For `ssize_t` */ #include "platform.h" /* For `ssize_t` */
@@ -895,11 +897,14 @@ void lexer_DumpStringExpansions(void)
{ {
if (!lexerState) if (!lexerState)
return; return;
struct Expansion *stack[nMaxRecursionDepth + 1]; struct Expansion **stack = malloc(sizeof(*stack) * (nMaxRecursionDepth + 1));
struct Expansion *expansion; /* Temp var for `lookupExpansion` */ struct Expansion *expansion; /* Temp var for `lookupExpansion` */
unsigned int depth = 0; unsigned int depth = 0;
size_t distance = lexerState->expansionOfs; size_t distance = lexerState->expansionOfs;
if (!stack)
fatalerror("Failed to alloc string expansion stack: %s\n", strerror(errno));
#define LOOKUP_PRE_NEST(exp) do { \ #define LOOKUP_PRE_NEST(exp) do { \
/* Only register EQUS expansions, not string args */ \ /* Only register EQUS expansions, not string args */ \
if ((exp)->name) \ if ((exp)->name) \
@@ -913,6 +918,7 @@ void lexer_DumpStringExpansions(void)
while (depth--) while (depth--)
fprintf(stderr, "while expanding symbol \"%s\"\n", stack[depth]->name); fprintf(stderr, "while expanding symbol \"%s\"\n", stack[depth]->name);
free(stack);
} }
/* Function to discard all of a line's comments */ /* Function to discard all of a line's comments */