diff --git a/.github/workflows/build_master.yml b/.github/workflows/build_master.yml new file mode 100644 index 0000000..4259f7e --- /dev/null +++ b/.github/workflows/build_master.yml @@ -0,0 +1,39 @@ +name: Build +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: + - develop +jobs: + build: + name: Patch building + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build the patch + run: "docker run --rm -u root -v ${PWD}:/home/m2gba/src lorenzooone/m2gba_translation:patch_builder" + - name: Archive resulting patch + uses: actions/upload-artifact@v3 + with: + name: m12-patch + path: out/m12.ips + + publish: + name: Patch publishing + runs-on: ubuntu-latest + needs: build + steps: + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: m12-patch + - name: Auto-Release the patch + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "nightly-latest" + prerelease: true + title: "Automatic Build" + files: | + m12.ips diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml new file mode 100644 index 0000000..5e7fe52 --- /dev/null +++ b/.github/workflows/build_pr.yml @@ -0,0 +1,19 @@ +name: Build PR +on: + pull_request: + branches: develop + +jobs: + build: + name: Patch building + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build the patch + run: "docker run --rm -u root -v ${PWD}:/home/m2gba/src lorenzooone/m2gba_translation:patch_builder" + - name: Archive resulting patch + uses: actions/upload-artifact@v3 + with: + name: m12-patch + path: out/m12.ips + diff --git a/.github/workflows/test_master.yml b/.github/workflows/test_master.yml new file mode 100644 index 0000000..a149c32 --- /dev/null +++ b/.github/workflows/test_master.yml @@ -0,0 +1,37 @@ +name: Test +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: + - develop +jobs: + test: + name: Testing + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Unpack the required data for the tests + run: | + gpg --quiet --batch --yes --decrypt --passphrase="$TESTING_PASSPHRASE" --output bin/testing_required_data.zip bin/testing_required_data.zip.gpg + sudo apt install unzip + unzip -q bin/testing_required_data.zip -d bin + env: + TESTING_PASSPHRASE: ${{ secrets.TESTING_PASSPHRASE }} + - name: Test the code + run: "docker run --rm -u root -v ${PWD}:/home/m2gba/src lorenzooone/m2gba_translation:tester" + - name: Archive test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-report + path: out/test.log + - name: Create Issue for Test failure + if: failure() + uses: peter-evans/create-issue-from-file@v4 + with: + title: Test failure + content-filepath: out/test.log + labels: | + report + automated issue diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml new file mode 100644 index 0000000..e881ae4 --- /dev/null +++ b/.github/workflows/test_pr.yml @@ -0,0 +1,26 @@ +name: Test PR +on: + pull_request: + branches: develop + +jobs: + test: + name: Testing + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Unpack the required data for the tests + run: | + gpg --quiet --batch --yes --decrypt --passphrase="$TESTING_PASSPHRASE" --output bin/testing_required_data.zip bin/testing_required_data.zip.gpg + sudo apt install unzip + unzip -q bin/testing_required_data.zip -d bin + env: + TESTING_PASSPHRASE: ${{ secrets.TESTING_PASSPHRASE }} + - name: Test the code + run: "docker run --rm -u root -v ${PWD}:/home/m2gba/src lorenzooone/m2gba_translation:tester" + - name: Archive test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-report + path: out/test.log diff --git a/.gitignore b/.gitignore index 7abbcd8..6ad7fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ working/*.asm working/*.bin working/m12-labels.txt armips.exe +testing_required_data.zip.gpg *.sym m2-compiled.asm diff --git a/README.md b/README.md index 29e9d0e..721bd3d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ | Branch | Status | | --- | --- | -| Project | [![Build status](https://ci.appveyor.com/api/projects/status/9ml81r7fn0k7i8g1?svg=true)](https://ci.appveyor.com/project/jeffman/mother2gbatranslation) | -| `master` | [![Build status](https://ci.appveyor.com/api/projects/status/9ml81r7fn0k7i8g1/branch/master?svg=true)](https://ci.appveyor.com/project/jeffman/mother2gbatranslation/branch/master) | +| `master` | [![Build](https://github.com/Lorenzooone/Mother2GbaTranslation/actions/workflows/build_master.yml/badge.svg)](https://github.com/Lorenzooone/Mother2GbaTranslation/actions/workflows/build_master.yml) | +| `master` | [![Test](https://github.com/Lorenzooone/Mother2GbaTranslation/actions/workflows/test_master.yml/badge.svg)](https://github.com/Lorenzooone/Mother2GbaTranslation/actions/workflows/test_master.yml) | # MOTHER 2 Translation for the GBA This is a work-in-progress translation patch for MOTHER 2 on the GBA. diff --git a/bin/testing_required_data.zip.gpg b/bin/testing_required_data.zip.gpg new file mode 100644 index 0000000..2db9c86 Binary files /dev/null and b/bin/testing_required_data.zip.gpg differ diff --git a/docker-scripts/build-dockers/Dockerfile b/docker-scripts/build-dockers/Dockerfile index 5f07c61..b3b70c4 100644 --- a/docker-scripts/build-dockers/Dockerfile +++ b/docker-scripts/build-dockers/Dockerfile @@ -30,6 +30,10 @@ WORKDIR /opt/src USER m2gba CMD /home/m2gba/src/docker-scripts/docker-build-rom-script +#--------------------- Building patch ------------------------ +FROM builder AS patch_builder +CMD /home/m2gba/src/docker-scripts/docker-build-patch-script + #---------------------- Building mgba ------------------------ FROM builder AS mgba_builder USER root diff --git a/docker-scripts/build-dockers/build-patch-builder.sh b/docker-scripts/build-dockers/build-patch-builder.sh new file mode 100755 index 0000000..0d3dd67 --- /dev/null +++ b/docker-scripts/build-dockers/build-patch-builder.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker image rm lorenzooone/m2gba_translation:patch_builder +docker build --target patch_builder . -t lorenzooone/m2gba_translation:patch_builder diff --git a/docker-scripts/docker-build-patch-script b/docker-scripts/docker-build-patch-script new file mode 100755 index 0000000..469d655 --- /dev/null +++ b/docker-scripts/docker-build-patch-script @@ -0,0 +1,18 @@ +#!/bin/pwsh + +$Env:PATH += ":/home/m2gba/.dotnet:/home/m2gba/.dotnet/tools" +Copy-Item -Path "\home\m2gba\src\*" -Destination "\opt\src" -Recurse -Force + +"Starting to build tools" +./build-tools.ps1 +if ($LASTEXITCODE -ne 0) { exit -1 } + +"Starting to build rom" +./build-appveyor.ps1 +if ($LASTEXITCODE -ne 0) { exit -1 } + +"Copying patch to output" +New-Item -Path "\home\m2gba\src" -Name "out" -ItemType "directory" -Force +Copy-Item -Path ".\bin\m12.ips" "\home\m2gba\src\out" + +"Build successful, please review the folder ./out/m12.ips for the resulting patch" diff --git a/docker-scripts/docker-build-rom-script b/docker-scripts/docker-build-rom-script index 862688f..12b196e 100755 --- a/docker-scripts/docker-build-rom-script +++ b/docker-scripts/docker-build-rom-script @@ -5,9 +5,11 @@ Copy-Item -Path "\home\m2gba\src\*" -Destination "\opt\src" -Recurse -Force "Starting to build tools" ./build-tools.ps1 +if ($LASTEXITCODE -ne 0) { exit -1 } "Starting to build rom" ./build.ps1 +if ($LASTEXITCODE -ne 0) { exit -1 } "Copying rom to output" New-Item -Path "\home\m2gba\src" -Name "out" -ItemType "directory" -Force diff --git a/docker-scripts/docker-test-rom-script b/docker-scripts/docker-test-rom-script index 6a77c8f..d4435e5 100755 --- a/docker-scripts/docker-test-rom-script +++ b/docker-scripts/docker-test-rom-script @@ -10,13 +10,17 @@ Copy-Item -Path "\home\m2gba\src\*" -Destination "\opt\src" -Recurse -Force "Starting to build tools" ./build-tools.ps1 +if ($LASTEXITCODE -ne 0) { exit -1 } "Starting to build test rom" ./test.ps1 +$LAST_VAL = $LASTEXITCODE "Copying test log to output" New-Item -Path "\home\m2gba\src" -Name "out" -ItemType "directory" -Force Copy-Item -Path ".\bin\test.log" "\home\m2gba\src\out" Copy-Item -Path ".\bin\m12test.gba" "\home\m2gba\src\out" +if ($LAST_VAL -ne 0) { exit -1 } + "Test ran successfully, please review the ./out folder for the resulting logs and test rom" diff --git a/src/c/custom_codes.c b/src/c/custom_codes.c index 49b9c2a..aa31677 100644 --- a/src/c/custom_codes.c +++ b/src/c/custom_codes.c @@ -231,4 +231,4 @@ int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, by } return addedSize; -} \ No newline at end of file +}