Test determinism with full Server archive from MapleStory2-XML #3
This file contains hidden or 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: Archive Determinism Check | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| build-archive: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Print .NET info | |
| run: dotnet --info | |
| - name: Clone test data | |
| run: git clone --depth 1 https://github.com/MS2Community/MapleStory2-XML.git test-data | |
| - name: Build | |
| run: dotnet build MS2Tools.sln -c Release | |
| - name: Run tests | |
| run: dotnet test MS2Lib/MS2Lib.Tests/MS2Lib.Tests.csproj -c Release --no-build | |
| - name: Create archive from test-fixture (run 1) | |
| run: dotnet run --project MS2Create -c Release --no-build -- ./test-fixture ./out-fixture1 TestFixture MS2F | |
| - name: Create archive from test-fixture (run 2) | |
| run: dotnet run --project MS2Create -c Release --no-build -- ./test-fixture ./out-fixture2 TestFixture MS2F | |
| - name: Create archive from Server (run 1) | |
| run: dotnet run --project MS2Create -c Release --no-build -- ./test-data/Server ./out-server1 Server MS2F | |
| - name: Create archive from Server (run 2) | |
| run: dotnet run --project MS2Create -c Release --no-build -- ./test-data/Server ./out-server2 Server MS2F | |
| - name: Hash outputs | |
| shell: bash | |
| run: | | |
| echo "=== Test Fixture ===" | |
| sha256sum out-fixture1/TestFixture.m2d out-fixture1/TestFixture.m2h | tee fixture-run1-full.txt | |
| sha256sum out-fixture2/TestFixture.m2d out-fixture2/TestFixture.m2h | tee fixture-run2-full.txt | |
| awk '{print $1}' fixture-run1-full.txt > fixture-run1.txt | |
| awk '{print $1}' fixture-run2-full.txt > fixture-run2.txt | |
| echo "=== Server ===" | |
| sha256sum out-server1/Server.m2d out-server1/Server.m2h | tee server-run1-full.txt | |
| sha256sum out-server2/Server.m2d out-server2/Server.m2h | tee server-run2-full.txt | |
| awk '{print $1}' server-run1-full.txt > server-run1.txt | |
| awk '{print $1}' server-run2-full.txt > server-run2.txt | |
| - name: Verify same-platform determinism (test-fixture) | |
| shell: bash | |
| run: | | |
| if diff fixture-run1.txt fixture-run2.txt; then | |
| echo "PASS: Test fixture — same-platform runs are identical" | |
| else | |
| echo "FAIL: Test fixture — same-platform runs differ!" | |
| exit 1 | |
| fi | |
| - name: Verify same-platform determinism (Server) | |
| shell: bash | |
| run: | | |
| if diff server-run1.txt server-run2.txt; then | |
| echo "PASS: Server — same-platform runs are identical" | |
| else | |
| echo "FAIL: Server — same-platform runs differ!" | |
| exit 1 | |
| fi | |
| - name: Upload hashes | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hashes-${{ matrix.os }} | |
| path: server-run1.txt | |
| compare-platforms: | |
| needs: build-archive | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Windows hashes | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hashes-windows-latest | |
| path: win | |
| - name: Download Linux hashes | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hashes-ubuntu-latest | |
| path: linux | |
| - name: Compare cross-platform hashes (Server) | |
| run: | | |
| echo "=== Windows ===" | |
| cat win/server-run1.txt | |
| echo "=== Linux ===" | |
| cat linux/server-run1.txt | |
| echo "=== Diff ===" | |
| if diff win/server-run1.txt linux/server-run1.txt; then | |
| echo "PASS: Cross-platform Server archives are byte-identical!" | |
| else | |
| echo "FAIL: Cross-platform Server archives differ" | |
| exit 1 | |
| fi |