Files
NilsBriggenandClaude Opus 5.5 95b828cb5e
CI / check (push) Failing after 1m36s
CI / release (push) Skipped
CI: pin Rust 1.96.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:18:37 +02:00

75 lines
3.4 KiB
YAML

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: System packages
run: |
SUDO=$(command -v sudo || true)
$SUDO apt-get update
$SUDO apt-get install -y --no-install-recommends \
build-essential pkg-config curl ca-certificates python3 git \
libasound2-dev libpulse-dev desktop-file-utils appstream
- name: Rust
# Pinned: a newer rustfmt or clippy would fail on code that was fine
# yesterday. Raise it on purpose, together with any fixes.
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.96.0 --component rustfmt,clippy
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- run: cargo fmt --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked
- name: Translations are extracted
run: python3 scripts/i18n-extract.py && git diff --exit-code locales/en.json
- run: desktop-file-validate packaging/dev.briggen.Slidewire.desktop
- name: AppStream metadata
# Older appstream releases don't know every tag; the file is checked locally too.
continue-on-error: true
run: appstreamcli validate --no-net packaging/dev.briggen.Slidewire.metainfo.xml
- name: Dependency licences and advisories
run: |
curl -sSfL https://github.com/EmbarkStudios/cargo-deny/releases/download/0.18.3/cargo-deny-0.18.3-x86_64-unknown-linux-musl.tar.gz \
| tar xz --strip-components=1 -C "$HOME/.cargo/bin" cargo-deny-0.18.3-x86_64-unknown-linux-musl/cargo-deny
cargo deny --locked check
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: System packages
run: |
SUDO=$(command -v sudo || true)
$SUDO apt-get update
$SUDO apt-get install -y --no-install-recommends \
build-essential pkg-config curl ca-certificates python3 jq libasound2-dev libpulse-dev
- name: Rust
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.96.0
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Build the release archive
run: scripts/release-tarball.sh
- name: Attach to the release
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
api="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
tag="${GITHUB_REF_NAME}"
id=$(curl -sf -H "Authorization: token $TOKEN" "$api/releases/tags/$tag" | jq -r .id || true)
if [ -z "$id" ] || [ "$id" = null ]; then
notes=$(python3 -c "import re,sys; t=open('CHANGELOG.md').read(); v=sys.argv[1].lstrip('v'); m=re.search(r'^## \[' + re.escape(v) + r'\][^\n]*\n(.*?)(?=^## \[|^\[)', t, re.S | re.M); print(m.group(1).strip() if m else '')" "$tag")
id=$(jq -n --arg tag "$tag" --arg body "$notes" '{tag_name: $tag, name: $tag, body: $body}' \
| curl -sf -H "Authorization: token $TOKEN" -H "Content-Type: application/json" -d @- "$api/releases" | jq -r .id)
fi
for f in dist/*; do
curl -sf -H "Authorization: token $TOKEN" -F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")" >/dev/null
done