From 656e364031680fe3c0023197b696e97935559143 Mon Sep 17 00:00:00 2001 From: Mariana Date: Thu, 11 Sep 2025 22:33:31 +0100 Subject: [PATCH 1/3] ci: split jobs and add release workflow --- .github/workflows/ci.yml | 152 +++++++++++++++++++++------------- .github/workflows/release.yml | 133 +++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1caec39..15d7438 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,68 +3,140 @@ name: ci on: push: branches: [main] - tags: ['v*'] pull_request: jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install clang-tidy + run: | + sudo apt-get update + sudo apt-get install -y clang-tidy + - name: Configure + run: cmake --preset linux + - name: clang-tidy + run: run-clang-tidy -p build/linux + + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format + - name: Check formatting + run: | + clang-format --version + clang-format --dry-run --Werror $(git ls-files '*.cpp' '*.hpp' '*.c' '*.h') + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup prerequisites + run: | + sudo apt-get update + sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev + - name: Configure + run: cmake --preset linux -DLIZARD_EMBED_ASSETS=ON + - name: Build (type check) + run: cmake --build build/linux --config Release --target LizardHook + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup prerequisites + run: | + sudo apt-get update + sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev + - name: Configure + run: cmake --preset linux -DLIZARD_EMBED_ASSETS=ON + - name: Build + run: cmake --build build/linux --config Release + - name: Test + run: ctest --test-dir build/linux --output-on-failure + build: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: ${{ matrix.os }}-${{ matrix.arch }} + runs-on: ${{ matrix.runner }} strategy: fail-fast: false matrix: include: - - os: ubuntu-latest + - runner: ubuntu-latest + os: linux + arch: x64 preset: linux artifact: LizardHook-linux-x64.tar.gz ext: tar.gz - - os: macos-latest + configure_args: "" + - runner: ubuntu-latest + os: linux + arch: arm64 + preset: linux + artifact: LizardHook-linux-arm64.tar.gz + ext: tar.gz + configure_args: "-DCMAKE_SYSTEM_PROCESSOR=aarch64" + - runner: macos-latest + os: macos + arch: x64 + preset: macos + artifact: LizardHook-macos-x64.zip + ext: zip + configure_args: "-DCMAKE_OSX_ARCHITECTURES=x86_64" + - runner: macos-latest + os: macos + arch: arm64 preset: macos - artifact: LizardHook-macos.zip + artifact: LizardHook-macos-arm64.zip ext: zip - - os: windows-latest + configure_args: "-DCMAKE_OSX_ARCHITECTURES=arm64" + - runner: windows-latest + os: windows + arch: x64 preset: win-mingw artifact: LizardHook-win-x64.zip ext: zip + configure_args: "" steps: - uses: actions/checkout@v4 - name: Setup prerequisites (Linux) - if: matrix.os == 'ubuntu-latest' + if: matrix.runner == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev - name: Setup prerequisites (macOS) - if: matrix.os == 'macos-latest' + if: matrix.runner == 'macos-latest' run: brew install ninja || true - name: Setup MinGW (Windows) - if: matrix.os == 'windows-latest' + if: matrix.runner == 'windows-latest' uses: msys2/setup-msys2@v2 with: msystem: MINGW64 install: mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja - name: Configure - run: cmake --preset ${{ matrix.preset }} -DLIZARD_EMBED_ASSETS=ON + run: cmake --preset ${{ matrix.preset }} -DLIZARD_EMBED_ASSETS=ON ${{ matrix.configure_args }} shell: bash - name: Build run: cmake --build build/${{ matrix.preset }} --config Release shell: bash - - name: Test - run: ctest --test-dir build/${{ matrix.preset }} --output-on-failure - shell: bash - - name: Install - run: cmake --install build/${{ matrix.preset }} --prefix install/${{ matrix.preset }} + run: cmake --install build/${{ matrix.preset }} --prefix install/${{ matrix.preset }}-${{ matrix.arch }} shell: bash - name: Package run: | - cd install/${{ matrix.preset }} + cd install/${{ matrix.preset }}-${{ matrix.arch }} if [ "${{ matrix.ext }}" = "tar.gz" ]; then tar czf ../../${{ matrix.artifact }} * else @@ -74,12 +146,12 @@ jobs: - name: Verify linkage run: | - if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then - ldd install/${{ matrix.preset }}/LizardHook || true - elif [ "${{ matrix.os }}" = "macos-latest" ]; then - otool -L install/${{ matrix.preset }}/LizardHook || true + if [ "${{ matrix.runner }}" = "ubuntu-latest" ]; then + ldd install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook || true + elif [ "${{ matrix.runner }}" = "macos-latest" ]; then + otool -L install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook || true else - dumpbin /DEPENDENTS install/${{ matrix.preset }}/LizardHook.exe || true + dumpbin /DEPENDENTS install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook.exe || true fi shell: bash @@ -88,39 +160,3 @@ jobs: name: ${{ matrix.artifact }} path: ${{ matrix.artifact }} - release: - needs: build - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Read version - id: ver - run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: LizardHook-* - path: dist - merge-multiple: true - - - name: Generate changelog - run: | - prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") - git log ${prev_tag}..HEAD --pretty=format:'- %s' > changelog.md - - - name: Create release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ steps.ver.outputs.version }} - name: Lizard Hook v${{ steps.ver.outputs.version }} - body_path: changelog.md - files: | - dist/LizardHook-win-x64.zip - dist/LizardHook-macos.zip - dist/LizardHook-linux-x64.tar.gz - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4b66fcd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,133 @@ +name: release + +on: + push: + tags: ['v*'] + +jobs: + build: + name: ${{ matrix.os }}-${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + os: linux + arch: x64 + preset: linux + artifact: LizardHook-linux-x64.tar.gz + ext: tar.gz + configure_args: "" + - runner: ubuntu-latest + os: linux + arch: arm64 + preset: linux + artifact: LizardHook-linux-arm64.tar.gz + ext: tar.gz + configure_args: "-DCMAKE_SYSTEM_PROCESSOR=aarch64" + - runner: macos-latest + os: macos + arch: x64 + preset: macos + artifact: LizardHook-macos-x64.zip + ext: zip + configure_args: "-DCMAKE_OSX_ARCHITECTURES=x86_64" + - runner: macos-latest + os: macos + arch: arm64 + preset: macos + artifact: LizardHook-macos-arm64.zip + ext: zip + configure_args: "-DCMAKE_OSX_ARCHITECTURES=arm64" + - runner: windows-latest + os: windows + arch: x64 + preset: win-mingw + artifact: LizardHook-win-x64.zip + ext: zip + configure_args: "" + steps: + - uses: actions/checkout@v4 + + - name: Setup prerequisites (Linux) + if: matrix.runner == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev + + - name: Setup prerequisites (macOS) + if: matrix.runner == 'macos-latest' + run: brew install ninja || true + + - name: Setup MinGW (Windows) + if: matrix.runner == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + install: mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja + + - name: Configure + run: cmake --preset ${{ matrix.preset }} -DLIZARD_EMBED_ASSETS=ON ${{ matrix.configure_args }} + shell: bash + + - name: Build + run: cmake --build build/${{ matrix.preset }} --config Release + shell: bash + + - name: Install + run: cmake --install build/${{ matrix.preset }} --prefix install/${{ matrix.preset }}-${{ matrix.arch }} + shell: bash + + - name: Package + run: | + cd install/${{ matrix.preset }}-${{ matrix.arch }} + if [ "${{ matrix.ext }}" = "tar.gz" ]; then + tar czf ../../${{ matrix.artifact }} * + else + zip -r ../../${{ matrix.artifact }} * + fi + shell: bash + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.artifact }} + + release: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Read version + id: ver + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: LizardHook-* + path: dist + merge-multiple: true + + - name: Generate changelog + run: | + prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + git log ${prev_tag}..HEAD --pretty=format:'- %s' > changelog.md + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.ver.outputs.version }} + name: Lizard Hook v${{ steps.ver.outputs.version }} + body_path: changelog.md + files: | + dist/LizardHook-win-x64.zip + dist/LizardHook-macos-x64.zip + dist/LizardHook-macos-arm64.zip + dist/LizardHook-linux-x64.tar.gz + dist/LizardHook-linux-arm64.tar.gz + From 7c6c55a115b3ec235c7bbcbe48e58d68b1ba0bad Mon Sep 17 00:00:00 2001 From: Mariana Date: Fri, 12 Sep 2025 12:47:20 +0100 Subject: [PATCH 2/3] ci: install prerequisites for lint job --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15d7438..e14679d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install clang-tidy + - name: Setup prerequisites run: | sudo apt-get update - sudo apt-get install -y clang-tidy + sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev clang-tidy - name: Configure run: cmake --preset linux - name: clang-tidy From 7a53ae24250f7c0ac4ea1073d7f4176e59135802 Mon Sep 17 00:00:00 2001 From: Mariana Date: Fri, 12 Sep 2025 13:58:50 +0100 Subject: [PATCH 3/3] ci: build linux arm64 natively --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/release.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e14679d..b330afb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,13 +74,13 @@ jobs: artifact: LizardHook-linux-x64.tar.gz ext: tar.gz configure_args: "" - - runner: ubuntu-latest + - runner: ubuntu-24.04-arm os: linux arch: arm64 preset: linux artifact: LizardHook-linux-arm64.tar.gz ext: tar.gz - configure_args: "-DCMAKE_SYSTEM_PROCESSOR=aarch64" + configure_args: "" - runner: macos-latest os: macos arch: x64 @@ -106,7 +106,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup prerequisites (Linux) - if: matrix.runner == 'ubuntu-latest' + if: matrix.os == 'linux' run: | sudo apt-get update sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev @@ -146,9 +146,9 @@ jobs: - name: Verify linkage run: | - if [ "${{ matrix.runner }}" = "ubuntu-latest" ]; then + if [ "${{ matrix.os }}" = "linux" ]; then ldd install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook || true - elif [ "${{ matrix.runner }}" = "macos-latest" ]; then + elif [ "${{ matrix.os }}" = "macos" ]; then otool -L install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook || true else dumpbin /DEPENDENTS install/${{ matrix.preset }}-${{ matrix.arch }}/LizardHook.exe || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b66fcd..94c1724 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,13 +19,13 @@ jobs: artifact: LizardHook-linux-x64.tar.gz ext: tar.gz configure_args: "" - - runner: ubuntu-latest + - runner: ubuntu-24.04-arm os: linux arch: arm64 preset: linux artifact: LizardHook-linux-arm64.tar.gz ext: tar.gz - configure_args: "-DCMAKE_SYSTEM_PROCESSOR=aarch64" + configure_args: "" - runner: macos-latest os: macos arch: x64 @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup prerequisites (Linux) - if: matrix.runner == 'ubuntu-latest' + if: matrix.os == 'linux' run: | sudo apt-get update sudo apt-get install -y ninja-build xorg-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libx11-dev libxext-dev libasound2-dev libgtk-3-dev