add cadaver #176
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: Windows builds | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_windows_vs: | |
name: ${{ matrix.conf.name }} | |
runs-on: windows-2022 | |
if: github.event_name != 'pull_request' || contains('dreamer,kcgen,ant-222,Wengier', github.actor) == false | |
strategy: | |
matrix: | |
conf: | |
- name: MSVC 32-bit | |
arch: x86 | |
#max_warnings: 5 | |
- name: MSVC 64-bit | |
arch: x64 | |
#max_warnings: 1105 | |
steps: | |
- name: Backup existing vcpkg installation | |
shell: pwsh | |
run: | | |
mv c:\vcpkg c:\vcpkg-bak | |
md c:\vcpkg -ea 0 | |
- name: Generate vcpkg cache key | |
id: prep-vcpkg | |
shell: bash | |
run: | | |
echo "::set-output name=year_and_week::$(date '+%Y%W')" | |
- name: Cache vcpkg | |
uses: actions/cache@v2 | |
id: cache-vcpkg | |
with: | |
path: c:\vcpkg | |
key: vcpkg-${{ matrix.conf.arch }}-${{ steps.prep-vcpkg.outputs.year_and_week }}-3 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1.1 | |
with: | |
vs-prerelease: true | |
msbuild-architecture: ${{ matrix.conf.arch }} | |
- name: Install new packages using vcpkg | |
if: steps.cache-vcpkg.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | | |
rm -R c:\vcpkg | |
c: | |
cd \ | |
git clone --depth 1 https://github.com/Microsoft/vcpkg.git | |
cd vcpkg | |
.\bootstrap-vcpkg.bat | |
vcpkg install --triplet ${{ matrix.conf.arch }}-windows libpng sdl2 sdl2-net sdl2-mixer libmt32emu opusfile fluidsynth pdcurses gtest | |
if (-not $?) { throw "vcpkg failed to install library dependencies" } | |
rm -R c:\vcpkg\buildtrees | |
rm -R c:\vcpkg\packages | |
- name: Integrate packages | |
shell: pwsh | |
run: | | |
vcpkg integrate install | |
if (-not $?) { throw "vcpkg failed to integrate packages" } | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log environment | |
shell: pwsh | |
run: .\scripts\log-env.ps1 | |
- name: Run tests | |
shell: pwsh | |
run: | | |
cd vs | |
# TODO: get unit tests working in Debug-mode; for now use release flags (better than nothing) | |
MSBuild -m dosbox.sln -t:tests:Rebuild -p:Configuration=Release -p:Platform=${{ matrix.conf.arch }} | |
- name: Build | |
shell: pwsh | |
run: | | |
cd vs | |
MSBuild -m dosbox.sln -t:dosbox:Rebuild -p:Configuration=Debug -p:Platform=${{ matrix.conf.arch }} | Tee-Object build.log | |
- name: Summarize warnings | |
shell: pwsh | |
#env: | |
# max_warnings: ${{ matrix.conf.max_warnings }} | |
run: python scripts\count-warnings.py -f --msvc vs\build.log | |
build_windows_vs_release: | |
name: ${{ matrix.conf.name }} | |
needs: build_windows_vs | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
conf: | |
- name: Release build (32-bit) | |
arch: x86 | |
vs-release-dirname: Win32 | |
- name: Release build (64-bit) | |
arch: x64 | |
vs-release-dirname: x64 | |
steps: | |
- name: Prepare vcpkg for cache restore | |
shell: pwsh | |
run: | | |
mv c:\vcpkg c:\vcpkg-bak | |
md c:\vcpkg -ea 0 | |
- name: Generate vcpkg cache key | |
id: prep-vcpkg | |
shell: bash | |
run: | | |
echo "::set-output name=year_and_week::$(date '+%Y%W')" | |
- name: Restore the most recent cache of vcpkg | |
uses: actions/cache@v2 | |
with: | |
path: c:\vcpkg | |
key: vcpkg-${{ matrix.conf.arch }}-${{ steps.prep-vcpkg.outputs.year_and_week }}-3 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1.1 | |
with: | |
vs-prerelease: true | |
msbuild-architecture: ${{ matrix.conf.arch }} | |
- name: Integrate packages | |
shell: pwsh | |
run: | | |
vcpkg integrate install | |
if (-not $?) { throw "vcpkg failed to integrate packages" } | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log environment | |
shell: pwsh | |
run: .\scripts\log-env.ps1 | |
- name: Adjust config.h | |
shell: bash | |
run: | | |
set -x | |
git fetch --prune --unshallow | |
export VERSION=$(git describe --abbrev=4) | |
# inject version based on vcs | |
sed -i "s|DOSBOX_DETAILED_VERSION \"git\"|DOSBOX_DETAILED_VERSION \"$VERSION\"|" src/platform/visualc/config.h | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build release | |
shell: pwsh | |
run: | | |
cd vs | |
MSBuild -m dosbox.sln -t:dosbox:Rebuild -p:Configuration=Release -p:Platform=${{ matrix.conf.arch }} | |
- name: Package | |
shell: bash | |
run: | | |
# Construct VC_REDIST_DIR | |
readonly VC_REDIST_BASE="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Redist/MSVC" | |
readonly VC_REDIST_VERSION="14.30.30704" | |
readonly VC_REDIST_CRT_VERSION="Microsoft.VC143.CRT" | |
export VC_REDIST_DIR="$VC_REDIST_BASE/$VC_REDIST_VERSION/${{ matrix.conf.arch }}/$VC_REDIST_CRT_VERSION" | |
find "$VC_REDIST_DIR" -maxdepth 3 -type d | |
# Package | |
./scripts/create-package.sh \ | |
-p msvc \ | |
vs/${{ matrix.conf.vs-release-dirname }}/Release \ | |
"dest" | |
- name: Enable the debugger in config.h | |
shell: bash | |
run: | | |
set -x | |
sed -i "s|C_DEBUG.*|C_DEBUG 1|" src/platform/visualc/config.h | |
sed -i "s|C_HEAVY_DEBUG.*|C_HEAVY_DEBUG 1|" src/platform/visualc/config.h | |
- name: Build release with the debugger | |
shell: pwsh | |
env: | |
PATH: '${env:PATH};C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64' | |
run: | | |
cd vs | |
MSBuild -m dosbox.sln -t:dosbox:"Clean;Rebuild" -p:Configuration=Release -p:Platform=${{ matrix.conf.arch }} | |
- name: Package the debugger | |
shell: bash | |
run: | | |
set -x | |
# Move the debugger build into the release area | |
readonly RELEASE_DIR=${{ matrix.conf.vs-release-dirname }}/Release | |
ls "vs/$RELEASE_DIR" | |
cp vs/$RELEASE_DIR/dosbox.exe dest/dosbox_with_debugger.exe | |
cp vs/$RELEASE_DIR/pdcurses.dll dest/ | |
# Create dir for zipping | |
mv dest dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }} | |
- name: Windows Defender AV Scan | |
shell: powershell | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$dosboxDir = "${{ github.workspace }}\dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }}" | |
& 'C:\Program Files\Windows Defender\MpCmdRun.exe' -Scan -ScanType 3 -DisableRemediation -File $dosboxDir | |
if( $LASTEXITCODE -ne 0 ) { | |
Get-Content -Path $env:TEMP\MpCmdRun.log | |
Throw "Exit $LASTEXITCODE : Windows Defender found an issue" | |
} | |
- name: Upload package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }} | |
path: dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }} | |
# This job exists only to publish an artifact with version info when building | |
# from main branch, so snapshot build version will be visible on: | |
# https://dosbox-staging.github.io/downloads/devel/ | |
# | |
publish_additional_artifacts: | |
name: Publish additional artifacts | |
needs: build_windows_vs_release | |
runs-on: windows-2022 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Generate changelog | |
shell: bash | |
run: | | |
set +x | |
git fetch --unshallow | |
VERSION=$(git describe --abbrev=4) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
NEWEST_TAG=$(git describe --abbrev=0) | |
git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt | |
- uses: actions/upload-artifact@v2 | |
with: | |
# Keep exactly this artifact name; it's being used to propagate | |
# version info via GitHub REST API | |
name: changelog-${{ env.VERSION }}.txt | |
path: changelog-${{ env.VERSION }}.txt |