130 lines
4.4 KiB
YAML
130 lines
4.4 KiB
YAML
name: e2e
|
|
|
|
# Kept off the per-push gate deliberately — DESIGN.md §12. Runs on main, and on
|
|
# pull requests that touch the crates whose seams these tests cover.
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
paths:
|
|
- 'crates/arr-e2e/**'
|
|
- 'crates/arr-dl/**'
|
|
- 'crates/arr-indexer/**'
|
|
- 'crates/arr-meta/**'
|
|
- 'crates/arr-probe/**'
|
|
- 'crates/arr-subs/**'
|
|
- 'crates/arr-api/**'
|
|
- 'crates/arr-daemon/**'
|
|
- '.gitea/workflows/e2e.yml'
|
|
|
|
# The qBittorrent container below has a fixed name and binds the runner host's
|
|
# port 8080, so two runs at once would trip over each other.
|
|
concurrency:
|
|
group: arr-e2e
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_PROFILE_DEV_DEBUG: "0"
|
|
|
|
jobs:
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build deps and ffmpeg
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
git curl ca-certificates build-essential pkg-config ffmpeg
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Toolchain
|
|
run: |
|
|
if ! command -v cargo >/dev/null; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --profile minimal --no-modify-path
|
|
fi
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: nextest
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
command -v cargo-nextest >/dev/null || \
|
|
curl -LsSf https://get.nexte.st/latest/linux \
|
|
| tar zxf - -C "$HOME/.cargo/bin"
|
|
|
|
- name: alass
|
|
# No distro package; the subtitle sync path (DESIGN.md §15) shells
|
|
# out to a binary literally named `alass`, which the crate is not.
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
command -v alass >/dev/null || {
|
|
cargo install alass-cli --locked
|
|
ln -sf "$HOME/.cargo/bin/alass-cli" "$HOME/.cargo/bin/alass"
|
|
}
|
|
|
|
- name: qBittorrent
|
|
# Not a `services:` container: qBittorrent has no environment
|
|
# variable for the WebUI password and prints a random one per boot,
|
|
# so the only scriptable login is a config seeded before first start,
|
|
# which a service container cannot be given.
|
|
#
|
|
# `docker` here talks to the runner host's daemon, so a bind mount
|
|
# would name a host path this job never wrote. The config is copied
|
|
# in instead. A container left by a run that died before teardown is
|
|
# removed first; the name is fixed, so it would block every run after.
|
|
run: |
|
|
docker rm -f arr-e2e-qbittorrent >/dev/null 2>&1 || true
|
|
mkdir -p /tmp/qbt/config/qBittorrent
|
|
cat > /tmp/qbt/config/qBittorrent/qBittorrent.conf <<'CONF'
|
|
[Preferences]
|
|
WebUI\Port=8080
|
|
WebUI\AuthSubnetWhitelistEnabled=true
|
|
WebUI\AuthSubnetWhitelist=0.0.0.0/0
|
|
WebUI\CSRFProtection=false
|
|
WebUI\HostHeaderValidation=false
|
|
Downloads\SavePath=/downloads
|
|
CONF
|
|
docker create --name arr-e2e-qbittorrent --network host \
|
|
-e PUID=1000 -e PGID=1000 -e WEBUI_PORT=8080 \
|
|
linuxserver/qbittorrent:latest
|
|
docker cp /tmp/qbt/config/. arr-e2e-qbittorrent:/config/
|
|
docker start arr-e2e-qbittorrent
|
|
for _ in $(seq 1 60); do
|
|
curl -sf http://127.0.0.1:8080/api/v2/app/version && exit 0
|
|
sleep 2
|
|
done
|
|
echo "qBittorrent never answered" >&2
|
|
docker logs arr-e2e-qbittorrent >&2 || true
|
|
exit 1
|
|
|
|
- name: build daemon
|
|
# The harness spawns this binary; building it here keeps the compile
|
|
# out of the first test's boot window. `translate-command` is the
|
|
# subtitle e2e scenarios' stub-script translation backend.
|
|
run: cargo build -p arr-daemon --bin arr --features translate-command
|
|
|
|
- name: e2e
|
|
env:
|
|
QBITTORRENT_URL: http://127.0.0.1:8080
|
|
run: cargo nextest run -p arr-e2e
|
|
|
|
- name: stop qBittorrent
|
|
if: always()
|
|
run: docker rm -f arr-e2e-qbittorrent >/dev/null 2>&1 || true
|