Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
ci: add support for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Feb 21, 2022
1 parent fdb5c70 commit db3adee
Show file tree
Hide file tree
Showing 15 changed files with 1,479 additions and 17 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: prerelease
on:
workflow_dispatch:
inputs:
sha:
description: "SHA (leave blank for HEAD)"
required: false

env:
ACTIONS_API_URL: https://api.github.com/repos/${GITHUB_REPOSITORY}/actions
VERSION_START_SHA: de217010a2ee1328b401ac593313b5e04011ecef

jobs:
version:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
tag: ${{ steps.version.outputs.tag }}
steps:
- id: sha
run: |
SHA=$(if [[ "${{ github.event.inputs.sha }}" ]]; then echo "${{ github.event.inputs.sha }}"; else echo "${GITHUB_SHA}"; fi)
SHA7="${SHA::7}"
echo "::set-output name=sha::${SHA}"
echo "::set-output name=sha7::${SHA7}"
- uses: actions/checkout@v2
with:
ref: ${{ steps.sha.outputs.sha }}
fetch-depth: 0
- id: version
run: |
VERSION_MAJOR=$(grep -Eo "VP_VERSION_MAJOR\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "VP_VERSION_MINOR\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
VERSION_REV=$(grep -Eo "VP_VERSION_REV\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..${{ steps.sha.outputs.sha }} --count)
TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}-${REVISION}-${{ steps.sha.outputs.sha7 }}"
echo "::set-output name=tag::${TAG}"
prerelease:
runs-on: ubuntu-latest
needs: [ version ]
steps:
- id: download
run: |
curl -s "${{ env.ACTIONS_API_URL }}/runs" --output runs.json
RUN_ID=$(jq -r --arg SHA "${{ needs.version.outputs.sha }}" --arg NAME "vpinball" '.workflow_runs[] | select(.head_sha==$SHA and .name==$NAME) | .id' runs.json)
echo "Downloading vpinball artifact list ${RUN_ID}..."
curl -s "${{ env.ACTIONS_API_URL }}/runs/${RUN_ID}/artifacts" --output artifacts.json
ARTIFACTS=($(jq -r '.artifacts[] | .archive_download_url' artifacts.json))
for url in ${ARTIFACTS[@]}
do
echo "Downloading artifact: ${url}..."
curl -s -OJ -L -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" ${url}
done
rm *.json
- id: create_release
uses: actions/create-release@v1
with:
tag_name: "v${{ needs.version.outputs.tag }}"
release_name: "v${{ needs.version.outputs.tag }}"
prerelease: true
commitish: ${{ needs.version.outputs.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: upload_release_assets
uses: dwenegar/upload-release-assets@v1
with:
release_id: ${{ steps.create_release.outputs.id }}
assets_path: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151 changes: 151 additions & 0 deletions .github/workflows/vpinball.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: vpinball
on:
push:

env:
VERSION_START_SHA: de217010a2ee1328b401ac593313b5e04011ecef
UPX_ARTIFACT: 122350854

defaults:
run:
shell: bash

jobs:
dxsdk:
name: DirectX SDK
runs-on: windows-latest
steps:
- id: cache
uses: actions/cache@v2
with:
path: DXSDK
key: cache-dxsdk
- name: Create Cache
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -sL https://download.microsoft.com/download/a/e/7/ae743f1f-632b-4809-87a9-aa1bb3458e31/DXSDK_Jun10.exe -o DXSDK_Jun10.exe
7z x DXSDK_Jun10.exe DXSDK/Include -otmp
7z x DXSDK_Jun10.exe DXSDK/Lib -otmp
mv tmp/DXSDK DXSDK
rm -fR DXSDK_Jun10.exe tmp
ls -Ra DXSDK
version:
name: Version
runs-on: ubuntu-latest
outputs:
revision: ${{ steps.version.outputs.revision }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: version
run: |
VERSION_MAJOR=$(grep -Eo "VP_VERSION_MAJOR\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "VP_VERSION_MINOR\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
VERSION_REV=$(grep -Eo "VP_VERSION_REV\s+[0-9]+" vpversion.h | grep -Eo "[0-9]+")
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..HEAD --count)
SHA7="${GITHUB_SHA::7}"
TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}-${REVISION}-${SHA7}"
echo "::set-output name=revision::${REVISION}"
echo "::set-output name=sha7::${SHA7}"
echo "::set-output name=tag::${TAG}"
build:
name: Build VPinballX_GL-${{ matrix.config }}-${{ matrix.platform }}
runs-on: windows-2022
needs: [ dxsdk, version ]
strategy:
fail-fast: false
matrix:
include:
- platform: win-x64
platform-name: x64
bass: x64/Bass64.dll
free-image: x64/FreeImage64.dll
sci-lexer-vp: x64/SciLexerVP64.dll
sdl2-ttf: x64/SDL2_ttf.dll
sdl2: x64/SDL2.dll
openvr-api: x64/openvr_api.dll
config: Release
- platform: win-x64
platform-name: x64
bass: x64/Bass64.dll
free-image: x64/FreeImage64.dll
sci-lexer-vp: x64/SciLexerVP64.dll
sdl2-ttf: x64/SDL2_ttf.dll
sdl2: x64/SDL2.dll
openvr-api: x64/openvr_api.dll
config: Debug
- platform: win-x86
platform-name: Win32
bass: Bass.dll
free-image: FreeImage.dll
sci-lexer-vp: SciLexerVP.dll
sdl2-ttf: SDL2_ttf.dll
sdl2: SDL2.dll
openvr-api: openvr_api.dll
config: Release
- platform: win-x86
platform-name: Win32
bass: Bass.dll
free-image: FreeImage.dll
sci-lexer-vp: SciLexerVP.dll
sdl2-ttf: SDL2_ttf.dll
sdl2: SDL2.dll
openvr-api: openvr_api.dll
config: Debug
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: DXSDK
key: cache-dxsdk
- run: |
sed -i "s/0/${{ needs.version.outputs.revision }}/g" git_version.h
sed -i "s/unknown/${{ needs.version.outputs.sha7 }}/g" git_version.h
- name: Build
run: |
export DXSDK_DIR="${GITHUB_WORKSPACE}/DXSDK"
cp cmake/CMakeLists_${{ matrix.platform}}.txt CMakeLists.txt
cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -B build
cmake --build build --config ${{ matrix.config }}
- name: Compress
if: matrix.config == 'Release'
run: |
curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
7z x upx.zip -oupx
rm upx.zip
./upx/upx.exe --best --lzma build/${{ matrix.config }}/VPinballX_GL.exe
- run: |
mkdir tmp
cp build/${{ matrix.config }}/VPinballX_GL.* tmp
cp dll/${{ matrix.bass }} tmp
cp dll/${{ matrix.free-image }} tmp
cp dll/${{ matrix.sci-lexer-vp }} tmp
cp dll/${{ matrix.sdl2-ttf }} tmp
cp dll/${{ matrix.sdl2 }} tmp
cp dll/${{ matrix.openvr-api }} tmp
cp txt/Changelog_Scripts.txt tmp
cp txt/Changelog.txt tmp
cp txt/CommandLineParameters.txt tmp
cp txt/CommandReference.txt tmp
cp txt/Hotkeys.txt tmp
cp "txt/JP's Arcade Physics Materials v3.0.mat" tmp
cp "txt/JP's Arcade Physics Materials v3.01 for 10.7.mat" tmp
cp "txt/JP's Arcade Physics v3.0 2nd edition.pdf" tmp
cp "txt/JP's Arcade Physics v3.0.vbs" tmp
cp "txt/JP's Arcade Physics v3.01.vpp" tmp
cp txt/layoutGuideline.txt tmp
cp txt/license.txt tmp
cp "txt/New Plunger Documentation.pdf" tmp
cp txt/PhysicValues.txt tmp
cp txt/RegistryKeys.txt tmp
cp txt/Scripts.txt tmp
cp -r glshader tmp
cp -r scripts tmp
cp -r tables tmp
- uses: actions/upload-artifact@v2
with:
name: VPinballX_GL-${{ needs.version.outputs.tag }}-${{ matrix.config }}-${{ matrix.platform }}
path: tmp
16 changes: 8 additions & 8 deletions VisualPinball.net2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ClInclude Include="xaudplayer.h" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="shader\BallShader.fx">
<FxCompile Include="shader\BallShader.hlsl">
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ballShaderCode</EntryPointName>
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">ballShaderCode</EntryPointName>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Effect</ShaderType>
Expand Down Expand Up @@ -1438,7 +1438,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\BasicShader.fx">
<FxCompile Include="shader\BasicShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1492,7 +1492,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\DMDShader.fx">
<FxCompile Include="shader\DMDShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1546,7 +1546,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\FBShader.fx">
<FxCompile Include="shader\FBShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1600,7 +1600,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\FlasherShader.fx">
<FxCompile Include="shader\FlasherShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1654,7 +1654,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\LightShader.fx">
<FxCompile Include="shader\LightShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1708,7 +1708,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_SDL|x64'">true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader\ClassicLightShader.fx">
<FxCompile Include="shader\ClassicLightShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -1767,7 +1767,7 @@ copy "$(MSBuildProjectDirectory)\dll\x64\*.dll" "%25VPIN_DIR%25"</Command>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|x64'">
</ObjectFileOutput>
</FxCompile>
<FxCompile Include="shader\StereoShader.fx">
<FxCompile Include="shader\StereoShader.hlsl">
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shader\%(Filename).h</HeaderFileOutput>
<HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release_SDL|Win32'">shader\%(Filename).h</HeaderFileOutput>
<ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down
16 changes: 8 additions & 8 deletions VisualPinball.net2017.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1388,28 +1388,28 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<FxCompile Include="shader\BallShader.fx">
<FxCompile Include="shader\BallShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\StereoShader.fx">
<FxCompile Include="shader\StereoShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\BasicShader.fx">
<FxCompile Include="shader\BasicShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\DMDShader.fx">
<FxCompile Include="shader\DMDShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\FBShader.fx">
<FxCompile Include="shader\FBShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\FlasherShader.fx">
<FxCompile Include="shader\FlasherShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\LightShader.fx">
<FxCompile Include="shader\LightShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
<FxCompile Include="shader\ClassicLightShader.fx">
<FxCompile Include="shader\ClassicLightShader.hlsl">
<Filter>shaders</Filter>
</FxCompile>
</ItemGroup>
Expand Down
File renamed without changes.
Loading

0 comments on commit db3adee

Please sign in to comment.