forked from innovacion/searchbox
Add CI
This commit is contained in:
31
.github/workflows/ci.yaml
vendored
Normal file
31
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6.5.0
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --locked --all-extras --dev
|
||||
|
||||
- name: Run formatter
|
||||
run: uv run ruff format --check
|
||||
|
||||
- name: Run linter
|
||||
run: uv run ruff check
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: uv run pytest
|
||||
64
.github/workflows/deploy.yaml
vendored
Normal file
64
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: ./.github/workflows/ci.yaml
|
||||
|
||||
push:
|
||||
needs: ci
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.ia-innovacion.work
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: gitea.ia-innovacion.work/innovacion/searchbox-mcp
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
# deploy:
|
||||
# needs: release
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Install kubectl
|
||||
# uses: azure/setup-kubectl@v3
|
||||
|
||||
# - name: Deploy to cluster
|
||||
# env:
|
||||
# KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG_CONTENT }}
|
||||
# run: |
|
||||
# echo "$KUBECONFIG_CONTENT" > kubeconfig
|
||||
# export KUBECONFIG=$PWD/kubeconfig
|
||||
# kubectl apply -f .k8s/
|
||||
# kubectl rollout restart deployment/python-demo
|
||||
# kubectl rollout status deployment/python-demo
|
||||
36
.github/workflows/release.yaml
vendored
Normal file
36
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: ./.github/workflows/ci.yaml
|
||||
|
||||
release:
|
||||
needs: ci
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6.5.0
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --locked
|
||||
|
||||
- name: Build package
|
||||
run: uv build
|
||||
|
||||
- name: Publish to registry
|
||||
env:
|
||||
UV_PUBLISH_URL: ${{ vars.UV_PUBLISH_URL }}
|
||||
UV_PUBLISH_USERNAME: ${{ vars.UV_PUBLISH_USERNAME }}
|
||||
UV_PUBLISH_PASSWORD: ${{ secrets.UV_PUBLISH_PASSWORD }}
|
||||
run: uv publish
|
||||
Reference in New Issue
Block a user