Skip to content

build: use tree-widget v0.15 #677

build: use tree-widget v0.15

build: use tree-widget v0.15 #677

Workflow file for this run

name: Test and Build Rust
on:
push:
pull_request:
env:
RUSTFLAGS: --deny warnings
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- uses: actions/checkout@v4
- run: cargo fmt --check --verbose
test:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} ${{ matrix.features }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
strategy:
fail-fast: false
matrix:
toolchain:
- stable
os:
- ubuntu-latest
- macos-latest
- windows-latest
clippyargs:
- -D clippy::pedantic
features:
- "" # default features
include:
# Check future versions and maybe get some glances on soon to be lints
- toolchain: beta
os: ubuntu-latest
features: --all-features
clippyargs: -D clippy::pedantic -D clippy::nursery -D clippy::cargo
- toolchain: nightly
os: ubuntu-latest
features: --all-features
clippyargs: -D clippy::pedantic
# Check the minimum supported Rust version (MSRV).
# Sometimes old rust versions don't yet have the lints (allow unknown) or don't have fixes in lints (false positives -> don't error, just warn).
# When a certain distro is a target look up its version: https://repology.org/project/rust/versions
- os: ubuntu-latest
toolchain: 1.70.0
clippyargs: -A unknown-lints
features: --all-features
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch --verbose --locked
- name: Check clippy
run: cargo clippy --verbose --locked --all-targets ${{ matrix.features }} -- ${{ matrix.clippyargs }}
- name: Check docs
run: cargo doc --verbose --locked --no-deps ${{ matrix.features }}
- name: Build
run: cargo build --verbose --locked --all-targets ${{ matrix.features }}
- name: Run tests
run: cargo test --verbose --locked ${{ matrix.features }}
github-release:
name: Release ${{ matrix.triple }}
runs-on: ${{ matrix.os }}
needs: test
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- triple: x86_64-unknown-linux-gnu
os: ubuntu-latest
rpm: true
- triple: aarch64-unknown-linux-gnu
os: ubuntu-latest
rpm: true
- triple: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
rpm: true
- triple: arm-unknown-linux-gnueabihf
os: ubuntu-latest
- triple: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
- triple: x86_64-apple-darwin
os: macos-latest
- triple: aarch64-apple-darwin
os: macos-latest
- triple: x86_64-pc-windows-msvc
os: windows-latest
- triple: aarch64-pc-windows-msvc
os: windows-latest
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.triple }}
- name: Install cargo tools
if: runner.os == 'Linux'
uses: taiki-e/install-action@v2
with:
tool: cross,cargo-deb,cargo-generate-rpm
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set artifact name
shell: bash
run: |
version="$(git describe --tags --match "v*.*.*" --always)"
echo "version: $version"
echo "GIT_TAG_VERSION=$version" >> $GITHUB_ENV
name="mqttui-$version-${{ matrix.triple }}"
echo "artifact: $name"
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
- name: Fetch dependencies
run: cargo fetch --verbose --locked
- name: Build
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --verbose --locked --target ${{ matrix.triple }}
- name: Package tar.gz (*nix)
if: runner.os != 'Windows'
run: >
tar -cv
CHANGELOG.md LICENSE README.md
-C target/ completions/ -C ../
-C target/${{ matrix.triple }}/release/ mqttui
| gzip --best > ${{ env.ARTIFACT_NAME }}.tar.gz
- name: Package zip (Windows)
if: runner.os == 'Windows'
run: >
7z a ${{ env.ARTIFACT_NAME }}.zip
CHANGELOG.md LICENSE README.md
./target/completions/
./target/${{ matrix.triple }}/release/mqttui.exe
- name: Package deb
if: runner.os == 'Linux'
run: cargo deb --verbose --no-build --no-strip --target ${{ matrix.triple }} --output ${{ env.ARTIFACT_NAME }}.deb
- name: Package rpm
if: matrix.rpm
run: cargo generate-rpm --auto-req disabled --target ${{ matrix.triple }} --output ${{ env.ARTIFACT_NAME }}.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.triple }}
path: |
*.deb
*.rpm
*.tar.gz
*.zip
- name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: |
*.deb
*.rpm
*.tar.gz
*.zip
aur-publish:
name: AUR ${{ matrix.name }}
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: github-release
strategy:
fail-fast: false
matrix:
name:
- mqttui
- mqttui-bin
steps:
- uses: ATiltedTree/create-aur-release@v1
with:
package_name: ${{ matrix.name }}
commit_username: GitHub Actions
commit_email: mqttui-github-actions@edjopato.de
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
# TODO: more releases. Inspiration:
# https://github.com/starship/starship/blob/master/.github/workflows/deploy.yml