89 lines
2.2 KiB
YAML
89 lines
2.2 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
|
|
|
|
- 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.FORGEJO_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
|