From 99903a88cc5392b0ecb995d882404760b753bb9c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 14 Mar 2025 14:01:23 -0700 Subject: [PATCH] Remove unnecessary files --- .github/workflows/compare.yml | 226 ---------------------------------- CMakeLists.txt | 1 - tools/entropy.py | 45 ------- tools/multi-analyze.ps1 | 62 ---------- tools/multi-build.ps1 | 56 --------- tools/multi-prepare.ps1 | 81 ------------ 6 files changed, 471 deletions(-) delete mode 100644 .github/workflows/compare.yml delete mode 100644 tools/entropy.py delete mode 100644 tools/multi-analyze.ps1 delete mode 100644 tools/multi-build.ps1 delete mode 100644 tools/multi-prepare.ps1 diff --git a/.github/workflows/compare.yml b/.github/workflows/compare.yml deleted file mode 100644 index b4819b72..00000000 --- a/.github/workflows/compare.yml +++ /dev/null @@ -1,226 +0,0 @@ -name: Compare - -on: - push: - branches: - - master - workflow_dispatch: - inputs: - builds_per_job: - description: 'How many builds to run in parallel on each job.' - default: 4 - required: true - type: choice - options: [1, 2, 4, 8, 16, 32, 64] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - fetch-deps: - name: Download original binaries - uses: ./.github/workflows/legobin.yml - - reccmp: - name: Setup python environment - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - # The typical cache key would include a hash on requirements.txt. - # We currently run reccmp from latest so we would have to manually purge it. - # The goal is simply to restore the cache across entropy build jobs. - - name: Cache venv - uses: actions/cache@v4 - with: - key: venv-entropy-${{ github.run_id }} - path: .venv - - - name: Install python packages - run: | - python -m venv .venv - .venv\Scripts\Activate - pip install -r tools/requirements.txt - - build: - name: 'MSVC 4.20' - needs: [fetch-deps, reccmp] - runs-on: windows-latest - strategy: - matrix: - job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] - builds: - - ${{ inputs.builds_per_job && inputs.builds_per_job || 16 }} - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - uses: actions/checkout@v4 - with: - repository: itsmattkc/msvc420 - path: msvc420 - - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 - with: - # Use minimum supported version - cmake-version: '3.15.x' - - - name: Patch MSVC 4.2 - run: | - tools/patch_c2.py msvc420/bin/C2.EXE - - - name: Restore cached original binaries - id: cache-original-binaries - uses: actions/cache/restore@v4 - with: - enableCrossOsArchive: true - path: legobin - key: legobin - - - name: Install python packages - run: | - python -m venv .venv - .venv\Scripts\Activate - echo ($env:VIRTUAL_ENV + "\Scripts") >> $env:GITHUB_PATH - echo ("VIRTUAL_ENV=" + $env:VIRTUAL_ENV) >> $env:GITHUB_ENV - - - name: Restore cached virtualenv - uses: actions/cache@v4 - with: - key: venv-entropy-${{ github.run_id }} - path: .venv - - - name: Prepare builds - shell: pwsh - run: | - cmd /c "call `".\msvc420\bin\VCVARS32.BAT`" x86 && set > %temp%\vcvars32.txt" - Get-Content "$env:temp\vcvars32.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } } - .\tools\multi-prepare.ps1 ${{ matrix.job }} ${{ matrix.builds }} - - - name: Run builds - shell: pwsh - run: | - cmd /c "call `".\msvc420\bin\VCVARS32.BAT`" x86 && set > %temp%\vcvars32.txt" - Get-Content "$env:temp\vcvars32.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } } - .\tools\multi-build.ps1 ${{ matrix.builds }} - - - name: Analyze builds - shell: pwsh - run: | - .\tools\multi-analyze.ps1 ${{ matrix.builds }} - - - name: Upload Artifact - uses: actions/upload-artifact@main - with: - name: Win32-Entropy-${{ matrix.job }} - path: | - CONFIGPROGRESS* - ISLEPROGRESS* - LEGO1PROGRESS* - - merge-artifacts: - name: 'Merge entropy artifacts' - runs-on: ubuntu-latest - needs: build - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: Win32-Entropy - pattern: Win32-Entropy-* - separate-directories: true - - compare: - name: Compare with master - needs: [merge-artifacts] - runs-on: windows-latest - steps: - - uses: actions/checkout@main - - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - uses: actions/download-artifact@main - with: - name: Win32-Entropy - path: build-entropy - - - name: Install python packages - run: | - python -m venv .venv - .venv\Scripts\Activate - echo ($env:VIRTUAL_ENV + "\Scripts") >> $env:GITHUB_PATH - echo ("VIRTUAL_ENV=" + $env:VIRTUAL_ENV) >> $env:GITHUB_ENV - - - name: Restore cached virtualenv - uses: actions/cache@v4 - with: - key: venv-entropy-${{ github.run_id }} - path: .venv - - - name: Aggregate Accuracy - shell: bash - run: | - reccmp-aggregate --samples $(find build-entropy -type f -name "CONFIGPROGRESS*.json") --output CONFIGPROGRESS-agg.json --html CONFIGPROGRESS-agg.html - reccmp-aggregate --samples $(find build-entropy -type f -name "ISLEPROGRESS*.json") --output ISLEPROGRESS-agg.json --html ISLEPROGRESS-agg.html - reccmp-aggregate --samples $(find build-entropy -type f -name "LEGO1PROGRESS*.json") --output LEGO1PROGRESS-agg.json --html LEGO1PROGRESS-agg.html - - - name: Compare Aggregate Accuracy With Current Master - shell: bash - env: - RELEASE_URL: https://github.com/isledecomp/isle/releases/download/continuous-accuracy - run: | - # Download the current master state - curl -fLSs -o CONFIGPROGRESS-agg-old.json $RELEASE_URL/CONFIGPROGRESS-agg.json || echo "" >CONFIGPROGRESS-agg-old.json - curl -fLSs -o ISLEPROGRESS-agg-old.json $RELEASE_URL/ISLEPROGRESS-agg.json || echo "" >ISLEPROGRESS-agg-old.json - curl -fLSs -o LEGO1PROGRESS-agg-old.json $RELEASE_URL/LEGO1PROGRESS-agg.json || echo "" >LEGO1PROGRESS-agg-old.json - - # Compare with current master - reccmp-aggregate --diff CONFIGPROGRESS-agg-old.json CONFIGPROGRESS-agg.json || echo "Current master not found" - reccmp-aggregate --diff ISLEPROGRESS-agg-old.json ISLEPROGRESS-agg.json || echo "Current master not found" - reccmp-aggregate --diff LEGO1PROGRESS-agg-old.json LEGO1PROGRESS-agg.json || echo "Current master not found" - - - name: Upload Artifact - uses: actions/upload-artifact@main - with: - name: Accuracy Report - path: | - CONFIGPROGRESS* - ISLEPROGRESS* - LEGO1PROGRESS* - - upload: - name: Upload artifacts - needs: [compare] - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'isledecomp/isle' }} - steps: - - uses: actions/checkout@v4 - with: - repository: probonopd/uploadtool - - - uses: actions/download-artifact@main - with: - name: Accuracy Report - - - name: Upload Continuous Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }} - run: | - export UPLOADTOOL_SUFFIX=accuracy - ./upload.sh \ - CONFIGPROGRESS* \ - ISLEPROGRESS* \ - LEGO1PROGRESS* diff --git a/CMakeLists.txt b/CMakeLists.txt index ba6967e1..5a337e63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -291,7 +291,6 @@ add_lego1_static_library(omni LEGO1/omni/src/video/mxloopingsmkpresenter.cpp LEGO1/omni/src/video/mxpalette.cpp LEGO1/omni/src/video/mxregion.cpp - LEGO1/omni/src/video/mxregioncursor.cpp LEGO1/omni/src/video/mxsmk.cpp LEGO1/omni/src/video/mxsmkpresenter.cpp LEGO1/omni/src/video/mxstillpresenter.cpp diff --git a/tools/entropy.py b/tools/entropy.py deleted file mode 100644 index a98a98b8..00000000 --- a/tools/entropy.py +++ /dev/null @@ -1,45 +0,0 @@ -import random -import string -import sys - -# Parameters for tweaking: -MAX_CLASSES = 10 -MAX_FUNC_PER_CLASS = 10 - -# Only the unique suffix, not counting "Class" or "Function" -CLASS_NAME_LEN = 6 -FUNC_NAME_LEN = 8 - - -def random_camel_case(length: int) -> str: - """Return a random string with first letter capitalized.""" - return "".join( - [ - random.choice(string.ascii_uppercase), - *random.choices(string.ascii_lowercase, k=length - 1), - ] - ) - - -# If the first parameter is an integer, use it as the seed. -try: - seed = int(sys.argv[1]) -except (IndexError, ValueError): - seed = random.randint(0, 10000) - -random.seed(seed) - -print(f"// Seed: {seed}\n") - -num_classes = random.randint(1, MAX_CLASSES) -for i in range(num_classes): - class_name = "Class" + random_camel_case(CLASS_NAME_LEN) - print(f"class {class_name} {{") - num_functions = random.randint(1, MAX_FUNC_PER_CLASS) - for j in range(num_functions): - function_name = "Function" + random_camel_case(FUNC_NAME_LEN) - print(f"\tinline void {function_name}() {{}}") - - print(f"}};\n") - -print() diff --git a/tools/multi-analyze.ps1 b/tools/multi-analyze.ps1 deleted file mode 100644 index 36caf284..00000000 --- a/tools/multi-analyze.ps1 +++ /dev/null @@ -1,62 +0,0 @@ -if ($args.count -lt 1) { - Write-Error "Requires 1 arg: number of builds for this job." - exit 1 -} - -$BuildCount = [int]$args[0] -$build_ids = 0..($BuildCount-1) - -$build_dirs = foreach($i in $build_ids) { "build$i" } -$stdout_files = foreach($i in $build_ids) { "stdout$i.txt" } -$stderr_files = foreach($i in $build_ids) { "stderr$i.txt" } - -$artifacts = @( - @{prog = "CONFIGPROGRESS"; binfile = "CONFIG.EXE"; pdbfile = "CONFIG.PDB"; codedir = "."} - @{prog = "ISLEPROGRESS"; binfile = "ISLE.EXE"; pdbfile = "ISLE.PDB"; codedir = "."} - @{prog = "LEGO1PROGRESS"; binfile = "LEGO1.DLL"; pdbfile = "LEGO1.PDB"; codedir = "LEGO1"} -) - -foreach($a in $artifacts) { - $procs = New-Object System.Collections.Generic.List[System.Diagnostics.Process] - - foreach($i in $build_ids) { - $params = @{ - FilePath = "reccmp-reccmp" - PassThru = $null - ArgumentList = @( - "--paths", - $("legobin/" + $a["binfile"]), - $($build_dirs[$i] + "/" + $a["binfile"]), - $($build_dirs[$i] + "/" + $a["pdbfile"]), - $a["codedir"], - "--json", - $($a["prog"] + "$i.json"), - "--silent" - ) - } - - # For the first job, display stdout and stderr. - # Else dump to file so we don't see 50 at once. - if ($i -eq 0) { - $params.Add("NoNewWindow", $null) - } else { - $params.Add("RedirectStandardOutput", $stdout_files[$i]) - $params.Add("RedirectStandardError", $stderr_files[$i]) - } - - $procs.Add($(Start-Process @params)) - } - - $failed = $false - try { Wait-Process -InputObject $procs } catch { $failed = $true } - - foreach($i in $build_ids) { - if ($procs[$i].ExitCode -ne 0) { - Get-Content $stdout_files[$i] -Tail 20 - Get-Content $stderr_files[$i] -Tail 20 - $failed = $true - } - } - - if ($failed) { exit 1 } -} diff --git a/tools/multi-build.ps1 b/tools/multi-build.ps1 deleted file mode 100644 index 5be28c09..00000000 --- a/tools/multi-build.ps1 +++ /dev/null @@ -1,56 +0,0 @@ -if ($args.count -lt 1) { - Write-Error "Requires 1 arg: number of builds for this job." - exit 1 -} - -$BuildCount = [int]$args[0] - -$build_ids = 0..($BuildCount - 1) -$build_dirs = foreach($i in $build_ids) { "build$i" } -$stdout_files = foreach($i in $build_ids) { "stdout$i.txt" } -$stderr_files = foreach($i in $build_ids) { "stderr$i.txt" } - -# Create unique temp dir for each build thread -$temp_dirs = foreach($dir in $build_dirs) { "$env:temp\$dir" } -New-Item -ItemType Directory -Force -Path $temp_dirs - -$procs = New-Object System.Collections.Generic.List[System.Diagnostics.Process] - -foreach($i in $build_ids) { - $params = @{ - FilePath = "cmake" - PassThru = $null - ArgumentList = @("--build", $build_dirs[$i]) - Environment = @{ TEMP = $temp_dirs[$i]; TMP = $temp_dirs[$i] } - } - - # For the first job, display stdout and stderr. - # Else dump to file so we don't see 50 at once. - if ($i -eq 0) { - $params.Add("NoNewWindow", $null) - } else { - $params.Add("RedirectStandardOutput", $stdout_files[$i]) - $params.Add("RedirectStandardError", $stderr_files[$i]) - } - - $procs.Add($(Start-Process @params)) -} - - -$failed = $false - -# Wait for all builds to finish -try { Wait-Process -InputObject $procs } catch { $failed = $true } - -# Check for failure -foreach($i in $build_ids) { - if ($procs[$i].ExitCode -ne 0) { - if ($i -ne 0) { - Get-Content $stdout_files[$i] -Tail 10 - Get-Content $stderr_files[$i] -Tail 10 - } - $failed = $true - } -} - -if ($failed) { exit 1 } diff --git a/tools/multi-prepare.ps1 b/tools/multi-prepare.ps1 deleted file mode 100644 index 3ba89ed8..00000000 --- a/tools/multi-prepare.ps1 +++ /dev/null @@ -1,81 +0,0 @@ -if ($args.count -lt 2) { - Write-Error "Requires 2 args: job matrix number and number of builds for this job." - exit 1 -} - -function Get-BaseSeed { - Param ( - [int]$Matrix - ) - - # GITHUB_SHA is the commit hash. This means the entropy files will be consistent - # unless you push a new commit. - $sha = [System.Convert]::ToUInt32($env:GITHUB_SHA.Substring(0, 8), 16) - - # Mask off the last 16 bits - $base_seed = ($sha -band 0xffff0000) - - # Add the matrix number * 256. We can run 256 unique builds on this job. - return $base_seed + ($Matrix -shl 8) -} - -$MatrixNo = [int]$args[0] -$BuildCount = [int]$args[1] -$base_seed = $(Get-BaseSeed -Matrix $MatrixNo) - -$build_ids = 0..($BuildCount - 1) - -$build_dirs = foreach($i in $build_ids) { "build$i" } -$stdout_files = foreach($i in $build_ids) { "stdout$i.txt" } -$stderr_files = foreach($i in $build_ids) { "stderr$i.txt" } - -$procs = New-Object System.Collections.Generic.List[System.Diagnostics.Process] - -foreach($i in $build_ids) { - # Create the entropy file - $entropy_file = "entropy$i.h" - $seed = $base_seed + $i - - Write-Output "Using seed: $seed (instance $i)" - python3 tools/entropy.py $seed > $entropy_file - - # Prepare to build - $params = @{ - FilePath = "cmake" - PassThru = $null - ArgumentList = @( - "-B", $build_dirs[$i], - "-DCMAKE_BUILD_TYPE=RelWithDebInfo", - "-DISLE_INCLUDE_ENTROPY=ON", - "-DISLE_ENTROPY_FILENAME=$entropy_file", - "-G", "`"NMake Makefiles`"" - ) - } - - # For the first job, display stdout and stderr. - # Else dump to file so we don't see 50 at once. - if ($i -eq 0) { - $params.Add("NoNewWindow", $null) - } else { - $params.Add("RedirectStandardOutput", $stdout_files[$i]) - $params.Add("RedirectStandardError", $stderr_files[$i]) - } - - $procs.Add($(Start-Process @params)) -} - -$failed = $false -try { Wait-Process -InputObject $procs } catch { $failed = $true } - -# Check for failure -foreach($i in $build_ids) { - if ($procs[$i].ExitCode -ne 0) { - if ($i -ne 0) { - Get-Content $stdout_files[$i] -Tail 10 - Get-Content $stderr_files[$i] -Tail 10 - } - $failed = $true - } -} - -if ($failed) { exit 1 }