From 457300ddba0c08754743451c90e1b58c6f8e4449 Mon Sep 17 00:00:00 2001 From: larzie Date: Wed, 25 Dec 2024 18:39:26 +0300 Subject: [PATCH] Update actions (#1275) * Update analyze action * Update build action * Update format action * Update legobin action * Update naming action --- .github/workflows/analyze.yml | 27 ++-- .github/workflows/build.yml | 268 ++++++++++++++++++---------------- .github/workflows/format.yml | 22 +-- .github/workflows/legobin.yml | 42 +++--- .github/workflows/naming.yml | 71 ++++----- 5 files changed, 227 insertions(+), 203 deletions(-) diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 2a25072a..8dd32385 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -1,6 +1,9 @@ name: Analyze -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: jobs: decomplint-isle: @@ -15,16 +18,18 @@ jobs: - LEGO1 steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.12' + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' - - name: Install python libraries - run: | - pip install -r tools/requirements.txt + - name: Setup Python modules + run: | + pip install -r tools/requirements.txt - - name: Run decomplint.py - run: | - reccmp-decomplint ${{ matrix.who }} --module ${{ matrix.who }} --warnfail + - name: Run decomplint.py + run: | + reccmp-decomplint ${{ matrix.who }} --module ${{ matrix.who }} --warnfail diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52b9958a..a8d74d24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: jobs: fetch-deps: @@ -17,12 +20,15 @@ jobs: fail-fast: false matrix: toolchain: - - { name: 'MSVC', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true } - - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true } - - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, no-dx5-libs: true } + - { name: 'MSVC', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true } + - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true } + - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, no-dx5-libs: true } steps: - - name: Set up MSYS2 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup MSYS2 if: ${{ !!matrix.toolchain.msystem }} uses: msys2/setup-msys2@v2 with: @@ -33,21 +39,19 @@ jobs: ${{ matrix.toolchain.msys-env }}-ninja ${{ matrix.toolchain.msys-env }}-clang-tools-extra - - name: Setup cmake + - name: Setup CMake if: matrix.toolchain.setup-cmake uses: jwlawson/actions-setup-cmake@v2 - name: Setup ninja if: matrix.toolchain.setup-ninja - uses: ashutoshvarma/setup-ninja@master + uses: larziwau/gha-setup-ninja@master - name: Setup vcvars if: matrix.toolchain.setup-msvc uses: ilammy/msvc-dev-cmd@v1 with: - arch: amd64_x86 # Use the 64-bit x64-native cross tools to build 32-bit x86 code - - - uses: actions/checkout@v4 + arch: amd64_x86 - name: Build run: | @@ -60,126 +64,129 @@ jobs: cmake --build build -- -k0 build: - name: 'MSVC 4.20' + name: MSVC 4.20 runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: itsmattkc/msvc420 - path: msvc420 + - name: Checkout MSVC repository + 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: Setup CMake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: '3.31.x' - - name: Patch MSVC 4.2 - run: | - tools/patch_c2.py msvc420/bin/C2.EXE + - name: Patch MSVC + run: | + tools/patch_c2.py msvc420/bin/C2.EXE - - name: Build - shell: cmd - run: | - call .\msvc420\bin\VCVARS32.BAT x86 - cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "NMake Makefiles" - cmake --build build + - name: Build + shell: cmd + run: | + call .\msvc420\bin\VCVARS32.BAT x86 + cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "NMake Makefiles" + cmake --build build - - name: Upload Artifact - uses: actions/upload-artifact@main - with: - name: Win32 - path: | - build/CONFIG.EXE - build/CONFIG.PDB - build/ISLE.EXE - build/ISLE.PDB - build/LEGO1.DLL - build/LEGO1.PDB + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: Win32 + path: | + build/CONFIG.EXE + build/CONFIG.PDB + build/ISLE.EXE + build/ISLE.PDB + build/LEGO1.DLL + build/LEGO1.PDB compare: name: Compare with master needs: [build, fetch-deps] runs-on: windows-latest steps: - - uses: actions/checkout@main + - name: Checkout repository + uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.12' + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' - - uses: actions/download-artifact@main - with: - name: Win32 - path: build + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: Win32 + path: build - - name: Restore cached original binaries - id: cache-original-binaries - uses: actions/cache/restore@v4 - with: - enableCrossOsArchive: true - path: legobin - key: legobin + - 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 - shell: bash - run: | - pip install -r tools/requirements.txt + - name: Setup Python modules + shell: bash + run: | + pip install -r tools/requirements.txt - - name: Detect binaries - run: | - reccmp-project detect --what original --search-path legobin - reccmp-project detect --what recompiled --search-path build + - name: Detect binaries + run: | + reccmp-project detect --what original --search-path legobin + reccmp-project detect --what recompiled --search-path build - - name: Summarize Accuracy - shell: bash - run: | - reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT - reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT - reccmp-reccmp -S LEGO1PROGRESS.SVG --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT + - name: Summarize accuracy + shell: bash + run: | + reccmp-reccmp -S CONFIGPROGRESS.SVG --svg-icon assets/config.png --target CONFIG | tee CONFIGPROGRESS.TXT + reccmp-reccmp -S ISLEPROGRESS.SVG --svg-icon assets/isle.png --target ISLE | tee ISLEPROGRESS.TXT + reccmp-reccmp -S LEGO1PROGRESS.SVG --svg-icon assets/lego1.png --target LEGO1 | tee LEGO1PROGRESS.TXT - - name: Compare Accuracy With Current Master - shell: bash - run: | - # Compare with current master - curl -fLSs -o CONFIGPROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/CONFIGPROGRESS.TXT || echo "" >CONFIGPROGRESS-OLD.TXT - curl -fLSs -o ISLEPROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/ISLEPROGRESS.TXT || echo "" >ISLEPROGRESS-OLD.TXT - curl -fLSs -o LEGO1PROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/LEGO1PROGRESS.TXT || echo "" >LEGO1PROGRESS-OLD.TXT + - name: Compare accuracy with current master + shell: bash + run: | + curl -fLSs -o CONFIGPROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/CONFIGPROGRESS.TXT || echo "" >CONFIGPROGRESS-OLD.TXT + curl -fLSs -o ISLEPROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/ISLEPROGRESS.TXT || echo "" >ISLEPROGRESS-OLD.TXT + curl -fLSs -o LEGO1PROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/LEGO1PROGRESS.TXT || echo "" >LEGO1PROGRESS-OLD.TXT - diff -u0 CONFIGPROGRESS-OLD.TXT CONFIGPROGRESS.TXT || true - diff -u0 ISLEPROGRESS-OLD.TXT ISLEPROGRESS.TXT || true - diff -u0 LEGO1PROGRESS-OLD.TXT LEGO1PROGRESS.TXT || true + diff -u0 CONFIGPROGRESS-OLD.TXT CONFIGPROGRESS.TXT || true + diff -u0 ISLEPROGRESS-OLD.TXT ISLEPROGRESS.TXT || true + diff -u0 LEGO1PROGRESS-OLD.TXT LEGO1PROGRESS.TXT || true - - name: Test Exports - shell: bash - run: | - reccmp-verexp --target LEGO1 + - name: Test exports + shell: bash + run: | + reccmp-verexp --target LEGO1 - - name: Check Vtables - shell: bash - run: | - reccmp-vtable --target CONFIG - reccmp-vtable --target ISLE - reccmp-vtable --target LEGO1 + - name: Check vtables + shell: bash + run: | + reccmp-vtable --target CONFIG + reccmp-vtable --target ISLE + reccmp-vtable --target LEGO1 - - name: Check Variables - shell: bash - run: | - reccmp-datacmp --target CONFIG - reccmp-datacmp --target ISLE - reccmp-datacmp --target LEGO1 + - name: Check variables + shell: bash + run: | + reccmp-datacmp --target CONFIG + reccmp-datacmp --target ISLE + reccmp-datacmp --target LEGO1 - - name: Upload Artifact - uses: actions/upload-artifact@main - with: - name: Accuracy Report - path: | - CONFIGPROGRESS.* - ISLEPROGRESS.* - LEGO1PROGRESS.* + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: Accuracy Report + path: | + CONFIGPROGRESS.* + ISLEPROGRESS.* + LEGO1PROGRESS.* upload: name: Upload artifacts @@ -187,32 +194,35 @@ jobs: 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 + - name: Checkout uploadtool repository + uses: actions/checkout@v4 + with: + repository: probonopd/uploadtool - - uses: actions/download-artifact@main - with: - name: Win32 - path: build + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: Win32 + path: build - - uses: actions/download-artifact@main - with: - name: Accuracy Report + - name: Download accuracy report artifact + uses: actions/download-artifact@v4 + with: + name: Accuracy Report - - name: Upload Continuous Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }} - run: | - ./upload.sh \ - build/CONFIG.EXE \ - build/ISLE.EXE \ - build/LEGO1.DLL \ - CONFIGPROGRESS.* \ - ISLEPROGRESS.* \ - LEGO1PROGRESS.* + - name: Upload continuous release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }} + run: | + ./upload.sh \ + build/CONFIG.EXE \ + build/ISLE.EXE \ + build/LEGO1.DLL \ + CONFIGPROGRESS.* \ + ISLEPROGRESS.* \ + LEGO1PROGRESS.* - curl -X POST -F key=$UPLOAD_KEY -F 'file=@CONFIGPROGRESS.SVG' https://legoisland.org/progress/ - curl -X POST -F key=$UPLOAD_KEY -F 'file=@ISLEPROGRESS.SVG' https://legoisland.org/progress/ - curl -X POST -F key=$UPLOAD_KEY -F 'file=@LEGO1PROGRESS.SVG' https://legoisland.org/progress/ + curl -X POST -F key=$UPLOAD_KEY -F 'file=@CONFIGPROGRESS.SVG' https://legoisland.org/progress/ + curl -X POST -F key=$UPLOAD_KEY -F 'file=@ISLEPROGRESS.SVG' https://legoisland.org/progress/ + curl -X POST -F key=$UPLOAD_KEY -F 'file=@LEGO1PROGRESS.SVG' https://legoisland.org/progress/ diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 74424665..cbbac4b6 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,6 +1,9 @@ name: Format -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: jobs: clang-format: @@ -8,12 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Run clang-format - run: | - find CONFIG LEGO1 ISLE -iname '*.h' -o -iname '*.cpp' | xargs \ - pipx run "clang-format>=17,<18" \ - --style=file \ - -i - git diff --exit-code + - name: Run clang-format + run: | + find CONFIG LEGO1 ISLE -iname '*.h' -o -iname '*.cpp' | xargs \ + pipx run "clang-format>=17,<18" \ + --style=file \ + -i + git diff --exit-code diff --git a/.github/workflows/legobin.yml b/.github/workflows/legobin.yml index 0fcf175f..152becff 100644 --- a/.github/workflows/legobin.yml +++ b/.github/workflows/legobin.yml @@ -2,31 +2,31 @@ name: Download legobin on: workflow_call: + workflow_dispatch: jobs: fetch: runs-on: ubuntu-latest steps: + - name: Restore cached original binaries + id: cache-original-binaries + uses: actions/cache/restore@v4 + with: + enableCrossOsArchive: true + path: legobin + key: legobin - - name: Restore cached original binaries - id: cache-original-binaries - uses: actions/cache/restore@v4 - with: - enableCrossOsArchive: true - path: legobin - key: legobin + - name: Download original Island binaries + if: ${{ !steps.cache-original-binaries.outputs.cache-hit }} + run: | + wget https://legoisland.org/download/CONFIG.EXE --directory-prefix=legobin + wget https://legoisland.org/download/ISLE.EXE --directory-prefix=legobin + wget https://legoisland.org/download/LEGO1.DLL --directory-prefix=legobin - - name: Download original island binaries - if: ${{ !steps.cache-original-binaries.outputs.cache-hit }} - run: | - wget https://legoisland.org/download/CONFIG.EXE --directory-prefix=legobin - wget https://legoisland.org/download/ISLE.EXE --directory-prefix=legobin - wget https://legoisland.org/download/LEGO1.DLL --directory-prefix=legobin - - - name: Cache original binaries - if: ${{ !steps.cache-original-binaries.outputs.cache-hit }} - uses: actions/cache/save@v4 - with: - enableCrossOsArchive: true - path: legobin - key: legobin + - name: Cache original binaries + if: ${{ !steps.cache-original-binaries.outputs.cache-hit }} + uses: actions/cache/save@v4 + with: + enableCrossOsArchive: true + path: legobin + key: legobin diff --git a/.github/workflows/naming.yml b/.github/workflows/naming.yml index 15d57553..4503c74c 100644 --- a/.github/workflows/naming.yml +++ b/.github/workflows/naming.yml @@ -1,6 +1,9 @@ name: Naming -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: jobs: ncc: @@ -8,40 +11,42 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: '16' + - name: Setup LLVM and Clang + uses: KyleMayes/install-llvm-action@v2 + with: + version: '16' - - uses: actions/setup-python@v5 - with: - python-version: '3.12' + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' - - name: Install python libraries - run: | - pip install -r tools/requirements.txt + - name: Setup Python modules + run: | + pip install -r tools/requirements.txt - - name: Run ncc - run: | - action_headers=$(find LEGO1/lego/legoomni/include/actions \ - -name '*.h' -print0 | xargs -0 echo) + - name: Run ncc + run: | + action_headers=$(find LEGO1/lego/legoomni/include/actions \ + -name '*.h' -print0 | xargs -0 echo) - python3 tools/ncc/ncc.py \ - --clang-lib ${{ env.LLVM_PATH }}/lib/libclang.so \ - --recurse \ - --style tools/ncc/ncc.style \ - --skip tools/ncc/skip.yml \ - --definition WINAPI FAR BOOL CALLBACK HWND__=HWND \ - --include \ - util \ - LEGO1 \ - LEGO1/omni/include \ - LEGO1/lego/legoomni/include \ - LEGO1/lego/sources \ - --exclude \ - LEGO1/omni/include/flic.h \ - LEGO1/omni/src/video/flic.cpp \ - $action_headers \ - --path LEGO1/omni LEGO1/lego/legoomni + python3 tools/ncc/ncc.py \ + --clang-lib ${{ env.LLVM_PATH }}/lib/libclang.so \ + --recurse \ + --style tools/ncc/ncc.style \ + --skip tools/ncc/skip.yml \ + --definition WINAPI FAR BOOL CALLBACK HWND__=HWND \ + --include \ + util \ + LEGO1 \ + LEGO1/omni/include \ + LEGO1/lego/legoomni/include \ + LEGO1/lego/sources \ + --exclude \ + LEGO1/omni/include/flic.h \ + LEGO1/omni/src/video/flic.cpp \ + $action_headers \ + --path LEGO1/omni LEGO1/lego/legoomni