Skip to content

Commit

Permalink
GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Sep 20, 2023
1 parent 522d547 commit f919834
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check mypy

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]

jobs:
checks:
runs-on: ubuntu-latest
name: mypy
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: mypy
run: mypy --show-column-numbers --hide-error-context .
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Tests cases

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]

jobs:
tests_cases:
name: Tests cases
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install local ipl3checksum
run: pip install .

- name: Update tests outputs
run: python3 tests/check_correct_sum.py
37 changes: 37 additions & 0 deletions .github/workflows/upload_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and upload to PyPI

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]

jobs:
build_wheel:
name: Build wheel
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install build module
run: pip install build

- name: Build wheel and source
run: python -m build --sdist --wheel --outdir dist/ .

- uses: actions/upload-artifact@v3
with:
path: dist/*

upload_pypi:
needs: [build_wheel]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.pypi_password }}
3 changes: 3 additions & 0 deletions notes/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void calculateChecksum(const uint8_t *rom, uint32_t cic, uint32_t *dst1, uint32_
break;
}

/* Tweak: The entrypoint is kept to be able to adjust some rom reads */
entrypointRam = a0;

at = magic;
Expand Down Expand Up @@ -104,6 +105,7 @@ void calculateChecksum(const uint8_t *rom, uint32_t cic, uint32_t *dst1, uint32_
t4 = v0;

do {
/* lw $v0, 0x0($t1) */
v0 = readWord(rom, t1 - entrypointRam + 0x1000);
v1 = a3 + v0;

Expand Down Expand Up @@ -140,6 +142,7 @@ void calculateChecksum(const uint8_t *rom, uint32_t cic, uint32_t *dst1, uint32_
case 6105:
case 7105:
/* ipl3 6105 copies 0x330 bytes from the ROM's offset 0x000554 (or offset 0x000514 into IPL3) to vram 0xA0000004 */
/* lw $t7, 0x0($s6) */
t7 = readWord(rom, s6 - 0xA0000004 + 0x000554);

t0 = t0 + 0x4;
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "ipl3checksum"
version = "0.1.0.dev0"
description = "N64 IPL3 tools library"
description = "Library to calculate the IPL3 checksum for N64 ROMs"
readme = "README.md"
requires-python = ">=3.7"
dynamic = ["dependencies"]
Expand Down

0 comments on commit f919834

Please sign in to comment.