diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 0b861e2c7..b86228d3d 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -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 '\|net6.0;net7.0|a\ ${{ matrix.dotnet.version }}' ./MBINCompiler/MBINCompiler.csproj + sed -i '\|net6.0;net7.0|a\ ${{ matrix.dotnet.version }}' ./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: @@ -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" --tb=no --report + - 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 @@ -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: diff --git a/MBINCompiler/MBINCompiler.csproj b/MBINCompiler/MBINCompiler.csproj index 666a0daf9..c5904ab77 100644 --- a/MBINCompiler/MBINCompiler.csproj +++ b/MBINCompiler/MBINCompiler.csproj @@ -3,7 +3,7 @@ Exe net6.0;net7.0 false - false + true true linux-x64;win-x64 true @@ -49,32 +49,6 @@ x64 - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SaveFileMapping/SaveFileMapping.csproj b/SaveFileMapping/SaveFileMapping.csproj index 9557c8adf..e8457f02b 100644 --- a/SaveFileMapping/SaveFileMapping.csproj +++ b/SaveFileMapping/SaveFileMapping.csproj @@ -4,7 +4,7 @@ Exe net6.0;net7.0 false - false + true true linux-x64;win-x64 true diff --git a/build-net6.bat b/build-net6.bat index 12cbd9319..f187d5d91 100644 --- a/build-net6.bat +++ b/build-net6.bat @@ -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 \ No newline at end of file diff --git a/build-net6.sh b/build-net6.sh index 484dff251..e15bf8662 100755 --- a/build-net6.sh +++ b/build-net6.sh @@ -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 diff --git a/build-net7.bat b/build-net7.bat index bbc6c5be9..22f5bed96 100644 --- a/build-net7.bat +++ b/build-net7.bat @@ -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 \ No newline at end of file diff --git a/build-net7.sh b/build-net7.sh index af6147c99..060ca9627 100755 --- a/build-net7.sh +++ b/build-net7.sh @@ -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 \ No newline at end of file diff --git a/libMBIN-DLL/libMBIN-DLL.csproj b/libMBIN-DLL/libMBIN-DLL.csproj index a5be686fc..41f57054d 100644 --- a/libMBIN-DLL/libMBIN-DLL.csproj +++ b/libMBIN-DLL/libMBIN-DLL.csproj @@ -5,7 +5,7 @@ libMBIN false net6.0;net7.0 - false + true Release;Debug;Release-XML true git