Skip to content
Closed

dev #62

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.git

/target

.env
107 changes: 107 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI/CD

permissions:
contents: read
packages: write

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Cache system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libtesseract-dev libleptonica-dev libclang-dev
version: 1.0

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Format
run: cargo fmt --all -- --check

- name: Lint
run: cargo clippy --workspace --all-features --all-targets -- -D warnings

- name: Build
run: cargo build --workspace --all-features --all-targets

- name: Test
run: cargo test --workspace --all-features --all-targets

- name: Verify Documentation
run: cargo doc --no-deps --all-features --document-private-items

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
cache-from: type=gha
cache-to: type=gha,mode=max

publish-docker:
name: Publish Docker image
needs: ci
if: github.ref_name == 'main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v6

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

deploy-docker:
name: Deploy Docker image to Production Server
needs: publish-docker
if: github.ref_name == 'main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v6

- name: Copy compose file to server
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_SSH_KEY }}
source: compose.yaml
target: /opt/${{ github.event.repository.name }}/

- name: Deploy via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_SSH_KEY }}
script: docker compose -f /opt/${{ github.event.repository.name }}/compose.yaml up -d --pull always
90 changes: 0 additions & 90 deletions .github/workflows/ci.yaml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/deploy.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/publish.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions CLAUDE.md

This file was deleted.

Loading