fix: ci
This commit is contained in:
parent
034cd4df8c
commit
d9d9c033bb
1 changed files with 76 additions and 71 deletions
|
|
@ -1,89 +1,94 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
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
|
||||
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: 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: Check formatting
|
||||
run: cargo fmt --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
- name: Clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
- 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
|
||||
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: Inject bunfig.toml
|
||||
run: printf '[install.scopes]\n"@nychthemeron" = { token = "${BUN_AUTH_TOKEN}", url = "https://git.mcpeakdev.com/api/packages/McPeakDev/npm/" }\n' > /root/.bunfig.toml
|
||||
env:
|
||||
BUN_AUTH_TOKEN: ${{ secrets.BUN_AUTH_TOKEN }}
|
||||
|
||||
- name: Audit dependencies
|
||||
run: bun audit || true
|
||||
working-directory: ui
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
working-directory: ui
|
||||
|
||||
- name: Type check
|
||||
run: bun run build
|
||||
working-directory: ui
|
||||
- name: Audit dependencies
|
||||
run: bun audit || true
|
||||
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: Type check
|
||||
run: bun run build
|
||||
working-directory: ui
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
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: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mcpeakdev.com
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract image tag
|
||||
id: meta
|
||||
run: echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mcpeakdev.com
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- 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
|
||||
- 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue