Linux build #621
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: MBINCompiler | ||
on: | ||
# Run on all branches except for the gh-pages branch | ||
push: | ||
branches-ignore: | ||
- 'gh-pages' | ||
pull_request: | ||
branches-ignore: | ||
- 'gh-pages' | ||
create: | ||
workflow_dispatch: # Habilita la ejecución manual desde la interfaz de usuario | ||
jobs: | ||
build: | ||
name: Build artefacts | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
6.0.100 | ||
7.0.100 | ||
- name: Build Windows 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 | ||
# - name: Build Linux binaries | ||
# run: | | ||
# dotnet publish libMBIN-DLL -c Release -f net6.0 -r linux-x64 -o Build/Release/linux-x64/net6/ /nowarn:cs0618 | ||
# dotnet publish MBINCompiler -c Release -f net6.0 -r linux-x64 -o Build/Release/linux-x64/net6/ /nowarn:cs0618 | ||
# dotnet publish SaveFileMapping -c Release -f net6.0 -r linux-x64 -o Build/Release/linux-x64/net6/ /nowarn:cs0618 | ||
# dotnet publish libMBIN-DLL -c Release -f net7.0 -r linux-x64 -o Build/Release/linux-x64/net7/ /nowarn:cs0618 | ||
# dotnet publish MBINCompiler -c Release -f net7.0 -r linux-x64 -o Build/Release/linux-x64/net7/ /nowarn:cs0618 | ||
- name: Move the exe so the tests can find it easier | ||
shell: bash | ||
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 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Install dependencies | ||
run: | | ||
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 | ||
shell: bash | ||
run : | | ||
Build/Release/net6/SaveFileMapping.exe | ||
ls Build/Release/net6/ | ||
ls . | ||
- name: Build packages | ||
shell: bash | ||
run: | | ||
echo "VERSION=$(./MBINCompiler.exe version | awk '{print $2}')" >> $GITHUB_ENV | ||
/usr/bin/tar -zcvf "MBINCompiler-${{ env.VERSION }}-linux-x64-dotnet6.tgz" --directory=Build/Release/linux-x64/net6/ MBINCompiler libMBIN.dll report.json mapping.json | ||
# cp Build/Release/linux-x64/net7/MBINCompiler Build/Release/linux-x64/net7/MBINCompiler-dotnet7 | ||
# cp Build/Release/linux-x64/net7/libMBIN.dll Build/Release/linux-x64/net7/libMBIN-dotnet7.dll | ||
# /usr/bin/tar -zcvf MBINCompiler-${{ env.VERSION }}-linux-x64-dotnet7.tgz --directory=Build/Release/linux-x64/net7/ MBINCompiler-dotnet7 libMBIN-dotnet7.dll report.json mapping.json | ||
7z a -tzip "MBINCompiler-${{ env.VERSION }}-win-x64-dotnet6.zip" MBINCompiler.exe libMBIN.dll report.json mapping.json | ||
# 7z a -tzip MBINCompiler-${{ env.VERSION }}-win-x64-dotnet7.zip MBINCompiler-dotnet7.exe libMBIN-dotnet7.dll report.json mapping.json | ||
- name: Upload binary for release | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: MBINCompiler | ||
path: | | ||
MBINCompiler.exe | ||
libMBIN.dll | ||
MBINCompiler-dotnet7.exe | ||
libMBIN-dotnet7.dll | ||
report.json | ||
mapping.json | ||
MBINCompiler-*-win-x64-dotnet6.zip | ||
# MBINCompiler-*-win-x64-dotnet7.zip | ||
MBINCompiler-*-linux-x64-dotnet6.tgz | ||
# MBINCompiler-*-linux-x64-dotnet7.tgz | ||
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] | ||
steps: | ||
- name: Download files for release | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: MBINCompiler | ||
- name: Get MBINCompiler tag version | ||
run: | | ||
echo "VERSION=$(./MBINCompiler.exe version | awk '{print $2}')" >> $GITHUB_ENV | ||
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Upload resources if version matches | ||
if: env.VERSION == env.TAG | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: "${{ env.TAG }}" | ||
tag_name: ${{ env.TAG }} | ||
prerelease: true | ||
files: | | ||
MBINCompiler.exe | ||
libMBIN.dll | ||
MBINCompiler-dotnet7.exe | ||
libMBIN-dotnet7.dll | ||
report.json | ||
mapping.json | ||
MBINCompiler-*-win-x64-dotnet6.zip | ||
MBINCompiler-*-win-x64-dotnet7.zip | ||
MBINCompiler-*-linux-x64-dotnet6.tgz | ||
MBINCompiler-*-linux-x64-dotnet7.tgz | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Check if tag doesn't match version | ||
if: env.VERSION != env.TAG | ||
run: | | ||
echo "There is a version mismatch between the tag and MBINCompiler version!" | ||
echo "MBINCompiler version: ${{ env.VERSION }}" | ||
echo "Tag version: ${{ env.TAG }}" | ||
exit 1 | ||
shell: bash |