From 08bb2b873efa739599a71fb44ebca180d157ea1d Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 11 Jan 2023 23:51:05 +0100 Subject: [PATCH] build: custom release profile options --- .github/workflows/baru.yml | 29 ----- .github/workflows/deploy.yml | 76 ++++++++++++ .github/workflows/test.yml | 27 +++++ .pkg/aur/PKGBUILD | 27 +++++ .pkg/aur/update.sh | 54 +++++++++ Cargo.lock | 224 +++++++++++++++++++++++++---------- Cargo.toml | 7 +- README.md | 2 +- src/battery.rs | 6 +- src/cpu.rs | 2 +- 10 files changed, 354 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/baru.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test.yml create mode 100644 .pkg/aur/PKGBUILD create mode 100755 .pkg/aur/update.sh diff --git a/.github/workflows/baru.yml b/.github/workflows/baru.yml deleted file mode 100644 index 63c54a1..0000000 --- a/.github/workflows/baru.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Baru - -on: - push: - tags: - - v* # Push events to v* tags - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev - - name: Lint - run: cargo clippy - - name: Test - run: cargo test - - name: Build - run: cargo build --release --locked - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: target/release/baru - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..35036ac --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,76 @@ +name: Deployment + +on: + push: + tags: + - v* + +jobs: + test: + uses: ./.github/workflows/test.yml + + build: + name: Build + runs-on: ubuntu-latest + needs: test + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + - name: Install dependencies + run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev + - name: Build + run: cargo build --release --locked + - name: Upload binary artifact + uses: actions/upload-artifact@v3 + with: + name: baru + path: ./target/release/baru + + gh-release: + name: Publish Github Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Download binary artifact + uses: actions/download-artifact@v3 + with: + name: baru + path: ./target/release/ + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: target/release/baru + + aur-packaging: + name: Publish AUR package + needs: gh-release + runs-on: ubuntu-latest + env: + PKG_NAME: baru + PKGBUILD: ./.pkg/aur/PKGBUILD + RELEASE_TAG: ${{ github.ref_name }} + REPOSITORY: ${{ github.repository }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Download sources + run: curl -LfsSo "$PKG_NAME-$RELEASE_TAG".tar.gz "https://github.com/$REPOSITORY/archive/refs/tags/$RELEASE_TAG.tar.gz" + - name: Update PKGBUILD + run: ./.pkg/aur/update.sh + - name: Show PKGBUILD + run: cat "$PKGBUILD" + - name: Publish + uses: KSXGitHub/github-actions-deploy-aur@v2.6.0 + with: + pkgname: ${{ env.PKG_NAME }} + pkgbuild: ${{ env.PKGBUILD }} + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_KEY }} + commit_message: ${{ github.ref_name }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3159692 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test + +on: [push, workflow_call, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: clippy + - name: Install dependencies + run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev + - name: Lint + run: cargo clippy + - name: Check + run: cargo check + - name: Test + run: cargo test diff --git a/.pkg/aur/PKGBUILD b/.pkg/aur/PKGBUILD new file mode 100644 index 0000000..13889f1 --- /dev/null +++ b/.pkg/aur/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Pierre Dommerc + +pkgname=baru +pkgver=0.1.0 +pkgrel=1 +pkgdesc='A system monitor written in Rust and C' +arch=('x86_64') +url='https://github.com/doums/baru' +license=('MPL2') +depends=('libpulse') +makedepends=('rust' 'cargo') +provides=('baru') +conflicts=('baru') +source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz") +sha256sums=('xxx') + +build() { + cd "$pkgname-$pkgver" + cargo build --release --locked +} + +package() { + cd "$pkgname-$pkgver" + install -Dvm 755 "target/release/baru" "$pkgdir/usr/bin/baru" + install -Dvm 644 "baru.yaml" "$pkgdir/usr/share/baru/baru.yaml" +} + diff --git a/.pkg/aur/update.sh b/.pkg/aur/update.sh new file mode 100755 index 0000000..471f9bd --- /dev/null +++ b/.pkg/aur/update.sh @@ -0,0 +1,54 @@ +#! /bin/bash + +# script to bump version and update sources hash of a PKGBUILD + +set -e + +red="\e[38;5;1m" +green="\e[38;5;2m" +bold="\e[1m" +reset="\e[0m" + +if [ -z "$PKGBUILD" ]; then + >&2 printf " %b%b✕%b PKGBUILD not set\n" "$red" "$bold" "$reset" + exit 1 +fi + +if [ -z "$PKG_NAME" ]; then + >&2 printf " %b%b✕%b PKG_NAME not set\n" "$red" "$bold" "$reset" + exit 1 +fi + +if [ -z "$RELEASE_TAG" ]; then + >&2 printf " %b%b✕%b RELEASE_TAG not set\n" "$red" "$bold" "$reset" + exit 1 +fi + +if ! [ -a "$PKGBUILD" ]; then + >&2 printf " %b%b✕%b no such file $PKGBUILD\n" "$red" "$bold" "$reset" + exit 1 +fi + +if ! [[ "$RELEASE_TAG" =~ ^v.*? ]]; then + >&2 printf " %b%b✕%b invalid tag $RELEASE_TAG\n" "$red" "$bold" "$reset" + exit 1 +fi + +pkgver="${RELEASE_TAG#v}" +tarball="$PKG_NAME-$RELEASE_TAG".tar.gz + +if ! [ -a "$tarball" ]; then + >&2 printf " %b%b✕%b no such file $tarball\n" "$red" "$bold" "$reset" + exit 1 +fi + +# bump package version +sed -i "s/pkgver=.*/pkgver=$pkgver/" "$PKGBUILD" +printf " %b%b✓%b bump version to $RELEASE_TAG\n" "$green" "$bold" "$reset" + +# generate new checksum +sum=$(set -o pipefail && sha256sum "$tarball" | awk '{print $1}') +sed -i "s/sha256sums=('.*')/sha256sums=('$sum')/" "$PKGBUILD" +printf " %b%b✓%b generated checksum $sum\n" "$green" "$bold" "$reset" + +exit 0 diff --git a/Cargo.lock b/Cargo.lock index 59080c5..737a776 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] [[package]] name = "android_system_properties" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] @@ -28,7 +28,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "baru" -version = "0.3.0" +version = "0.3.1" dependencies = [ "chrono", "cmake", @@ -39,15 +39,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-if" @@ -57,9 +57,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.21" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f725f340c3854e3cb3ab736dc21f0cca183303acea3b3ffec30f141503ac8eb" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", @@ -72,21 +72,21 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.48" +version = "0.1.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" dependencies = [ "cc", ] [[package]] -name = "core-foundation" -version = "0.9.3" +name = "codespan-reporting" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ - "core-foundation-sys", - "libc", + "termcolor", + "unicode-width", ] [[package]] @@ -95,6 +95,50 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cxx" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -103,22 +147,33 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "iana-time-zone" -version = "0.1.42" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9512e544c25736b82aebbd2bf739a47c8a1c935dfcc3a6adcde10e35cd3cd468" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", - "core-foundation", + "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown", @@ -126,24 +181,33 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.129" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "link-cplusplus" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] [[package]] name = "log" @@ -181,33 +245,33 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -216,30 +280,36 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scratch" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "serde" -version = "1.0.143" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.143" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -248,9 +318,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.4" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7c9017c64a49806c6e8df8ef99b92446d09c92457f85f91835b01a8064ae0" +checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834" dependencies = [ "indexmap", "itoa", @@ -261,20 +331,29 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.99" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi", @@ -283,15 +362,21 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unsafe-libyaml" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931179334a56395bcf64ba5e0ff56781381c1a5832178280c7d7f91d1679aeb0" +checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" [[package]] name = "wasi" @@ -301,9 +386,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -311,9 +396,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", "log", @@ -326,9 +411,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -336,9 +421,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -349,9 +434,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "winapi" @@ -369,6 +454,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 56eb4ad..13a44be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "baru" -version = "0.3.0" +version = "0.3.1" authors = ["pierre "] edition = "2021" links = "netlink,audio" @@ -14,3 +14,8 @@ serde_yaml = "0.9" [build-dependencies] cmake = "0.1" + +[profile.release] +strip = true +opt-level = "s" +lto = true diff --git a/README.md b/README.md index e7943ed..d1ab3de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![baru](https://img.shields.io/github/actions/workflow/status/doums/baru/baru.yml?color=0D0D0D&logoColor=BFBFBF&labelColor=404040&logo=github&style=for-the-badge)](https://github.com/doums/baru/actions?query=workflow%3ABaru) +[![baru](https://img.shields.io/github/actions/workflow/status/doums/baru/test.yml?color=0D0D0D&logoColor=BFBFBF&labelColor=404040&logo=github&style=for-the-badge)](https://github.com/doums/baru/actions?query=workflow%3ABaru) [![baru](https://img.shields.io/aur/version/baru?color=0D0D0D&logoColor=BFBFBF&labelColor=404040&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/baru/) ## baru diff --git a/src/battery.rs b/src/battery.rs index 1cf62d2..291774b 100644 --- a/src/battery.rs +++ b/src/battery.rs @@ -221,7 +221,7 @@ fn parse_attributes( now_attribute: &str, full_attribute: &str, ) -> Result<(i32, i32, String), Error> { - let file = File::open(&uevent)?; + let file = File::open(uevent)?; let f = BufReader::new(file); let mut now = None; let mut full = None; @@ -248,7 +248,7 @@ fn parse_attributes( fn parse_attribute(line: &io::Result, attribute: &str) -> Option { if let Ok(l) = line { - if l.starts_with(&attribute) { + if l.starts_with(attribute) { let s = l.split('=').nth(1); if let Some(v) = s { return v.parse::().ok(); @@ -260,7 +260,7 @@ fn parse_attribute(line: &io::Result, attribute: &str) -> Option { fn parse_status(line: &io::Result) -> Option { if let Ok(l) = line { - if l.starts_with(&STATUS_ATTRIBUTE) { + if l.starts_with(STATUS_ATTRIBUTE) { return l.split('=').nth(1).map(|s| s.to_string()); } } diff --git a/src/cpu.rs b/src/cpu.rs index dd71832..59c2920 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -128,7 +128,7 @@ pub fn run( let mut iteration_end: Duration; loop { iteration_start = Instant::now(); - let proc_stat = File::open(&config.proc_stat)?; + let proc_stat = File::open(config.proc_stat)?; let mut reader = BufReader::new(proc_stat); let mut buf = String::new(); reader.read_line(&mut buf)?;