Skip to content

Commit

Permalink
Update CI with build matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyman192 committed Sep 3, 2023
1 parent ca356e2 commit 0156337
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 70 deletions.
118 changes: 86 additions & 32 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,53 @@ name: MBINCompiler
on:
# Run on all branches except for the gh-pages branch
push:
paths-ignore:
- '*.md'
branches-ignore:
- 'gh-pages'
pull_request:
paths-ignore:
- '*.md'
branches-ignore:
- 'gh-pages'
create:

jobs:
build:
name: Build artefacts
runs-on: windows-latest
build_test:
name: Build artefacts - ${{ matrix.os.name }}/${{ matrix.dotnet.framework }}
runs-on: ${{ matrix.os.name }}-latest
strategy:
fail-fast: false
matrix:
os: [{name: 'Ubuntu', runtime: 'linux-x64'}, {name: 'Windows', runtime: 'win-x64'}]
dotnet: [{framework: 'net6.0', version: '6.0.0'}, {framework: 'net7.0', version: '7.0.0'}]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.100
7.0.100
- name: Build Windows binaries
- name: Build ${{ matrix.os.name }}-dotnet ${{ matrix.dotnet }} binaries
run: |
dotnet publish libMBIN-DLL -c Release -f net6.0 -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net6.0 -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish SaveFileMapping -c Release -f net6.0 -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish libMBIN-DLL -c Release -f net7.0 -r win-x64 -o Build/Release/net7/ /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net7.0 -r win-x64 -o Build/Release/net7/ /nowarn:cs0618
sed -i '\|<TargetFrameworks>net6.0;net7.0</TargetFrameworks>|a\ <RuntimeFrameworkVersion>${{ matrix.dotnet.version }}</RuntimeFrameworkVersion>' ./MBINCompiler/MBINCompiler.csproj
sed -i '\|<TargetFrameworks>net6.0;net7.0</TargetFrameworks>|a\ <RuntimeFrameworkVersion>${{ matrix.dotnet.version }}</RuntimeFrameworkVersion>' ./libMBIN-DLL/libMBIN-DLL.csproj
dotnet publish libMBIN-DLL -c Release -f ${{ matrix.dotnet.framework }} -r ${{ matrix.os.runtime }} /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f ${{ matrix.dotnet.framework }} -r ${{ matrix.os.runtime }} /nowarn:cs0618
- name: test
run: |
pwd
tree Build /f
if: ${{matrix.os.name == 'Windows' }}
- name: test
run: tree Build
if: ${{matrix.os.name == 'Ubuntu' }}
- name: Move the exe so the tests can find it easier
run: |
cp Build/Release/net6/MBINCompiler.exe MBINCompiler.exe
cp Build/Release/net6/libMBIN.dll libMBIN.dll
cp Build/Release/net7/MBINCompiler.exe MBINCompiler-dotnet7.exe
cp Build/Release/net7/libMBIN.dll libMBIN-dotnet7.dll
cp Build/Release/${{ matrix.dotnet.framework }}/${{ matrix.os.runtime }}/MBINCompiler.exe MBINCompiler.exe
cp Build/Release/${{ matrix.dotnet.framework }}/${{ matrix.os.runtime }}/libMBIN.dll libMBIN.dll
if: ${{matrix.os.name == 'Windows' }}
- name: Move the exe so the tests can find it easier
run: |
cp Build/Release/${{ matrix.dotnet.framework }}/${{ matrix.os.runtime }}/MBINCompiler MBINCompiler.exe
cp Build/Release/${{ matrix.dotnet.framework }}/${{ matrix.os.runtime }}/MBINCompiler.dll MBINCompiler.dll
cp Build/Release/${{ matrix.dotnet.framework }}/${{ matrix.os.runtime }}/libMBIN.dll libMBIN.dll
if: ${{matrix.os.name == 'Ubuntu' }}
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
Expand All @@ -43,32 +59,66 @@ jobs:
python -m pip install --upgrade pip
pip install pytest requests
- name: Run tests
run: python -m pytest --mbincompiler_path="MBINCompiler.exe" --tb=no --report
- name: Generate save data mapping
run : Build/Release/net6/SaveFileMapping.exe
shell: bash
- name: Upload binary for release
run: python -m pytest --mbincompiler_path="./MBINCompiler.exe" --report -s
- name: Upload Windows binaries
uses: actions/upload-artifact@v3
with:
name: MBINCompiler
name: MBINCompiler-${{ matrix.os.name }}-${{ matrix.dotnet.framework }}
path: |
MBINCompiler.exe
libMBIN.dll
MBINCompiler-dotnet7.exe
libMBIN-dotnet7.dll
report.json
mapping.json
if: ${{matrix.os.name == 'Windows' }}
- name: Upload Linux binaries
uses: actions/upload-artifact@v3
with:
name: MBINCompiler-${{ matrix.os.name }}-${{ matrix.dotnet.framework }}
path: |
MBINCompiler.exe
MBINCompiler.dll
libMBIN.dll
if: ${{matrix.os.name == 'Ubuntu' }}
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: MBINCompiler-report
path: report.json
if: ${{matrix.os.name == 'Windows' && matrix.dotnet.framework == 'net6.0'}}
save_mapping:
name: Build save file mapping and generate mapping
runs-on: Windows-latest
steps:
- uses: actions/checkout@v3
- name: Build SaveFileMapping binary
run: dotnet publish SaveFileMapping -c Release -f net6.0 -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
- name: Generate save data mapping
run : Build/Release/net6/SaveFileMapping.exe
shell: bash
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: savedata-mapping
path: mapping.json
release:
name: Release MBINCompiler binaries and other data
# Only run this job if the commit was tagged.
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: windows-latest
needs: [build]
needs: [build_test, save_mapping]
steps:
- name: Download files for release
uses: actions/download-artifact@v2
with:
name: MBINCompiler
uses: actions/download-artifact@v3
- name: Rename files for release
run: |
mv MBINCompiler-Windows-net6.0/MBINCompiler.exe MBINCompiler.exe
mv MBINCompiler-Windows-net6.0/libMBIN.dll libMBIN.dll
mv MBINCompiler-Windows-net7.0/MBINCompiler.exe MBINCompiler-dotnet7.exe
mv MBINCompiler-Windows-net7.0/libMBIN.dll libMBIN-dotnet7.dll
mv MBINCompiler-Ubuntu-net6.0/MBINCompiler.exe MBINCompiler-linux-net6
mv MBINCompiler-Ubuntu-net6.0/libMBIN.dll libMBIN-linux-net6.dll
mv MBINCompiler-Ubuntu-net7.0/MBINCompiler.exe MBINCompiler-linux-net7
mv MBINCompiler-Ubuntu-net7.0/libMBIN.dll libMBIN-linux-net7.dll
mv savedata-mapping/mapping.json mapping.json
mv MBINCompiler-report/report.json report.json
- name: Get MBINCompiler tag version
run: |
echo "VERSION=$(./MBINCompiler.exe version | awk '{print $2}')" >> $GITHUB_ENV
Expand All @@ -86,6 +136,10 @@ jobs:
libMBIN.dll
MBINCompiler-dotnet7.exe
libMBIN-dotnet7.dll
MBINCompiler-linux-net6
libMBIN-linux-net6.dll
MBINCompiler-linux-net7
libMBIN-linux-net7.dll
report.json
mapping.json
env:
Expand Down
28 changes: 1 addition & 27 deletions MBINCompiler/MBINCompiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down Expand Up @@ -49,32 +49,6 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<Target Name="Clean-DotNetExe" AfterTargets="Clean" Condition="$(TargetFramework.StartsWith('netcore'))">
<Delete Files="$(TargetDir)$(TargetName).exe" />
</Target>

<Target Name="Build-DotNetExe" AfterTargets="Build" Condition="$(TargetFramework.StartsWith('netcore')) and '$(IsNestedBuild)' != 'true'">
<Message Text="SolutionDir = $(SolutionDir)" />
<Message Text="ProjectPath = $(ProjectPath)" />
<Message Text="OutDir = $(OutDir)" />
<Message Text="OutputDir = $(OutputDir)" />
<Message Text="TargetDir = $(TargetDir)" />
<Message Text="TargetName = $(TargetName)" />

<Exec ConsoleToMSBuild="true" Command="dotnet build &quot;$(ProjectPath)&quot; /p:CopyLocalLockFileAssemblies=false;IsNestedBuild=true --output &quot;$(TargetDir)stage/&quot;">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Copy SourceFiles="$(TargetDir)stage/$(TargetName).exe" DestinationFolder="$(TargetDir)" />
<RemoveDir Directories="$(TargetDir)stage/" />

<Exec ConsoleToMSBuild="true" IgnoreExitCode="true" Command="dotnet tool install --tool-path ../.nuget/tools dotnet-warp">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Exec ConsoleToMSBuild="true" Command="&quot;../.nuget/tools/dotnet-warp&quot; -v -p:CopyLocalLockFileAssemblies=false;IsNestedBuild=true -o &quot;$(TargetDir)$(TargetName).exe&quot;">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
</Target>

<Import Project="..\libMBIN\libMBIN-Shared.projitems" Label="Shared" />

</Project>
2 changes: 1 addition & 1 deletion SaveFileMapping/SaveFileMapping.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down
5 changes: 3 additions & 2 deletions build-net6.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dotnet publish -c Release -f net6.0 -r linux-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish -c Release -f net6.0 -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish libMBIN-DLL -c Release -f net6.0 --no-self-contained -r win-x64 /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net6.0 --no-self-contained -r win-x64 /nowarn:cs0618
dotnet publish SaveFileMapping -c Release -f net6.0 --no-self-contained -r win-x64 /nowarn:cs0618
pause
5 changes: 3 additions & 2 deletions build-net6.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dotnet publish -c Release -f net6.0 --no-self-contained -r linux-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish -c Release -f net6.0 --no-self-contained -r win-x64 -o Build/Release/net6/ /nowarn:cs0618
dotnet publish libMBIN-DLL -c Release -f net6.0 --no-self-contained -r linux-x64 /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net6.0 --no-self-contained -r linux-x64 /nowarn:cs0618
dotnet publish SaveFileMapping -c Release -f net6.0 --no-self-contained -r linux-x64 /nowarn:cs0618
5 changes: 3 additions & 2 deletions build-net7.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dotnet publish -c Release -f net7.0 -r linux-x64 -o Build/Release/net7/ /nowarn:cs0618
dotnet publish -c Release -f net7.0 -r win-x64 -o Build/Release/net7/ /nowarn:cs0618
dotnet publish libMBIN-DLL -c Release -f net7.0 --no-self-contained -r win-x64 /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net7.0 --no-self-contained -r win-x64 /nowarn:cs0618
dotnet publish SaveFileMapping -c Release -f net7.0 --no-self-contained -r win-x64 /nowarn:cs0618
pause
5 changes: 3 additions & 2 deletions build-net7.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dotnet publish -c Release -f net7.0 --no-self-contained -r linux-x64 -o Build/Release/net7/ /nowarn:cs0618
dotnet publish -c Release -f net7.0 --no-self-contained -r win-x64 -o Build/Release/net7/ /nowarn:cs0618
dotnet publish libMBIN-DLL -c Release -f net7.0 --no-self-contained -r linux-x64 /nowarn:cs0618
dotnet publish MBINCompiler -c Release -f net7.0 --no-self-contained -r linux-x64 /nowarn:cs0618
dotnet publish SaveFileMapping -c Release -f net7.0 --no-self-contained -r linux-x64 /nowarn:cs0618
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def convert_files():
platform = os.environ.get('platform')
mbincompiler_path = os.environ.get('mbincompiler_path')
if mbincompiler_path is not None:
cmd = [mbincompiler_path, '-q']
cmd = [mbincompiler_path]
else:
if platform == 'linux-x64':
# need to run with mono on linux
Expand Down
2 changes: 1 addition & 1 deletion libMBIN-DLL/libMBIN-DLL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>libMBIN</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<Configurations>Release;Debug;Release-XML</Configurations>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<RepositoryType>git</RepositoryType>
Expand Down

0 comments on commit 0156337

Please sign in to comment.