Mercury/.forgejo/workflows/ci.yml
Matthew L McPeak 0b18ef0164
Some checks failed
ci / build-ui (push) Failing after 6s
ci / test (push) Successful in 2m56s
ci / publish (push) Has been skipped
fix: ci
2026-06-17 16:07:11 -04:00

93 lines
2.8 KiB
YAML

name: ci
on:
push:
tags:
- "v*"
pull_request:
jobs:
test:
runs-on: self-hosted
container: git.mcpeakdev.com/mcpeakdev/rust-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test
build-ui:
runs-on: self-hosted
container: git.mcpeakdev.com/mcpeakdev/bun-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: bun install --frozen-lockfile
working-directory: ui
env:
BUN_AUTH_TOKEN: ${{ secrets.BUN_AUTH_TOKEN }}
- name: Audit dependencies
run: bun audit || true
working-directory: ui
- name: Type check
run: bun run build
working-directory: ui
publish:
needs: [test, build-ui]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: self-hosted
container: git.mcpeakdev.com/mcpeakdev/docker-pub:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: git.mcpeakdev.com
username: ${{ github.actor }}
password: ${{ secrets.BUN_AUTH_TOKEN }}
- name: Extract image tag
id: meta
run: echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: |
git.mcpeakdev.com/mcpeakdev/mercury:${{ steps.meta.outputs.tag }}
git.mcpeakdev.com/mcpeakdev/mercury:latest
cache-from: type=registry,ref=git.mcpeakdev.com/mcpeakdev/mercury:latest
cache-to: type=inline
secrets: |
bun_auth_token=${{ secrets.BUN_AUTH_TOKEN }}