Skip to content

Make linkblocks REUSE-compliant #325

Make linkblocks REUSE-compliant

Make linkblocks REUSE-compliant #325

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-D warnings"
jobs:
build-lint:
name: Build & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Setup node
uses: actions/setup-node@v4
# this is needed because `npx` won't install prettier plugins
- name: Install node dependencies
run: npm install
- name: Install REUSE tool
run: sudo apt-get install reuse
- name: Install cargo-run-bin
run: cargo install cargo-run-bin
- run: cargo bin just format
- run: cargo bin just lint
- run: cargo bin just generate-sbom
- name: Check for file changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "::error::Detected changes in the following files:"
git status --porcelain
echo "Diff:"
git diff
exit 1
fi
- run: cargo build --release
env:
SQLX_OFFLINE: true
- name: podman login
env:
USER: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: podman login --username "$USER" --password "$PASSWORD" ghcr.io
- name: podman build linux/amd64
run: podman build --format docker --platform linux/amd64 --manifest linkblocks -f Containerfile target/release
- name: podman manifest push latest
run: podman manifest push linkblocks ghcr.io/raffomania/linkblocks:latest
if: github.ref == 'refs/heads/main'
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
SQLX_OFFLINE: true