From 09eef912cc17252b13828f9fc9ba52bdd2f63242 Mon Sep 17 00:00:00 2001 From: ashthespy Date: Thu, 7 Nov 2019 13:16:17 +0100 Subject: [PATCH 1/5] [Travis] Reduce cache bloat - don't save build artefacts --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6a28f10a..fc3294af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,17 @@ rust: - nightly cache: cargo - +# Reduce cache bloat +before_cache: + - rm -rfv "$TRAVIS_HOME/.cargo/registry/src" + - rm -rfv target/debug/incremental/{librespot,build_script_build}-* + - rm -rfv target/debug/.fingerprint/librespot-* + - rm -rfv target/debug/build/librespot-* + - rm -rfv target/debug/deps/liblibrespot-* + - rm -rfv target/debug/deps/librespot-* + - rm -rfv target/debug/{librespot,liblibrespot}.d + - cargo clean -p librespot librespot-core librespot-connect librespot-audio librespot-metadata librespot-playback + addons: apt: packages: From 1719ffc906cd15b21b4a37c821337b3ddf359cc2 Mon Sep 17 00:00:00 2001 From: ashthespy Date: Fri, 8 Nov 2019 09:58:43 +0100 Subject: [PATCH 2/5] [Travis] Build examples --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fc3294af..0c150760 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ before_script: script: - cargo build --locked --no-default-features + - cargo build --locked --examples - cargo build --locked --no-default-features --features "with-tremor" - cargo build --locked --no-default-features --features "with-vorbis" - cargo build --locked --no-default-features --features "alsa-backend" From af715f9e8c23311e2dd340270a5dd40b5fbffbb3 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 9 Nov 2019 15:19:30 +0100 Subject: [PATCH 3/5] Add publish.sh script for creating new version, update PUBLISHING.md --- PUBLISHING.md | 21 ++++++++++++- publish.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100755 publish.sh diff --git a/PUBLISHING.md b/PUBLISHING.md index 952a0b8c..ceab506c 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -1,9 +1,28 @@ # Publishing +## How To + +The bash script in the root of the project, named `publish.sh` can be used to publish a new version of librespot and it's corresponding crates. the command should be used as follows: `./publish 0.1.0` from the project root, substituting the new version number that you wish to publish. *Note the lack of a v prefix on the version number. This is important, do not add one.* The v prefix is added where appropriate by the script. + +## What the script does + +This is briefly how the script works: + + - Change to branch master, pull latest version, merge development branch. + - CD to working dir. + - Change version number in all files. + - Commit and tag changes. + - Publish crates in given order. + - Push version commit and tags to master. + +## Notes + Publishing librespot to crates.io is a slightly convoluted affair due to the various dependencies that each package has on other local packages. The order of publising that has been found to work is as follows: `protocol -> core -> audio -> metadata -> playback -> connect -> librespot` The `protocol` package needs to be published with `cargo publish --no-verify` due to the build script modifying the source during compile time. -Publishing can be done using the command `cargo publish` in each of the directories of the respecive crate. \ No newline at end of file +Publishing can be done using the command `cargo publish` in each of the directories of the respective crate. + +The script is meant to cover the standard publishing process. There are various improvements that could be made, such as adding options such as the user being able to add a change log, though this is not the main focus, as the script is intended to be run by a CI. Feel free to improve and extend functionality, keeping in mind that it should always be possible for the script to be run in a non-interactive fashion. diff --git a/publish.sh b/publish.sh new file mode 100755 index 00000000..6672dba0 --- /dev/null +++ b/publish.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +WORKINGDIR="$( cd "$(dirname "$0")" ; pwd -P )" +cd $WORKINGDIR + +crates=( "protocol" "core" "audio" "metadata" "playback" "connect" "librespot" ) + +function switchBranch { + # You are expected to have committed/stashed your changes before running this. + echo "Switching to master branch and merging development." + git checkout master + git pull + git merge dev +} + +function updateVersion { + for CRATE in "${crates[@]}" + do + if [ "$CRATE" = "librespot" ] + then + CRATE='' + fi + crate_path="$WORKINGDIR/$CRATE/Cargo.toml" + crate_path=${crate_path//\/\///} + sed -i '' "s/^version.*/version = \"$1\"/g" "$crate_path" + echo "Path is $crate_path" + done +} + +function commitAndTag { + git commit -a -m "Update version numbers to $1" + git tag "v$1" -a -m "Update to version $1" +} + +function get_crate_name { + awk -v FS="name = " 'NF>1{print $2; exit}' Cargo.toml +} + +function publishCrates { + for CRATE in "${crates[@]}" + do + if [ "$CRATE" = "librespot" ] + then + CRATE='' + fi + + crate_path="$WORKINGDIR/$CRATE" + crate_path=${crate_path//\/\///} + cd $crate_path + + crate_name=`echo $( awk -v FS="name = " 'NF>1{print $2; exit}' Cargo.toml )` + echo "Publishing $crate_name to crates.io" + if [ "$CRATE" == "protocol" ] + then + # Protocol crate needs --no-verify option due to build.rs modification. + cargo publish --no-verify + else + cargo publish + fi + echo "Successfully published $crate_name to crates.io" + done +} + +function updateRepo { + cd $WORKINGDIR + echo "Pushing to master branch of repo." + git push origin master + echo "Pushing v$1 tag to master branch of repo." + git push origin v$1 +} + +function run { + # switchBranch + updateVersion $1 + commitAndTag $1 + publishCrates + updateRepo $1 + echo "Successfully published v$1 to crates.io and uploaded changes to repo." +} + +# First argument is new version number. +run $1 From 8eae57bad0043ba10d62c419bb74045ea9228161 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 9 Nov 2019 15:21:12 +0100 Subject: [PATCH 4/5] Uncommented branch switch. --- publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.sh b/publish.sh index 6672dba0..a7d1076a 100755 --- a/publish.sh +++ b/publish.sh @@ -70,7 +70,7 @@ function updateRepo { } function run { - # switchBranch + switchBranch updateVersion $1 commitAndTag $1 publishCrates From 3cefc57eb592f98940da05370ad148b5f557b7ae Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 9 Nov 2019 15:36:55 +0100 Subject: [PATCH 5/5] Correct bad bitrate flag in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62dc52e8..204bcc94 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ _Note: librespot only works with Spotify Premium. This will remain the case for ## Quick start We're available on [crates.io](https://crates.io/crates/librespot) as the _librespot_ package. Simply run `cargo install librespot` to install librespot on your system. Check the wiki for more info and possible [usage options](https://github.com/librespot-org/librespot/wiki/Options). -After installation, you can run librespot form the CLI using a command such as `librespot -n "Librespot Speaker" -b 192` to create a speaker called _Librespot Speaker_ serving 192kbps audio. +After installation, you can run librespot form the CLI using a command such as `librespot -n "Librespot Speaker" -b 160` to create a speaker called _Librespot Speaker_ serving 160kbps audio. ## This fork As the origin by [plietar](https://github.com/plietar/) is no longer actively maintained, this organisation and repository have been set up so that the project may be maintained and upgraded in the future.