From 9f50d41dfdbd378fcbaade7acfe0a34a676d0f5e Mon Sep 17 00:00:00 2001 From: CodeWithMaBot <310216433+CodeWithMaBot@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:39:24 +0100 Subject: [PATCH 1/3] Add Linux CI and binary release workflow --- .github/workflows/linux.yml | 62 +++++++++++++++++++++++++++++++++++++ README.md | 41 ++++++++++++++++++++---- 2 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/linux.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..10b7f93 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,62 @@ +name: Linux + +on: + pull_request: + push: + branches: [main] + tags: ['v[0-9]*'] + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + persist-credentials: false + - name: Set up Rust + run: rustup toolchain install stable --profile minimal --component rustfmt + - name: Check formatting + run: cargo +stable fmt --check + - name: Run tests + run: cargo +stable test --locked + + release: + if: github.ref_type == 'tag' + needs: check + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + persist-credentials: false + - name: Build and test the release binary + env: + RELEASE_TAG: ${{ github.ref_name }} + run: | + rustup toolchain install stable --profile minimal + cargo +stable build --release --locked + binary="$PWD/target/release/nload-rs" + if [[ "$("$binary" --version)" != "nload-rs ${RELEASE_TAG#v}" ]]; then + echo "Release tag must match the binary version (v followed by the Cargo version)." >&2 + exit 1 + fi + NLOAD_RS_PTY_BINARY="$binary" cargo +stable test --release --locked --test linux_pty + - name: Package the binary + run: | + staging="$(mktemp -d)" + install -m 755 target/release/nload-rs "$staging/" + install -m 644 LICENSE THIRD-PARTY-NOTICES.md "$staging/" + tar -czf nload-rs-linux-x86_64.tar.gz -C "$staging" nload-rs LICENSE THIRD-PARTY-NOTICES.md + sha256sum nload-rs-linux-x86_64.tar.gz > nload-rs-linux-x86_64.tar.gz.sha256 + - name: Publish GitHub release + env: + GH_TOKEN: ${{ github.token }} + RELEASE_TAG: ${{ github.ref_name }} + run: | + gh release create "$RELEASE_TAG" \ + nload-rs-linux-x86_64.tar.gz nload-rs-linux-x86_64.tar.gz.sha256 \ + --verify-tag --generate-notes diff --git a/README.md b/README.md index bbc4549..1e5e586 100644 --- a/README.md +++ b/README.md @@ -7,22 +7,38 @@ and per-interface statistics. *The loopback interface (`lo`) under local test traffic, with `--color` enabled.* -## Quick start +## Install -From this checkout, with stable Rust that supports edition 2024: +Download `nload-rs-linux-x86_64.tar.gz` and its `.sha256` file from +[GitHub Releases](https://github.com/CodeWithMa/nload-rs/releases). The binary +is built on `x86_64` Ubuntu 22.04 and requires glibc, not Rust. If no release +is available yet, [build from source](#build-from-source). ```sh -cargo run --release --locked -- +sha256sum -c nload-rs-linux-x86_64.tar.gz.sha256 && + tar -xzf nload-rs-linux-x86_64.tar.gz ``` +Once the archive is verified and extracted: + +```sh +./nload-rs --color +``` + +To run it from anywhere, put `nload-rs` in a directory on your `PATH`. + +## Quick start + Press the arrow keys to switch interfaces and `q` to quit. The graphs use your terminal’s foreground color by default. To enable color and start on a specific interface: ```sh -cargo run --release --locked -- --color lo +nload-rs --color lo ``` +Use `./nload-rs` instead if you just extracted the binary. + Replace `lo` with the interface you want to watch. If it isn’t present at startup, nload-rs starts on the first available interface and switches to the requested one when it first appears. New interfaces become available as they @@ -30,13 +46,22 @@ appear; disconnected interfaces stay in the list and are marked unavailable. Use `-i VALUE` and `-o VALUE` to set the incoming and outgoing graph ceilings. Both default to 10,240 kBit/s (10 MBit/s in binary units). Run -`cargo run --release --locked -- --help` for all options. +`nload-rs --help` for all options. Use a terminal at least 60×16 with UTF-8 and a font that renders Braille. `TERM` must be nonempty and neither `dumb` nor `linux`. `--color` requires 256-color support and takes precedence over `NO_COLOR`. -## Install on Arch Linux +## Build from source + +From this checkout, with stable Rust that supports edition 2024: + +```sh +cargo install --path . --locked +nload-rs --color +``` + +### Arch Linux package Build the `x86_64` package from this checkout using the [PKGBUILD](packaging/arch/PKGBUILD): @@ -61,6 +86,10 @@ cargo test --locked The tests require access to `/proc` and the ability to allocate a pseudoterminal (PTY). +To cut a release, push a `v` tag matching the version in `Cargo.toml` (for +example, `v0.1.4` for version `0.1.4`). The Linux workflow runs the tests, +checks the release binary, and publishes the archive and checksum. + ## Credits and license Inspired by [nload](https://github.com/rolandriegel/nload) by Roland Riegel, From cc9006c1b2f2f0f6fd0afbbddd3c2b37f10a4475 Mon Sep 17 00:00:00 2001 From: CodeWithMaBot <310216433+CodeWithMaBot@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:42:50 +0100 Subject: [PATCH 2/3] Simplify Linux release packaging and docs --- .github/workflows/linux.yml | 5 +++-- README.md | 11 +---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 10b7f93..59c0901 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -47,11 +47,12 @@ jobs: NLOAD_RS_PTY_BINARY="$binary" cargo +stable test --release --locked --test linux_pty - name: Package the binary run: | + archive=nload-rs-linux-x86_64.tar.gz staging="$(mktemp -d)" install -m 755 target/release/nload-rs "$staging/" install -m 644 LICENSE THIRD-PARTY-NOTICES.md "$staging/" - tar -czf nload-rs-linux-x86_64.tar.gz -C "$staging" nload-rs LICENSE THIRD-PARTY-NOTICES.md - sha256sum nload-rs-linux-x86_64.tar.gz > nload-rs-linux-x86_64.tar.gz.sha256 + tar -czf "$archive" -C "$staging" nload-rs LICENSE THIRD-PARTY-NOTICES.md + sha256sum "$archive" > "$archive.sha256" - name: Publish GitHub release env: GH_TOKEN: ${{ github.token }} diff --git a/README.md b/README.md index 1e5e586..cab28ae 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,7 @@ sha256sum -c nload-rs-linux-x86_64.tar.gz.sha256 && tar -xzf nload-rs-linux-x86_64.tar.gz ``` -Once the archive is verified and extracted: - -```sh -./nload-rs --color -``` - -To run it from anywhere, put `nload-rs` in a directory on your `PATH`. +Run `./nload-rs` from the extraction directory, or move it onto your `PATH`. ## Quick start @@ -37,8 +31,6 @@ interface: nload-rs --color lo ``` -Use `./nload-rs` instead if you just extracted the binary. - Replace `lo` with the interface you want to watch. If it isn’t present at startup, nload-rs starts on the first available interface and switches to the requested one when it first appears. New interfaces become available as they @@ -58,7 +50,6 @@ From this checkout, with stable Rust that supports edition 2024: ```sh cargo install --path . --locked -nload-rs --color ``` ### Arch Linux package From f0fc4fc19d9fccc5a0456663d3b5342e436de90c Mon Sep 17 00:00:00 2001 From: CodeWithMaBot <310216433+CodeWithMaBot@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:55:06 +0100 Subject: [PATCH 3/3] Bundle corresponding source with Linux releases --- .github/workflows/linux.yml | 17 +++++++++++++++++ README.md | 22 +++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 59c0901..eed19c2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -53,6 +53,22 @@ jobs: install -m 644 LICENSE THIRD-PARTY-NOTICES.md "$staging/" tar -czf "$archive" -C "$staging" nload-rs LICENSE THIRD-PARTY-NOTICES.md sha256sum "$archive" > "$archive.sha256" + - name: Package and verify corresponding source + run: | + archive=nload-rs-source.tar.gz + staging="$(mktemp -d)" + git archive --prefix=nload-rs-source/ HEAD | tar -xf - -C "$staging" + ( + cd "$staging/nload-rs-source" + mkdir -p .cargo + cargo +stable vendor --locked > .cargo/config.toml + ) + tar -czf "$archive" -C "$staging" nload-rs-source + + verification="$(mktemp -d)" + tar -xzf "$archive" -C "$verification" + cd "$verification/nload-rs-source" + CARGO_HOME="$verification/cargo-home" cargo +stable build --release --locked --offline - name: Publish GitHub release env: GH_TOKEN: ${{ github.token }} @@ -60,4 +76,5 @@ jobs: run: | gh release create "$RELEASE_TAG" \ nload-rs-linux-x86_64.tar.gz nload-rs-linux-x86_64.tar.gz.sha256 \ + nload-rs-source.tar.gz \ --verify-tag --generate-notes diff --git a/README.md b/README.md index cab28ae..2c094d8 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ and per-interface statistics. ## Install Download `nload-rs-linux-x86_64.tar.gz` and its `.sha256` file from -[GitHub Releases](https://github.com/CodeWithMa/nload-rs/releases). The binary -is built on `x86_64` Ubuntu 22.04 and requires glibc, not Rust. If no release -is available yet, [build from source](#build-from-source). +[GitHub Releases](https://github.com/CodeWithMa/nload-rs/releases). ```sh sha256sum -c nload-rs-linux-x86_64.tar.gz.sha256 && @@ -24,8 +22,14 @@ Run `./nload-rs` from the extraction directory, or move it onto your `PATH`. ## Quick start Press the arrow keys to switch interfaces and `q` to quit. The graphs use your -terminal’s foreground color by default. To enable color and start on a specific -interface: +terminal’s foreground color by default. To enable color and start on `lo`, run +this from the extraction directory: + +```sh +./nload-rs --color lo +``` + +If `nload-rs` is on your `PATH`, run: ```sh nload-rs --color lo @@ -46,7 +50,10 @@ Use a terminal at least 60×16 with UTF-8 and a font that renders Braille. ## Build from source -From this checkout, with stable Rust that supports edition 2024: +Use this checkout or extract `nload-rs-source.tar.gz` from +[GitHub Releases](https://github.com/CodeWithMa/nload-rs/releases). The release +archive includes the locked dependencies and can be built offline. From the +source directory, with stable Rust that supports edition 2024: ```sh cargo install --path . --locked @@ -79,7 +86,8 @@ pseudoterminal (PTY). To cut a release, push a `v` tag matching the version in `Cargo.toml` (for example, `v0.1.4` for version `0.1.4`). The Linux workflow runs the tests, -checks the release binary, and publishes the archive and checksum. +checks the release binary, and publishes the binary archive, its checksum, and +the corresponding source archive. ## Credits and license