From 637b940f0ada7ffb268f56300c60ca94a595f52f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:18:29 +0000 Subject: [PATCH 1/3] This commit updates the GitHub Actions workflow to use `v4` of `actions/upload-artifact` and `actions/download-artifact`, as `v3` is deprecated. It also updates `actions/checkout` to `v4` and fixes the deprecated `set-output` command. --- .github/workflows/build.yml | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..411eb22 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,123 @@ +name: Build and Release + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Build cpu_monitor + run: | + cd cpu_monitor + cargo build --release + + - name: Set up Qt for Linux + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y qt5-default + + - name: Set up Qt for macOS + if: matrix.os == 'macos-latest' + run: | + brew install qt5 + echo "/usr/local/opt/qt/bin" >> $GITHUB_PATH + + - name: Set up Qt for Windows + if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-qt5 + + - name: Build rtop on Linux/macOS + if: matrix.os != 'windows-latest' + run: | + cd Qt5 + qmake + make + shell: bash + + - name: Build rtop on Windows + if: matrix.os == 'windows-latest' + run: | + cd Qt5 + qmake + mingw32-make + shell: msys2 {0} + + - name: Package binaries + run: | + mkdir -p release + if [ "${{ matrix.os }}" == "windows-latest" ]; then + cp Qt5/release/rtop.exe release/ + cp cpu_monitor/target/release/cpu_monitor.exe release/ + 7z a -tzip rtop-${{ matrix.os }}.zip ./release/* + else + cp Qt5/rtop release/ + cp cpu_monitor/target/release/cpu_monitor release/ + tar -czvf rtop-${{ matrix.os }}.tar.gz ./release/* + fi + shell: bash + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: rtop-${{ matrix.os }} + path: rtop-${{ matrix.os }}.* + + release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Get tag name + id: get_tag + run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_tag.outputs.TAG }} + release_name: Release ${{ steps.get_tag.outputs.TAG }} + draft: false + prerelease: false + + - name: Upload Release Assets + run: | + for dir in artifacts/*; do + if [ -d "$dir" ]; then + asset_path=$(find "$dir" -name "rtop-*.tar.gz" -o -name "rtop-*.zip") + asset_name=$(basename "$asset_path" | sed 's/-[a-z]*-latest//') + gh release upload ${{ steps.get_tag.outputs.TAG }} "$asset_path" --clobber + fi + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ github.token }} From a2d57ed5e1ec02853e1805e9517b28ebaf84f13c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:24:01 +0000 Subject: [PATCH 2/3] This commit fixes the GitHub Actions workflow by replacing the deprecated `qt5-default` package with `qtbase5-dev`, `qt5-qmake`, `qtchooser`, and `qtbase5-dev-tools` for the Linux build environment. This is necessary as `qt5-default` is no longer available in recent Ubuntu versions. --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e915073..7fdee8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Rust uses: actions-rs/toolchain@v1 with: @@ -31,7 +30,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y qt5-default + sudo apt-get install -y qtbase5-dev qt5-qmake qtchooser qtbase5-dev-tools - name: Set up Qt for macOS if: matrix.os == 'macos-latest' From 97e4ed428477b22f67e71e40f379ec1fe5f89098 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 10:27:38 +0000 Subject: [PATCH 3/3] This commit fixes the macOS build by correctly adding the Qt binaries to the PATH. It also sets `fail-fast: false` in the build matrix strategy to ensure all platform builds run, even if one fails. --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7fdee8e..df6292f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] @@ -36,7 +37,7 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install qt5 - echo "/usr/local/opt/qt/bin" >> $GITHUB_PATH + echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH - name: Set up Qt for Windows if: matrix.os == 'windows-latest'