Skip to content

Commit

Permalink
Update the Continuous Integration job & upgrade Clap to v4.
Browse files Browse the repository at this point in the history
I suppose I conflated two changes in one commit. This patch:

    - updated the CI job & got it working again
    - upgraded to Clap v4
    - updates README & NEWS accordingly

Getting Clap v4. to *compile* was one thing-- the upgrade also
required a broad revision of the use of the Clap API (substituting
`get_flag()` for `contains_id()`, for instance.
  • Loading branch information
sp1ff committed Jul 16, 2023
1 parent a37c7d2 commit 1d15aa1
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 216 deletions.
115 changes: 78 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Setting up a nightly build & test job for `mpdpopm'. Much thanks to
# BurntShushi from whom I shamelessly copied a lot of this
# <https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml>
name: ci
# This is the continuous integration job for `mpdpopm`. It will run on
# both MacOS & Ubuntu, using various versions of Rust: a "pinned"
# version representing the least-supported, the current stable & the
# current nightly.
name: Continuous Integration

on:
workflow_dispatch:
pull_request:
types: [opened, edited, reopened] # don't say `synchronize`-- that is taken care of by `push`
push:
branches:
- master
- filters
schedule:
- cron: '00 01 * * *'

jobs:
build:
name: build
Expand All @@ -19,70 +21,113 @@ jobs:
- pinned
- stable
- nightly
# TODO(sp1ff): add more here
os: [ubuntu-18.04, macos-10.15]
os: [ubuntu-22.04, macos-12]
include:
- rust-build: pinned
os: ubuntu-18.04
rust: 1.56.1
os: ubuntu-22.04
# 1.56.0 was the first to support 2021 edition
# 1.58 -- required by cargo-deb...
# but it seems a cargo-deb dependency (rayon-core) needs 1.59,
# whereas another (`log1) requires 1.60, and the `cargo-deb`
# README says 1.63. Dependency `toml_edit` needs 1.64!
rust: 1.64
- rust-build: stable
os: ubuntu-18.04
os: ubuntu-22.04
rust: stable
- rust-build: nightly
os: ubuntu-18.04
os: ubuntu-22.04
rust: nightly
- rust-build: pinned
os: macos-10.15
rust: 1.56.1
os: macos-12
rust: 1.64
- rust-build: stable
os: macos-10.15
os: macos-12
rust: stable
- rust-build: nightly
os: macos-10.15
os: macos-12
rust: nightly
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1

steps:

- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# This is cheap, so do it early. I'd hate to install Rust, Eamcs,
# Tex &c only to find-out I'd forgotten a code TODO.
- name: Check for TODO-s
shell: bash
run: |
set -x
# `ripgrep` needs rust 1.70 to compile, but I stubbornly refuse
# to upgrade my "pinned" rust version!
# if rg -t rust 'TODO|TOOD|LATER|\\todo|todo!|dbg!'; then
if find . -iname '*.rs' -print0|xargs -0 grep -E 'TODO|TOOD|LATER|\\todo|todo!|dbg!'; then
echo "You have TODO-s"
exit 1
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Install Tools (Ubuntu)
if: matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
pwd
set -x
set -e
sudo apt-get update
sudo apt-get install -y autoconf automake emacs liblzma-dev texlive
- name: Install Tools (macOS)
if: matrix.os == 'macos-10.15'
if: matrix.os == 'macos-12'
shell: bash
run: |
pwd
set -x
# This seems wrong on multiple levels, but see here:
# <https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6339258>
set +e
pwd
brew cleanup
# Will exit with non-zero status if it finds problems, but can be handy
# for trouble-shooting:
brew doctor
brew update
brew upgrade
set -e
brew install autoconf automake emacs
brew install --cask basictex
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Install a modern version of Texinfo
if: matrix.os == 'macos-12'
shell: bash
run: |
set -x
mkdir tmp && cd tmp
# TODO(sp1ff): cache this
curl -L -O https://ftp.gnu.org/gnu/texinfo/texinfo-7.0.2.tar.gz
tar xf texinfo-7.0.2.tar.gz
cd texinfo-7.0.2
./configure
make
make install
type -p texi2dvi
texi2dvi --version
- name: Install additional Rust tooling
shell: bash
run: |
cargo install cargo-deb
cargo install --verbose cargo-deb
- name: Configure mpdpopm
shell: bash
run: |
set -x
set -ex
./bootstrap && ./configure
- name: Build mpdpopm
Expand All @@ -108,28 +153,24 @@ jobs:
shell: bash
run: |
set -x
cd mpdpopm
pwd
cargo test --verbose
make check
- name: Check the Autotools distribution (Ubuntu)
if: matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: make distcheck

- name: Check the Autotools distribution (MacOS)
if: matrix.os == 'macos-10.15'
if: matrix.os == 'macos-12'
shell: bash
run: |
eval "$(/usr/libexec/path_helper)"
make distcheck
- name: Check the Debian package
if: matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
cd mpdpopm
cargo deb
6 changes: 5 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ mpdpopm News -- history of user-visible changes -*- outline -*-

** 0.3.2 build

No user-visible changes; strictly a hygiene build (updated to Tokio 1.0).
No user-visible changes; strictly a hygiene build:

- updated to Tokio 1.0
- updated to Clap 4
- updated the Rust edition to 2021
** 0.3.1 build

No user-visible changes; strictly a hygiene build (re-vamped error-handling throughout).
Expand Down
7 changes: 4 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#+AUTHOR: Michael Herstine
#+DESCRIPTION: mpdpopm
#+EMAIL: [email protected]
#+DATE: <2021-12-30 Thu 07:49>
#+DATE: <2023-07-15 Sat 17:12>
#+AUTODATE: t

* Introduction

1
[[https://github.com/sp1ff/mpdpopm][mpdpopm]] provides a companion daemon to [[https://www.musicpd.org/][MPD]] for maintaining play counts, ratings and last-played timestamps, along with an associated CLI for talking to the companion daemon. Similar to [[https://github.com/vincent-petithory/mpdfav][mpdfav]], but written in Rust (which I prefer to Go), it will maintain this information in your sticker database. Along the lines of [[https://alip.github.io/mpdcron][mpdcron]], it will also allow you to keep that information up-to-date in your tags by invoking external (user-provided & -configured) commands.

This README focuses on obtaining & installing [[https://github.com/sp1ff/mpdpopm][mpdpopm]]; the user manual is distributed with the package in [[https://www.gnu.org/software/texinfo/][Texinfo]] format. The HTML version of the user manual is hosted on my personal [[https://www.unwoundstack.com/doc/mpdpopm/curr][site]].
Expand All @@ -24,7 +24,7 @@ mppopm findadd "(rating > 128)"
to add all songs with a rating greater than 128 to the play queue, or

#+BEGIN_SRC bash
mppopm findadd "(lastplayed <= \"2020-03-27\")"
mppopm findadd "(lastplayed <= \"2022-07-15\")"
#+END_SRC

to add all songs that haven't been played in the last year.
Expand Down Expand Up @@ -179,6 +179,7 @@ You'll likely want to run the program in the foreground initially for ease of tr
Once you've got the daemon running to your satisfaction, if you're on a systemd-based Linux distribution, have a look at the sample systemd unit file thanks to [[https://github.com/tanshoku][tanshoku]].

[[https://github.com/tanshoku][tanshoku]] was kind enough to contribute a systemd unit for this purpose. At present, the build does not install it, but provides it as an example and leaves it to the user to install should they desire (and after they have edited it to suit their configuration). You can find it in =${prefix}/share/mpdpopm/examples= for the Autotools distribution, =/usr/local/share/mpdpopm/examples= for the Debian package, and in the =doc= folder for the pre-built binaries.

*** mppopm

At this point, [[https://github.com/sp1ff/mpdpopm][mpdpopm]] will happily monitor your playback history & keep play counts & last played timestamps for you. If you would like to rate tracks, however, you will need to somehow induce your favorite mpd client to send a "rating" message to the [[https://github.com/sp1ff/mpdpopm][mpdpopm]] commands channel ("unwoundstack.com:commands" by default). Since this is unlikely to be convenient, I wrote an mpd client for the purpose: a little CLI called =mppopm=. You can simply execute
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_INIT([mpdpopm], [0.3.2], [[email protected]], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([mpdpopm/Cargo.toml.in])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability -Wno-override gnits std-options dist-bzip2 dist-xz])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability -Wno-override gnits std-options dist-xz dist-zstd])

AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
AS_IF(test x$CARGO = xno,
Expand Down
9 changes: 4 additions & 5 deletions mpdpopm/Cargo.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mpdpopm"
version = "@PACKAGE_VERSION@"
authors = ["@PACKAGE_AUTHOR@"]
edition = "2018"
edition = "2021"
license-file = "../LICENSE"
description = "Maintain ratings & playcounts for your mpd server"
homepage = "https://github.com/sp1ff/mpdpopm"
Expand All @@ -13,18 +13,17 @@ categories = ["multimedia", "network-programming", "database"]
exclude = ["Cargo.toml.in", "Cargo.toml.orig", "Makefile", "Makefile.in", "Makefile.am", "rusty-tags.emacs", "src/vars.rs.am.in", "src/vars.rs.am", "flapdoodle.rs", "*.log"]

[build-dependencies]
lalrpop = { version = "0.19", features = ["lexer"] }
lalrpop = { version = "0.20", features = ["lexer"] }

[dependencies]
async-trait = "0.1.31"
backtrace = "0.3.46"
boolinator = "2.4.0"
chrono = "0.4.19"
clap = "=3.0.0-beta.1"
clap = "4.3.9"
errno = "0.2.6"
# futures = "0.3.5"
futures = "0.3.19"
lalrpop-util = "0.19"
lalrpop-util = { version = "0.20", features = ["lexer"] }
lazy_static = "1.4.0"
libc = "0.2.74"
log = "0.4.8"
Expand Down
2 changes: 1 addition & 1 deletion mpdpopm/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $(srcdir)/src/vars.rs: $(builddir)/src/flapdoodle.rs
dist-hook:
cp -v Cargo.toml $(distdir)/mpdpopm
cp -v src/flapdoodle.rs $(distdir)/src/vars.rs
cp -v mppopmd.{conf,service} $(disdir)
cp -v mppopmd.{conf,service} $(distdir)

mppopmd$(EXEEXT): $(mppopmd_SOURCES) $(srcdir)/Cargo.toml $(srcdir)/src/vars.rs
cd $(top_srcdir)/mpdpopm && \
Expand Down
Loading

0 comments on commit 1d15aa1

Please sign in to comment.