Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,60 @@ jobs:
path: dist/*
if-no-files-found: error

# Lists the files of every package and compares the list with packaging/contents.txt, so that
# a change to what a package holds shows up in review. A release needs it too.
contents:
needs: [version, binary, deb, rpm, arch]
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: dist
pattern: dist-*
merge-multiple: true
- run: sudo apt-get install -y --no-install-recommends libarchive-tools
# [profile.release] strip = true must reach every package (cargo ignores a member
# manifest's profile, and the file list alone would not show it)
- name: The packaged binaries are stripped
run: |
for pkg in dist/obsbot4linux*; do
case $pkg in
*.deb) bsdtar -xOf "$pkg" 'data.tar*' > payload ;;
*) cp "$pkg" payload ;;
esac
bin=$(bsdtar -tf payload | grep -E '(usr/bin|-linux)/obsbot4linux$')
bsdtar -xOf payload "$bin" > obsbot4linux.bin
info=$(file -b obsbot4linux.bin)
echo "$pkg: $info"
case $info in
*', stripped') ;;
*) echo "::error::$pkg ships an unstripped binary"; exit 1 ;;
esac
done
rm -f payload obsbot4linux.bin
- name: Compare the package contents
env:
VER: ${{ needs.version.outputs.ver }}
run: |
scripts/package-contents.sh dist "$VER" > contents.txt
cat contents.txt
diff -u packaging/contents.txt contents.txt
# the list itself, also when it differs, to update packaging/contents.txt from
- if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: package-contents
path: contents.txt
if-no-files-found: error

# Tags only: a pull request builds the packages above and publishes nothing.
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [binary, deb, rpm, arch]
needs: [binary, deb, rpm, arch, contents]
runs-on: ubuntu-22.04
timeout-minutes: 15
permissions:
Expand Down
94 changes: 94 additions & 0 deletions packaging/contents.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .BUILDINFO
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .BUILDINFO
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .MTREE
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .MTREE
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .PKGINFO
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- .PKGINFO
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/lib/systemd/user/obsbot4linux.service
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/lib/systemd/user/obsbot4linux.service
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/doc/obsbot4linux/README.md
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/doc/obsbot4linux/README.md
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/licenses/obsbot4linux/LICENSE
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rw-r--r-- usr/share/licenses/obsbot4linux/LICENSE
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rwxr-xr-x usr/bin/obsbot4linux
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst -rwxr-xr-x usr/bin/obsbot4linux
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/bin/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/bin/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/systemd/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/systemd/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/systemd/user/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/lib/systemd/user/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/doc/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/doc/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/doc/obsbot4linux/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/doc/obsbot4linux/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/licenses/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/licenses/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/licenses/obsbot4linux/
obsbot4linux-VERSION-1-ARCH.pkg.tar.zst drwxr-xr-x usr/share/licenses/obsbot4linux/
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.service
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.service
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/doc/obsbot4linux/README.md
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/doc/obsbot4linux/README.md
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/licenses/obsbot4linux/LICENSE
obsbot4linux-VERSION-1.ARCH.rpm -rw-r--r-- ./usr/share/licenses/obsbot4linux/LICENSE
obsbot4linux-VERSION-1.ARCH.rpm -rwxr-xr-x ./usr/bin/obsbot4linux
obsbot4linux-VERSION-1.ARCH.rpm -rwxr-xr-x ./usr/bin/obsbot4linux
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/CHANGELOG.md
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/CHANGELOG.md
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/LICENSE
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/LICENSE
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/README.md
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/README.md
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/systemd/obsbot4linux.service
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/systemd/obsbot4linux.service
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/systemd/obsbot4linux.socket
obsbot4linux-VERSION-ARCH-linux.tar.gz -rw-r--r-- obsbot4linux-VERSION-ARCH-linux/systemd/obsbot4linux.socket
obsbot4linux-VERSION-ARCH-linux.tar.gz -rwxr-xr-x obsbot4linux-VERSION-ARCH-linux/obsbot4linux
obsbot4linux-VERSION-ARCH-linux.tar.gz -rwxr-xr-x obsbot4linux-VERSION-ARCH-linux/obsbot4linux
obsbot4linux-VERSION-ARCH-linux.tar.gz drwxr-xr-x obsbot4linux-VERSION-ARCH-linux/
obsbot4linux-VERSION-ARCH-linux.tar.gz drwxr-xr-x obsbot4linux-VERSION-ARCH-linux/
obsbot4linux-VERSION-ARCH-linux.tar.gz drwxr-xr-x obsbot4linux-VERSION-ARCH-linux/systemd/
obsbot4linux-VERSION-ARCH-linux.tar.gz drwxr-xr-x obsbot4linux-VERSION-ARCH-linux/systemd/
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.service
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.service
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/lib/systemd/user/obsbot4linux.socket
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/CHANGELOG.md
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/README.md
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/README.md
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/copyright
obsbot4linux_VERSION_ARCH.deb -rw-r--r-- ./usr/share/doc/obsbot4linux/copyright
obsbot4linux_VERSION_ARCH.deb -rwxr-xr-x ./usr/bin/obsbot4linux
obsbot4linux_VERSION_ARCH.deb -rwxr-xr-x ./usr/bin/obsbot4linux
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/bin/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/bin/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/systemd/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/systemd/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/systemd/user/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/lib/systemd/user/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/doc/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/doc/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/doc/obsbot4linux/
obsbot4linux_VERSION_ARCH.deb drwxr-xr-x ./usr/share/doc/obsbot4linux/
25 changes: 25 additions & 0 deletions scripts/groundwork/move-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Move check of the groundwork stage. Prints the lines of Rust code that differ between two
# commits, compared as a multiset: the file a line is in and the order of lines do not count,
# and `use` statements, `mod name;` declarations, `pub(crate)` / `pub(super)`, indentation and
# blank lines are set aside. A pure move prints only the structural lines its task lists.
# Usage: scripts/move-check.sh OLD_REV [NEW_REV] (NEW_REV defaults to HEAD)
set -euo pipefail
old=${1:?usage: move-check.sh OLD_REV [NEW_REV]}
new=${2:-HEAD}

lines() {
git ls-tree -r --name-only "$1" | grep '\.rs$' | while read -r f; do
git show "$1:$f"
done | awk '
in_use { if (/;[[:space:]]*$/) in_use = 0; next }
/^[[:space:]]*(pub(\([a-z]+\))? )?use / { if (!/;[[:space:]]*$/) in_use = 1; next }
/^[[:space:]]*(pub(\([a-z]+\))? )?mod [a-z0-9_]+;[[:space:]]*$/ { next }
/^[[:space:]]*$/ { next }
{ sub(/^[[:space:]]+/, ""); sub(/^pub\((crate|super)\) /, ""); print }
' | LC_ALL=C sort
}

diff <(lines "$old") <(lines "$new") | grep '^[<>]' || true
17 changes: 17 additions & 0 deletions scripts/groundwork/test-names.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Test-name guard of the groundwork stage. Lists the tests of a commit by the last two parts of
# their path (module and name, which a move keeps), sorted. Run it for the base and the head of
# a pull request and compare the two lists: a pure move changes no line.
# Usage: scripts/groundwork/test-names.sh REV > names.txt
set -euo pipefail
rev=${1:?usage: test-names.sh REV}
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
git archive "$rev" | tar -x -C "$work"
cd "$work"
CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$work/target} nice -n 19 \
cargo test --workspace --locked -q -j 3 -- --list --format terse 2>/dev/null |
awk -F': ' '$2 == "test" { n = split($1, p, "::"); print (n > 1 ? p[n - 1] "::" : "") p[n] }' |
LC_ALL=C sort
19 changes: 19 additions & 0 deletions scripts/package-contents.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Lists the files of every package a release build made: one line per entry, "<package>
# <mode> <path>", sorted, with the version replaced by VERSION and the architecture by ARCH,
# so that two builds can be compared. The release workflow compares the list with
# packaging/contents.txt. Needs bsdtar (libarchive).
# Usage: scripts/package-contents.sh DIR X.Y.Z (DIR holds the obsbot4linux* packages)
set -eu
dir=${1:?usage: package-contents.sh DIR X.Y.Z}
ver=${2:?usage: package-contents.sh DIR X.Y.Z}

find "$dir" -type f -name 'obsbot4linux*' | while read -r pkg; do
name=$(basename "$pkg")
case $name in
*.deb) bsdtar -xOf "$pkg" 'data.tar*' | bsdtar -tvf - ;;
*) bsdtar -tvf "$pkg" ;;
esac | awk -v p="$name" '{ print p, $1, $NF }'
done | sed -e "s/$ver/VERSION/g" -e 's/x86_64\|aarch64\|amd64\|arm64/ARCH/g' | LC_ALL=C sort
Loading