wip: Add SBOM #313
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Install cargo-cyclonedx | |
run: cargo install [email protected] | |
- name: Install just | |
run: cargo install [email protected] | |
- run: cargo build --release | |
env: | |
SQLX_OFFLINE: true | |
- run: just format | |
- run: just lint | |
- run: 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 | |
exit 1 | |
fi | |
- 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 |