From 2d127f198ec7ee0032f4435898c1268dcd09b735 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Sat, 21 Nov 2020 15:31:19 -0500 Subject: ci: uptick to 0.5.1, fix ci --- .cargo/config.toml | 3 + .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 95 ++++++----- .github/workflows/deploy.yml | 47 ------ .github/workflows/deployment.yml | 323 ++++++++++++++++++++++++++++++++++++++ .github/workflows/post-deploy.yml | 68 ++++++++ .travis.yml | 214 ------------------------- .vscode/settings.json | 2 + CHANGELOG.md | 10 +- Cargo.lock | 42 ++--- Cargo.toml | 10 +- README.md | 20 ++- rustfmt.toml | 1 - src/app/data_harvester/disks.rs | 7 +- src/constants.rs | 6 +- tests/layout_management_tests.rs | 2 +- tests/layout_movement_tests.rs | 2 +- 17 files changed, 500 insertions(+), 354 deletions(-) delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/post-deploy.yml delete mode 100644 .travis.yml diff --git a/.cargo/config.toml b/.cargo/config.toml index 6350f283..e31c6201 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,6 +4,9 @@ rustflags = ["-C", "target-feature=+crt-static"] [target.i686-pc-windows-msvc] rustflags = ["-C", "target-feature=+crt-static"] +[target.arm-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" + [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 46d314a4..c9b2e57a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -37,7 +37,7 @@ _If relevant, ensure the following have been met:_ - [ ] _Change has been tested to work, and does not cause new breakage unless intended_ - [ ] _Code has been self-reviewed_ - [ ] _Documentation has been added/updated if needed (README, help menu, etc.)_ -- [ ] _Passes Travis tests (clippy check and `cargo test` check)_ +- [ ] _Passes CI pipeline (clippy check and `cargo test` check)_ - [ ] _Areas your change affects have been linted using rustfmt (`cargo fmt`)_ - [ ] _No merge conflicts arise from the change_ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e61d49ea..9a8dc26a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,13 @@ # - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml name: ci + on: workflow_dispatch: pull_request: push: branches: - master - schedule: - - cron: "0 5 * * *" jobs: # Check rustfmt @@ -19,9 +18,9 @@ jobs: strategy: matrix: os: - - ubuntu-latest + - ubuntu-18.04 - macOS-latest - - windows-latest + - windows-2019 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -38,16 +37,17 @@ jobs: strategy: matrix: os: - - ubuntu-latest + - ubuntu-18.04 - macOS-latest - - windows-latest + - windows-2019 steps: - uses: actions/checkout@v2 - - name: Cache cargo build target - uses: actions/cache@v1 - with: - path: target - key: clippy-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }} + + # - name: Cache Cargo + # uses: actions/cache@v1 + # with: + # path: target + # key: clippy-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }} - uses: actions-rs/toolchain@v1 with: @@ -55,10 +55,11 @@ jobs: toolchain: stable override: true components: clippy + - run: cargo clippy --all-targets --workspace -- -D warnings - # Compile test. - compile: + # Compile/check test. + check: name: ${{ matrix.toolchain }} / ${{ matrix.triple.target }} needs: [rustfmt, clippy] runs-on: ${{ matrix.triple.os }} @@ -68,25 +69,25 @@ jobs: triple: # Standard x86-64 stuff, stable - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "x86_64-unknown-linux-gnu", cross: false, rust: stable, } - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "i686-unknown-linux-gnu", cross: true, rust: stable, } - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "x86_64-unknown-linux-musl", cross: false, rust: stable, } - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "i686-unknown-linux-musl", cross: true, rust: stable, @@ -98,14 +99,25 @@ jobs: rust: stable, } - { - os: "windows-latest", + os: "windows-2019", + target: "i686-pc-windows-msvc", + cross: true, + rust: stable, + } + - { + os: "windows-2019", target: "x86_64-pc-windows-msvc", cross: false, rust: stable, } - - { os: "windows-latest", target: "i686-pc-windows-gnu", cross: true } - { - os: "windows-latest", + os: "windows-2019", + target: "i686-pc-windows-gnu", + cross: true, + rust: stable, + } + - { + os: "windows-2019", target: "x86_64-pc-windows-gnu", cross: false, rust: stable, @@ -113,35 +125,23 @@ jobs: # aarch64 - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "aarch64-unknown-linux-gnu", cross: true, rust: stable, } - - { - os: "ubuntu-latest", - target: "aarch64-unknown-linux-musl", - cross: true, - rust: stable, - } # armv7 - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "armv7-unknown-linux-gnueabihf", cross: true, rust: stable, } - - { - os: "ubuntu-latest", - target: "armv7-unknown-linux-musleabihf", - cross: true, - rust: stable, - } # PowerPC 64 LE - { - os: "ubuntu-latest", + os: "ubuntu-18.04", target: "powerpc64le-unknown-linux-gnu", cross: true, rust: stable, @@ -154,18 +154,19 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.toolchain }} + toolchain: ${{ matrix.triple.rust }} override: true + target: ${{ matrix.triple.target }} - name: Check uses: actions-rs/cargo@v1 with: command: check - args: --all-targets --verbose + args: --all-targets --verbose --target=${{ matrix.triple.target }} use-cross: ${{ matrix.triple.cross }} tests: - needs: [compile] + needs: [check] name: Test ${{ matrix.os }} runs-on: ${{ matrix.os }} continue-on-error: true @@ -173,18 +174,16 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + - ubuntu-18.04 - macOS-latest - - windows-latest - toolchain: - - stable + - windows-2019 steps: - uses: actions/checkout@v2 - name: Install toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.toolchain }} + toolchain: stable override: true - name: Run tests @@ -192,3 +191,13 @@ jobs: env: CARGO_HUSKY_DONT_INSTALL_HOOKS: true RUST_BACKTRACE: full + + complete: + needs: [tests] + name: CI Pipeline Complete + runs-on: ubuntu-latest + steps: + - name: Echo completion + shell: bash + run: | + echo "Complete!" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 206d0f19..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Update Packages - -on: - release: - types: [published] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Test env - run: | - echo $RELEASE_VERSION - - name: Make sure you're not on master... - run: | - if [[ $RELEASE_VERSION == "master" ]]; then - exit 1 - fi - - name: Download packages - run: | - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-unknown-linux-gnu.tar.gz"; - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-apple-darwin.tar.gz"; - - name: Execute packaging script - run: | - python "./deployment/packager.py" $RELEASE_VERSION "./deployment/macos/homebrew/bottom.rb.template" "./bottom.rb" "SHA256" "./bottom_x86_64-apple-darwin.tar.gz" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; - - name: Upload bottom.rb to release - uses: svenstaro/upload-release-action@2.1.0 - with: - repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} - file: bottom.rb - tag: ${{ env.RELEASE_VERSION }} - overwrite: true - - name: Trigger homebrew - run: | - curl -X POST https://api.github.com/repos/ClementTsang/homebrew-bottom/dispatches \ - -H 'Accept: application/vnd.github.everest-preview+json' \ - -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \ - --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }' - - name: Trigger choco - run: | - curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \ - -H 'Accept: application/vnd.github.everest-preview+json' \ - -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \ - --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }' diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index e69de29b..62d539ba 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -0,0 +1,323 @@ +# Based on: +# - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml + +name: deployment + +on: + workflow_dispatch: + create: + tags: + - /^\d+\.\d+(\.\d+)?(-\S*)?$/ + +jobs: + create-github-release: + name: create-github-release + runs-on: ubuntu-latest + steps: + - name: Create artifacts directory + run: mkdir artifacts + + - name: Get the release version from the tag + if: env.VERSION == '' + run: | + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + echo "version is: ${{ env.VERSION }}" + - name: Create GitHub release + id: release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + draft: true + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} Release + + - name: Save release upload URL to artifact + run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url + + - name: Save version number to artifact + run: echo "${{ env.VERSION }}" > artifacts/release-version + + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: artifacts + path: artifacts + + build-release: + name: build-release + needs: [create-github-release] + runs-on: ${{ matrix.triple.os }} + env: + RUST_BACKTRACE: 1 + strategy: + fail-fast: false + matrix: + triple: + # Standard x86-64 stuff, stable + - { + os: "ubuntu-18.04", + target: "x86_64-unknown-linux-gnu", + cross: false, + } + - { + os: "ubuntu-18.04", + target: "i686-unknown-linux-gnu", + cross: true, + } + - { + os: "ubuntu-18.04", + target: "x86_64-unknown-linux-musl", + cross: false, + } + - { + os: "ubuntu-18.04", + target: "i686-unknown-linux-musl", + cross: true, + } + - { + os: "macOS-latest", + target: "x86_64-apple-darwin", + cross: false, + } + - { + os: "windows-2019", + target: "x86_64-pc-windows-msvc", + cross: false, + } + - { + os: "windows-2019", + target: "i686-pc-windows-gnu", + cross: true, + } + - { + os: "windows-2019", + target: "x86_64-pc-windows-gnu", + cross: false, + } + + # aarch64 + - { + os: "ubuntu-18.04", + target: "aarch64-unknown-linux-gnu", + cross: true, + } + + # armv7 + - { + os: "ubuntu-18.04", + target: "armv7-unknown-linux-gnueabihf", + cross: true, + } + + # PowerPC 64 LE + - { + os: "ubuntu-18.04", + target: "powerpc64le-unknown-linux-gnu", + cross: true, + } + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - uses: actions/setup-python@v2 + + - name: Get release download URL + uses: actions/download-artifact@v1 + with: + name: artifacts + path: artifacts + + - name: Set release upload URL and release version + shell: bash + run: | + release_upload_url="$(cat artifacts/release-upload-url)" + echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV + echo "release upload url: $RELEASE_UPLOAD_URL" + release_version="$(cat artifacts/release-version)" + echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV + echo "release version: $RELEASE_VERSION" + + - name: Install Net-Framework-Core (Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + shell: powershell + run: Install-WindowsFeature Net-Framework-Core + + - name: Install wixtoolset (Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + uses: crazy-max/ghaction-chocolatey@v1.4.0 + with: + args: install -y wixtoolset + + # - name: Export wixtoolset to path (Windows x86-64 MSVC) + # if: matrix.triple.target == 'x86_64-pc-windows-msvc' + # shell: powershell + # run: export PATH=${PATH}:"/c/Program Files (x86)/WiX Toolset v3.11/bin"; + + - name: Install zip (Windows) + if: matrix.triple.os == 'windows-2019' + uses: crazy-max/ghaction-chocolatey@v1.4.0 + with: + args: install -y zip + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + target: ${{ matrix.triple.target }} + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --verbose --target=${{ matrix.triple.target }} + use-cross: ${{ matrix.triple.cross }} + + - name: Bundle autocomplete + shell: bash + run: | + echo $PWD + ls + echo "completion_dir=$(ls ./target/release/build/bottom-*/out/btm.bash | head -n1 | xargs dirname)" >> $GITHUB_ENV + cp -r $completion_dir completion + + - name: Strip release binary (x86-64 or i686) + if: matrix.triple.target != 'aarch64-unknown-linux-gnu' && matrix.triple.target != 'armv7-unknown-linux-gnueabihf' && matrix.triple.target != 'powerpc64le-unknown-linux-gnu' + run: | + strip target/release/btm + + # - name: Strip release binary (aarch64) + # if: matrix.triple.target == 'aarch64-unknown-linux-gnu' + # run: | + # docker run --rm -v \ + # "$PWD/target:/target:Z" \ + # rustembedded/cross:aarch64-unknown-linux-gnu \ + # aarch64-linux-gnu-strip \ + # /target/aarch64-unknown-linux-gnu/release/btm + + # - name: Strip release binary (armv7) + # if: matrix.triple.target == 'armv7-unknown-linux-gnueabihf' + # run: | + # docker run --rm -v \ + # "$PWD/target:/target:Z" \ + # rustembedded/cross:armv7-unknown-linux-gnueabihf \ + # arm-linux-gnueabihf-strip \ + # /target/armv7-unknown-linux-gnueabihf/release/btm + + # - name: Strip release binary (ppc) + # if: matrix.triple.target == 'powerpc64le-unknown-linux-gnu' + # run: | + # docker run --rm -v \ + # "$PWD/target:/target:Z" \ + # rustembedded/cross:powerpc64le-unknown-linux-gnu \ + # powerpc64le-linux-gnu-strip \ + # /target/powerpc64le-unknown-linux-gnu/release/btm + + - name: Bundle release and completion (Windows) + shell: bash + run: | + cp target/release/btm btm.exe; + zip -r bottom_${{ matrix.triple.target }}.zip "btm.exe", "completion" + echo "ASSET=bottom_${{ matrix.triple.target }}.zip" >> $GITHUB_ENV + + - name: Bundle release and completion (Linux and macOS) + shell: bash + run: | + cp target/release/btm ./btm; + tar -czvf bottom_${{ matrix.triple.target }}.tar.gz btm completion; + echo "ASSET=bottom_${{ matrix.triple.target }}.tar.gz" >> $GITHUB_ENV + + - name: Upload main release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: ${{ env.ASSET }} + asset_name: ${{ env.ASSET }} + asset_content_type: application/octet-stream + + - name: Build msi file (only Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + shell: powershell + run: | + cargo install cargo-wix; + cargo wix init; + cargo wix; + + - name: Upload msi file (only Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: bottom_x86_64_installer.msi + asset_name: bottom_x86_64_installer.msi + asset_content_type: application/octet-stream + + - name: Build winget (only Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + run: | + python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/windows/winget/winget.yaml.template" "${{ env.RELEASE_VERSION }}.yaml" "SHA256" "./bottom_x86_64_installer.msi"; + + - name: Upload winget file (only Windows x86-64 MSVC) + if: matrix.triple.target == 'x86_64-pc-windows-msvc' + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: ${{ env.RELEASE_VERSION }}.yaml + asset_name: ${{ env.RELEASE_VERSION }}.yaml + asset_content_type: application/octet-stream + + - name: Build Debian release (only Linux x86-64 GNU) + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + run: | + cargo install cargo-deb; + cargo deb; + cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb + + - name: Upload Debian file (only Linux x86-64 GNU) + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: bottom_${{ env.RELEASE_VERSION }}_amd64.deb + asset_name: bottom_${{ env.RELEASE_VERSION }}_amd64.deb + asset_content_type: application/octet-stream + + - name: Build AUR PKGBUILD (only Linux x86-64 GNU) + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + run: | + curl -LO "https://github.com/ClementTsang/bottom/archive/${{ env.RELEASE_VERSION }}.tar.gz"; + python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/linux/arch/PKGBUILD.template" "./PKGBUILD" "SHA512" "./${{ env.target }}.tar.gz"; + + - name: Build AUR binary PKGBUILD (only Linux x86-64 GNU) + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + run: | + python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/linux/arch/PKGBUILD_BIN.template" "./PKGBUILD_BIN" "SHA512" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; + + - name: Tar AUR PKGBUILDs + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + run: | + tar -czvf arch.tar.gz PKGBUILD_BIN PKGBUILD; + + - name: Upload AUR PKGBUILDs (only Linux x86-64 GNU) + if: matrix.triple.target == 'x86_64-unknown-linux-gnu' + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: arch.tar.gz + asset_name: arch.tar.gz + asset_content_type: application/octet-stream diff --git a/.github/workflows/post-deploy.yml b/.github/workflows/post-deploy.yml new file mode 100644 index 00000000..8147d0b0 --- /dev/null +++ b/.github/workflows/post-deploy.yml @@ -0,0 +1,68 @@ +name: Update Packages + +on: + release: + types: [published] + +jobs: + post-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Test env + run: | + echo $RELEASE_VERSION + + - name: Make sure you're not on master... + run: | + if [[ $RELEASE_VERSION == "master" ]]; then + exit 1 + fi + + - name: Download packages + run: | + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-unknown-linux-gnu.tar.gz"; + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-apple-darwin.tar.gz"; + + - name: Execute choco packaging script + run: | + python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"; + zip -r choco.zip "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/"; + + - name: Upload choco.zip to release + uses: svenstaro/upload-release-action@2.1.0 + with: + repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} + file: choco.zip + tag: ${{ env.RELEASE_VERSION }} + overwrite: true + + - name: Execute Homebrew packaging script + run: | + python "./deployment/packager.py" $RELEASE_VERSION "./deployment/macos/homebrew/bottom.rb.template" "./bottom.rb" "SHA256" "./bottom_x86_64-apple-darwin.tar.gz" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; + + - name: Upload bottom.rb to release + uses: svenstaro/upload-release-action@2.1.0 + with: + repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} + file: bottom.rb + tag: ${{ env.RELEASE_VERSION }} + overwrite: true + + - name: Trigger homebrew + run: | + curl -X POST https://api.github.com/repos/ClementTsang/homebrew-bottom/dispatches \ + -H 'Accept: application/vnd.github.everest-preview+json' \ + -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \ + --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }' + + - name: Trigger choco + run: | + curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \ + -H 'Accept: application/vnd.github.everest-preview+json' \ + -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \ + --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 01730227..00000000 --- a/.travis.yml +++ /dev/null @@ -1,214 +0,0 @@ -language: rust -notifications: - email: - on_success: never - -matrix: - include: - # Standard x86-64 stuff, stable and beta, on tier-1 environments - - os: linux - env: TARGET=x86_64-unknown-linux-gnu - arch: amd64 - rust: stable - - os: linux - env: TARGET=x86_64-unknown-linux-gnu - arch: amd64 - rust: beta - - os: osx - env: TARGET=x86_64-apple-darwin - arch: amd64 - rust: stable - - os: osx - env: TARGET=x86_64-apple-darwin - arch: amd64 - rust: beta - - os: windows - env: TARGET=x86_64-pc-windows-msvc - arch: amd64 - rust: stable - - os: windows - env: TARGET=x86_64-pc-windows-msvc - arch: amd64 - rust: beta - - # musl - - os: linux - env: TARGET=x86_64-unknown-linux-musl - arch: amd64 - rust: stable - - # Windows GNU - - os: windows - env: TARGET=x86_64-pc-windows-gnu - arch: amd64 - rust: stable - - # PowerPC 64 LE - - os: linux - env: TARGET=powerpc64le-unknown-linux-gnu - arch: ppc64le - rust: stable - - # ARM stuff (skip beta for now, see https://github.com/rust-lang/rust/issues/62896) - - os: linux - env: TARGET=aarch64-unknown-linux-gnu - arch: arm64 - rust: stable - - os: linux - env: TARGET=armv7-unknown-linux-gnueabihf - arch: amd64 - rust: stable - addons: - apt: - packages: &armhf - - gcc-arm-linux-gnueabihf - - libc6-armhf-cross - - libc6-dev-armhf-cross - - fast_finish: true - exclude: - - if: tag IS present - rust: beta - -branches: - only: - - master - - /^\d+\.\d+(\.\d+)?(-\S*)?$/ - -cache: cargo - -before_install: - - export RUST_BACKTRACE=1 - - | - if [[ $TRAVIS_OS_NAME == "windows" && -n $TRAVIS_TAG ]]; then - echo "Pre-installing deploy dependencies for Windows..."; - powershell Install-WindowsFeature Net-Framework-Core; - choco install -y wixtoolset; - export PATH=$PATH:"/c/Program Files (x86)/WiX Toolset v3.11/bin"; - choco install zip; - rustup target add i686-pc-windows-msvc; - fi - -before_script: - - rustup target add $TARGET - - rustup update - - | - # Only check clippy if stable... - if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then - rustup component add clippy - fi - -script: - - | - # Only check clippy if stable... - if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then - cargo clippy -- -D clippy::all - fi - - | - if [[ $TARGET == "armv7-unknown-linux-gnueabihf" ]]; then - cargo build --verbose --target $TARGET - else - CARGO_HUSKY_DONT_INSTALL_HOOKS=true cargo test --verbose --target $TARGET - fi - -before_deploy: - - | - echo "Test whether installing works. This is mostly just a sanity check."; - cargo install --path . --target $TARGET --locked --force; - - | - echo "Building release..." - if [[ $TRAVIS_OS_NAME == "windows" ]]; then - echo "Building Windows 64-bit, target: $TARGET..."; - cargo build --release --target $TARGET; - local target_dir=$(ls target/release/build/bottom-*/out/btm.bash | head -n1 | xargs dirname) - cp -r $target_dir completions - mv "./target/$TARGET/release/btm" "btm.exe"; - strip "btm.exe" - zip -r bottom_$TARGET.zip "btm.exe" "completions"; - rm "btm.exe" - rm -r "completions" - - if [[ $TARGET == "x86_64-pc-windows-msvc" ]]; then - echo "Building further results for x86_64-pc-windows-msvc target..." - echo "Building Windows 32-bit..."; - cargo clean; - cargo build --release --target i686-pc-windows-msvc; - local target_dir=$(ls target/release/build/bottom-*/out/btm.bash | head -n1 | xargs dirname) - cp -r $target_dir completions - mv "./target/i686-pc-windows-msvc/release/btm" "btm.exe"; - strip "btm.exe" - zip -r bottom_i686-pc-windows-msvc.zip "btm.exe" "completions"; - rm "btm.exe" - rm -r "completions" - - echo "Building choco template..."; - python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $TRAVIS_TAG "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/"; - cd "./deployment/windows/choco/" - zip -r choco.zip "bottom.nuspec" "tools/"; - cd "../../../"; - mv "./deployment/windows/choco/choco.zip" "./choco.zip" - - echo "Building msi file..."; - cargo install cargo-wix; - cargo wix init; - cargo wix; - - echo "Building winget template..."; - python "./deployment/packager.py" $TRAVIS_TAG "./deployment/windows/winget/winget.yaml.template" "$TRAVIS_TAG.yaml" "SHA256" "./bottom_x86_64_installer.msi"; - fi - - echo "Done Windows pre-deploy!"; - else - echo "Building release for macOS/Linux, target: $TARGET"; - cargo build --release; - cp ./target/release/btm btm; - strip btm; - local target_dir=$(ls target/release/build/bottom-*/out/btm.bash | head -n1 | xargs dirname) - cp -r $target_dir completions - echo "Tar-ing macOS/Linux binary and completions..." - tar -czvf bottom_$TARGET.tar.gz btm completions; - - if [[ $TRAVIS_OS_NAME == "linux" && $TARGET == "x86_64-unknown-linux-gnu" ]]; then - echo "Building further results for x86_64-unknown-linux-gnu..." - echo "Generating AUR template..."; - python "./deployment/packager.py" $TRAVIS_TAG "./deployment/linux/arch/PKGBUILD_BIN.template" "./PKGBUILD_BIN" "SHA512" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; - curl -LO "https://github.com/ClementTsang/bottom/archive/$TRAVIS_TAG.tar.gz"; - - echo "Generating AUR binary template..."; - python "./deployment/packager.py" $TRAVIS_TAG "./deployment/linux/arch/PKGBUILD.template" "./PKGBUILD" "SHA512" "./$TRAVIS_TAG.tar.gz"; - rm "$TRAVIS_TAG.tar.gz"; - - echo "Tar-ing AUR PKGBUILDs..."; - tar -czvf arch.tar.gz PKGBUILD_BIN PKGBUILD; - - # Note this requires the completions directory in the current directory. - echo "Generating Debian install file..."; - cargo install cargo-deb; - cargo deb; - cp ./target/debian/bottom_*.deb .; - fi - - echo "Done macOS/Linux pre-deploy!"; - fi - -deploy: - provider: releases - overwrite: true - api_key: - secure: ppBn0DnqZ+Rzb84doZQxYdUBQ0rVrZNIiH6ZSFEiCVJd0ttqXfOjK/qXbIf/zabwO0Olqz18jwd9piHjNigWRrHwX9N+YH0DZTM3f4WS2/2acvOP3AjSw6oERjYTwS5yKe/XP1sU11uL6O0oAxYFeiAkn7QOM7flVUE2BmmLAs2lLtQ+9ylmUeBGatrkTfQ0Z2i1o7p5mtI2fKUozpImtHq8TClQEsF4oQS5nvkHtpLuPQ0UrJ8vKZijDBeMuLbDkR121ujRnjoBt8+eXBRbwzAvVotwRozyol8noAN3i4VvYueId6oX7Y2DSEp26wnCuRXGurUnyya5JE55AKoevK+SUHRe5+29/2lPbC5d/etZt2tSX1AIJk9fHeIfRPSTzanIIyDpUzSGoMKjl1ARKGrgHYehRxMKpW0cC2xHSlQ+NrA5apLpXKr2IzpkGsxpAxLqRASbX2VJYCEL70WoJfXinZrxeDxXsaWBLGaj9ySyk059GZBMz9GBdYNtwF3G/3aSIt0nkEGgKipgYXHi5keKKGmyfeZyYkRJRbc369JRZiHuOWct+1ZsOdrKKdbyAdcDGj5kbKuYwA6E+wgI62IWvUTm+vtKDuIbLpu/48aOUuEslGHkYAszLTapX/Le9c9XTu3L+PMgkPq2LSyaeGrfnM+DE/Hwe3Jvurccp94= - file_glob: true - file: - - bottom_*.tar.gz - - bottom_*.zip - - bottom_*.deb - - arch.tar.gz - - bottom.rb - - choco.zip - - bottom_x86_64_installer.msi - - $TRAVIS_TAG.yaml - skip_cleanup: true - on: - tags: true - condition: "$TRAVIS_RUST_VERSION = stable" - repo: ClementTsang/bottom - draft: true diff --git a/.vscode/settings.json b/.vscode/settings.json index accd5163..1b7f47ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -48,6 +48,7 @@ "cvars", "czvf", "denylist", + "dont", "eselect", "fedoracentos", "fpath", @@ -68,6 +69,7 @@ "memb", "minwindef", "musl", + "musleabihf", "n'th", "nixos", "noheader", diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d754db7..6222a877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.5.1] - Unreleased +## [0.5.1] - 2020-11-22 -### Features +## Bug Fixes -### Changes +- [6ef1d66](https://github.com/ClementTsang/bottom/commit/6ef1d66b2bca49452572a2cabb87d338dcf56e7b): Remove nord as a valid colour for now. + +- [e04ce4f](https://github.com/ClementTsang/bottom/commit/e04ce4fa1b42e99f00cf8825bcd58da43552214e): Fix `--use_old_network_legend`. + +- [99d0402](https://github.com/ClementTsang/bottom/commit/99d04029f0ebfc73d36adb06ea58ad68f090017c): Fix config detection for built-in colours. ### Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index c0489f7e..6005be33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,7 +108,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bottom" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "assert_cmd", @@ -391,9 +391,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" +checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0" dependencies = [ "futures-channel", "futures-core", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" +checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" dependencies = [ "futures-core", "futures-sink", @@ -416,15 +416,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" [[package]] name = "futures-executor" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" +checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65" dependencies = [ "futures-core", "futures-task", @@ -433,15 +433,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" [[package]] name = "futures-macro" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" +checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -451,24 +451,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" +checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" [[package]] name = "futures-task" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" +checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" +checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" dependencies = [ "futures-channel", "futures-core", @@ -1360,9 +1360,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +checksum = "db8716a166f290ff49dabc18b44aa407cb7c6dbe1aa0971b44b8a24b0ca35aae" [[package]] name = "unicode-width" diff --git a/Cargo.toml b/Cargo.toml index 1f04ce51..f88c0b19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bottom" -version = "0.5.0" +version = "0.5.1" authors = ["Clement Tsang "] edition = "2018" repository = "https://github.com/ClementTsang/bottom" @@ -32,7 +32,7 @@ crossterm = "0.18.2" ctrlc = {version = "3.1", features = ["termination"]} clap = "2.33" dirs-next = "2.0.0" -futures = "0.3.7" +futures = "0.3.8" indexmap = "1.6.0" itertools = "0.9.0" lazy_static = "1.4.0" @@ -69,9 +69,9 @@ section = "utility" assets = [ ["target/release/btm", "usr/bin/", "755"], ["LICENSE", "usr/share/doc/btm/", "644"], - ["completions/btm.bash", "usr/share/bash-completion/completions/btm", "644"], - ["completions/btm.fish", "usr/share/fish/vendor_completions.d/btm.fish", "644"], - ["completions/_btm", "usr/share/zsh/vendor-completions/", "644"], + ["completion/btm.bash", "usr/share/bash-completion/completions/btm", "644"], + ["completion/btm.fish", "usr/share/fish/vendor_completions.d/btm.fish", "644"], + ["completion/_btm", "usr/share/zsh/vendor-completions/", "644"], ] extended-description = """\ A cross-platform graphical process/system monitor with a customizable interface and a multitude of diff --git a/README.md b/README.md index 4ebcc421..3721d1e2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # bottom -[![Build Status](https://travis-ci.com/ClementTsang/bottom.svg?token=1wvzVgp94E1TZyPNs8JF&branch=master)](https://travis-ci.com/ClementTsang/bottom) +![ci](https://github.com/ClementTsang/bottom/workflows/ci/badge.svg) [![crates.io link](https://img.shields.io/crates/v/bottom.svg)](https://crates.io/crates/bottom) -[![tokei](https://tokei.rs/b1/github/ClementTsang/bottom?category=code)](https://github.com/ClementTsang/bottom) A cross-platform graphical process/system monitor with a customizable interface and a multitude of features. Supports Linux, macOS, and Windows. Inspired by both [gtop](https://github.com/aksakalli/gtop) and [gotop](https://github.com/cjbassi/gotop). -![Quick demo recording showing off searching, expanding, and process killing.](assets/demo.gif) _Theme based on [gruvbox](https://github.com/morhetz/gruvbox) (run with_ `--color gruvbox`_). Font is [IBM Plex Mono](https://www.ibm.com/plex/), terminal is [Kitty](https://sw.kovidgoyal.net/kitty/). Recorded on version **0.5.0**._ +![Quick demo recording showing off searching, expanding, and process killing.](assets/demo.gif) _Theme based on [gruvbox](https://github.com/morhetz/gruvbox)_ (`--color gruvbox`). _Font is [IBM Plex Mono](https://www.ibm.com/plex/), terminal is [Kitty](https://sw.kovidgoyal.net/kitty/). Recorded on version **0.5.1**._ **Note**: If you are reading this on the master branch, then it may refer to in-development or un-released features/changes. Please refer to [release branch](https://github.com/ClementTsang/bottom/tree/release/README.md) or [crates.io](https://crates.io/crates/bottom) for the most up-to-date _release_ documentation. @@ -68,7 +67,7 @@ Note that bottom is: - Officially tested and released for only `x86_64` (and `i686` for Windows) - Developed mainly for macOS, Windows, and Linux -Anything outside of this (i.e: ARM builds, building on Nightly, building on another OS) is currently not guaranteed, even if it does happen to work. For example, ARM is tested against on Travis and release builds are supported, but not all features will work (such as R/s and W/s for disks). +Anything outside of this (i.e: ARM builds, building on Nightly, building on another OS) is currently not guaranteed, even if it does happen to work. For example, ARM is compiled on the CI pipeline and release builds will be provided, but not all features may work (such as R/s and W/s for disks). ### Manually @@ -87,13 +86,12 @@ cd bottom cargo install --path . # Download from releases and install -curl -LO https://github.com/ClementTsang/bottom/archive/0.5.0.tar.gz -tar -xzvf 0.5.0.tar.gz +curl -LO https://github.com/ClementTsang/bottom/archive/0.5.1.tar.gz +tar -xzvf 0.5.1.tar.gz cargo install --path . ``` -Or, you can just download the binary from the [latest release](https://github.com/ClementTsang/bottom/releases/latest) and install/use it -in whatever way you want. +Or, you can just download the binary from the [latest release](https://github.com/ClementTsang/bottom/releases/latest). ### Cargo @@ -121,8 +119,8 @@ yay -S bottom-bin A `.deb` file is provided on each [release](https://github.com/ClementTsang/bottom/releases/latest): ```bash -curl -LO https://github.com/ClementTsang/bottom/releases/download/0.5.0/bottom_0.5.0_amd64.deb -sudo dpkg -i bottom_0.5.0_amd64.deb +curl -LO https://github.com/ClementTsang/bottom/releases/download/0.5.1/bottom_0.5.1_amd64.deb +sudo dpkg -i bottom_0.5.1_amd64.deb ``` ### Fedora/CentOS @@ -174,7 +172,7 @@ Choco package located [here](https://chocolatey.org/packages/bottom). choco install bottom # Version number may be required for newer releases, if available: -choco install bottom --version=0.5.0 +choco install bottom --version=0.5.1 ``` ### winget diff --git a/rustfmt.toml b/rustfmt.toml index 72e8f629..61aee1cc 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -6,4 +6,3 @@ fn_args_layout = "Compressed" use_field_init_shorthand = true tab_spaces = 4 max_width = 100 -newline_style = "Unix" diff --git a/src/app/data_harvester/disks.rs b/src/app/data_harvester/disks.rs index 2da7c3ad..59e9d13c 100644 --- a/src/app/data_harvester/disks.rs +++ b/src/app/data_harvester/disks.rs @@ -1,3 +1,6 @@ +#[cfg(not(any(target_arch = "aarch64", target_arch = "arm")))] +use futures::stream::StreamExt; + #[derive(Debug, Clone, Default)] pub struct DiskHarvest { pub name: String, @@ -61,8 +64,6 @@ pub async fn arm_disk_usage( pub async fn non_arm_io_usage( get_physical: bool, actually_get: bool, ) -> crate::utils::error::Result> { - use futures::stream::StreamExt; - if !actually_get { return Ok(None); } @@ -106,8 +107,6 @@ pub async fn non_arm_io_usage( pub async fn non_arm_disk_usage( actually_get: bool, ) -> crate::utils::error::Result>> { - use futures::stream::StreamExt; - if !actually_get { return Ok(None); } diff --git a/src/constants.rs b/src/constants.rs index 452e235e..89132aa5 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -355,7 +355,8 @@ pub const OLD_CONFIG_TEXT: &str = r##"# This is a default config file for bottom # This group of options represents a command-line flag/option. Flags explicitly # added when running (ie: btm -a) will override this config file if an option # is also set here. -#[flags] + +[flags] # Whether to hide the average cpu entry. #hide_avg_cpu = false # Whether to use dot markers rather than braille. @@ -405,7 +406,8 @@ pub const OLD_CONFIG_TEXT: &str = r##"# This is a default config file for bottom # These are all the components that support custom theming. Note that colour support # will depend on terminal support. -#[colors] + +#[colors] # Uncomment if you want to use colors # Represents the colour of table headers (processes, CPU, disks, temperature). #table_header_color="LightBlue" # Represents the colour of the label each widget has. diff --git a/tests/layout_management_tests.rs b/tests/layout_management_tests.rs index e4eb21f4..4b4f7a9f 100644 --- a/tests/layout_management_tests.rs +++ b/tests/layout_management_tests.rs @@ -22,7 +22,7 @@ const PROC_LAYOUT: &str = r##" "##; fn test_create_layout( - rows: &Vec, default_widget_id: u64, default_widget_type: Option, + rows: &[Row], default_widget_id: u64, default_widget_type: Option, default_widget_count: u64, left_legend: bool, ) -> BottomLayout { let mut iter_id = 0; // A lazy way of forcing unique IDs *shrugs* diff --git a/tests/layout_movement_tests.rs b/tests/layout_movement_tests.rs index ef73c683..d74e62d0 100644 --- a/tests/layout_movement_tests.rs +++ b/tests/layout_movement_tests.rs @@ -6,4 +6,4 @@ // TODO: Test moving around with procs and their hidden children. -// TODO: Test moving around with cpus if they get hidden. \ No newline at end of file +// TODO: Test moving around with cpus if they get hidden. -- cgit v1.2.3