15 Commits

11 changed files with 142 additions and 24 deletions

View File

@@ -1,6 +1,3 @@
[target.x86_64-unknown-linux-musl]
runner = "musl-gcc"
[profile.release] [profile.release]
opt-level = "z" opt-level = "z"
strip = true strip = true

View File

@@ -1,4 +1,4 @@
name: Build name: build
permissions: permissions:
contents: write contents: write
@@ -72,7 +72,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: 1.74
targets: ${{ matrix.target }} targets: ${{ matrix.target }}
- name: Cache Rust dependencies - name: Cache Rust dependencies

View File

@@ -1,4 +1,4 @@
name: Integration name: integration
on: on:
workflow_dispatch: workflow_dispatch:

View File

@@ -1,4 +1,4 @@
name: GitHub Pages name: github-pages
permissions: permissions:
pages: write pages: write

86
.github/workflows/test.yaml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: test
on:
workflow_dispatch:
push:
paths-ignore:
- README.md
- .gitignore
- LICENSE
- run.sh
pull_request:
paths-ignore:
- README.md
- .gitignore
- LICENSE
- run.sh
schedule:
- cron: '30 14 * * 1' # every Monday, 9:30 AM CDT
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
tools: musl-tools
artifact: true
- os: macos-13
target: x86_64-apple-darwin
# - os: macos-latest
# target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: test-${{ matrix.os }}-${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.74
targets: ${{ matrix.target }}
- name: Install Linker Tools
if: matrix.tools
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.tools }}
# ensure has a newline at the end
[ "$(tail -c 1 .cargo/config.toml)" != "" ] && echo >> .cargo/config.toml
cat .cargo/config.github.toml >> .cargo/config.toml
- name: Cache Rust dependencies
uses: actions/cache@v4.0.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: testing-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
testing-${{ runner.os }}-${{ matrix.target }}-
testing-${{ runner.os }}-
- name: Run tests
run: cargo test --verbose --target ${{ matrix.target }}
- name: Build
if: matrix.artifact
run: cargo build --verbose --target ${{ matrix.target }}
- name: Upload Artifact
if: matrix.artifact
uses: actions/upload-artifact@v4
with:
name: spotify-quickauth-${{ github.sha }}-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/spotify-quickauth

View File

@@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
# Remove all lines starting with >[! from CARGO_README.md # TODO: Only run when README.md is modified
sed -i '/^>\[!/d' CARGO_README.md # TODO: Support partial staging, where the 'Staged' version is copied to CARGO_README.md, and then `sed` is ran.
# Remove markdown extension lines for Cargo publishing
sed '/^>\[!/d' README.md > CARGO_README.md
# Add the modified file to the commit # Add the modified file to the commit
git add CARGO_README.md git add CARGO_README.md

View File

@@ -1,7 +1,11 @@
# spotify-quickauth # spotify-quickauth
[![Build Status](https://github.com/Xevion/spotify-quickauth/workflows/Build/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions) [![Build Status](https://github.com/Xevion/spotify-quickauth/workflows/build/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions)
[![Testing Status](https://github.com/Xevion/spotify-quickauth/workflows/test/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions)
[![Crates.io](https://img.shields.io/crates/v/spotify-quickauth.svg)](https://crates.io/crates/spotify-quickauth) [![Crates.io](https://img.shields.io/crates/v/spotify-quickauth.svg)](https://crates.io/crates/spotify-quickauth)
![Crates.io MSRV](https://img.shields.io/crates/msrv/spotify-quickauth)
![GitHub last commit](https://img.shields.io/github/last-commit/Xevion/spotify-quickauth)
<!-- TODO: Add testing status badge -->
A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify]. A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify].
@@ -10,8 +14,6 @@ A simple CLI-based application for creating a `credentials.json` file, used by `
- Automatically places configuration files - Automatically places configuration files
- No dependencies, no installation, no fuss - No dependencies, no installation, no fuss
>This README is literally filled with lies. I'm not joking, I've just typed up a bunch of features I plan to implement, and am planning them out now. A fair amount of it works, but most of the specific options aren't currently implemented. I'm working on it, I promise!
## Quickstart ## Quickstart
You can run this application without installing anything by using the following commands. You can run this application without installing anything by using the following commands.
@@ -47,7 +49,7 @@ Installation is not necessary to use this application, but if you're having trou
### Pre-built Binaries ### Pre-built Binaries
Binaries are always available for download from the [releases page][releases], and they're the same ones used by the shell scripts above. Binaries are always available for download from the [releases page][latestRelease], and they're the same ones used by the shell scripts above.
Currently, the following targets are available for download: Currently, the following targets are available for download:
- x64 Linux (MUSL) `x86_64-unknown-linux-musl` - x64 Linux (MUSL) `x86_64-unknown-linux-musl`
@@ -58,14 +60,33 @@ Currently, the following targets are available for download:
- x64 Windows `x86_64-pc-windows-msvc` - x64 Windows `x86_64-pc-windows-msvc`
- ARM64 Windows `aarch64-pc-windows-msvc` - ARM64 Windows `aarch64-pc-windows-msvc`
Please [file an issue][new-issue] if you are on a platform that is not supported, or if you encounter issues with the binaries.
### Via `cargo-binstall`
> If the package cannot be found for your target or fails to be downloaded for any reason, `cargo-binstall` will automatically fall back to building the package from source.
`cargo-binstall` is a tool that allows you to install binaries from crates.io without needing to compile them yourself.
```
cargo binstall spotify-quickauth
```
If you're curious where the binary comes from, `cargo-binstall` will likely pull the binary directly from the [latest release][latestRelease] by this repository, selecting the most appropriate target for your host.
### Manual Installation
If you'd like to use the shell script above to install the binary, you can use the `-S/--stop` flag to prevent the script from running the binary after downloading it. It implicitly applies the `--keep` flag too. If you'd like to use the shell script above to install the binary, you can use the `-S/--stop` flag to prevent the script from running the binary after downloading it. It implicitly applies the `--keep` flag too.
You'll need to move the binary yourself though:
```bash ```bash
curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s -- -S curl -sSL https://xevion.github.io/spotify-quickauth/run.sh | sh -s -- -S
mv spotify-quickauth /usr/local/bin mv spotify-quickauth /usr/local/bin
``` ```
Then you can move it to whatever location you'd like. Make sure that directory is in your $PATH though! Make sure your directory of choice is in your $PATH though!
### Building from Source ### Building from Source
@@ -85,10 +106,13 @@ If you have any troubles building the project
- Make sure you're using a target that's supported by the project (see above). - Make sure you're using a target that's supported by the project (see above).
- Certain targets may require specfic linkers. For example, - Certain targets may require specfic linkers. For example,
[latestRelease]: https://github.com/Xevion/spotify-quickauth/releases/latest/
[spotify-player]: https://github.com/aome510/spotify-player [spotify-player]: https://github.com/aome510/spotify-player
[spotifyd]: https://github.com/Spotifyd/spotifyd [spotifyd]: https://github.com/Spotifyd/spotifyd
[raspotify]: https://github.com/dtcooper/raspotify [raspotify]: https://github.com/dtcooper/raspotify
[rustup]: https://rustup.rs [rustup]: https://rustup.rs
[git]: https://git-scm.com [git]: https://git-scm.com
[binstall]: https://github.com/cargo-bins/cargo-binstall [binstall]: https://github.com/cargo-bins/cargo-binstall
[quickinstall]: https://github.com/cargo-bins/cargo-quickinstall [quickinstall]: https://github.com/cargo-bins/cargo-quickinstall
[binstall-installation]: https://github.com/cargo-bins/cargo-binstall#installation
[new-issue]: https://github.com/Xevion/spotify-quickauth/issues/new

11
CHANGELOG.md Normal file
View File

@@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.
## v0.1.6
- Began tracking changes in the `CHANGELOG.md` file.
- [breaking] Lowered MSRV to 1.74 to match `librespot`'s `0.5.0-dev` branch.
- Fixed `pre-commit` hook to properly process the `CARGO_README.md` file.
- Added testing workflow to the repository, targeting only major x64 platforms.
- New testing badge in README

2
Cargo.lock generated
View File

@@ -1287,7 +1287,7 @@ dependencies = [
[[package]] [[package]]
name = "spotify-quickauth" name = "spotify-quickauth"
version = "0.1.5" version = "0.1.6"
dependencies = [ dependencies = [
"env_logger", "env_logger",
"futures", "futures",

View File

@@ -1,9 +1,9 @@
[package] [package]
name = "spotify-quickauth" name = "spotify-quickauth"
version = "0.1.5" version = "0.1.6"
edition = "2021" edition = "2021"
description = "Quickly authenticate librespot-based applications with Spotify" description = "Quickly authenticate librespot-based applications with Spotify"
rust-version = "1.81" rust-version = "1.74"
authors = ["Ryan Walters <xevion@xevion.dev>"] authors = ["Ryan Walters <xevion@xevion.dev>"]
homepage = "https://github.com/Xevion/spotify-quickauth" homepage = "https://github.com/Xevion/spotify-quickauth"
repository = "https://github.com/Xevion/spotify-quickauth" repository = "https://github.com/Xevion/spotify-quickauth"

View File

@@ -1,11 +1,11 @@
# spotify-quickauth # spotify-quickauth
[![Build Status](https://github.com/Xevion/spotify-quickauth/workflows/Build/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions) [![Build Status](https://github.com/Xevion/spotify-quickauth/workflows/build/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions)
<!-- TODO: Add testing status badge --> [![Testing Status](https://github.com/Xevion/spotify-quickauth/workflows/test/badge.svg)](https://github.com/Xevion/spotify-quickauth/actions)
[![Crates.io](https://img.shields.io/crates/v/spotify-quickauth.svg)](https://crates.io/crates/spotify-quickauth) [![Crates.io](https://img.shields.io/crates/v/spotify-quickauth.svg)](https://crates.io/crates/spotify-quickauth)
![Crates.io MSRV](https://img.shields.io/crates/msrv/spotify-quickauth) ![Crates.io MSRV](https://img.shields.io/crates/msrv/spotify-quickauth)
![GitHub last commit](https://img.shields.io/github/last-commit/Xevion/spotify-quickauth) ![GitHub last commit](https://img.shields.io/github/last-commit/Xevion/spotify-quickauth)
<!-- TODO: Add testing status badge -->
A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify]. A simple CLI-based application for creating a `credentials.json` file, used by `librespot` derived applications, such as [spotify-player][spotify-player], [spotifyd][spotifyd], and [raspotify][raspotify].
@@ -14,9 +14,6 @@ A simple CLI-based application for creating a `credentials.json` file, used by `
- Automatically places configuration files - Automatically places configuration files
- No dependencies, no installation, no fuss - No dependencies, no installation, no fuss
>[!WARNING]
>This README is literally filled with lies. I'm not joking, I've just typed up a bunch of features I plan to implement, and am planning them out now. A fair amount of it works, but most of the specific options aren't currently implemented. I'm working on it, I promise!
## Quickstart ## Quickstart
You can run this application without installing anything by using the following commands. You can run this application without installing anything by using the following commands.