refactor: ci/cd
Browse files- .github/workflows/ci.yml +1 -1
- .github/workflows/docker.yml +9 -17
.github/workflows/ci.yml
CHANGED
|
@@ -54,7 +54,7 @@ jobs:
|
|
| 54 |
poetry run pytest --cov=llmdataparser --cov-report=xml
|
| 55 |
|
| 56 |
- name: Upload coverage to Codecov
|
| 57 |
-
uses: codecov/codecov-action@
|
| 58 |
with:
|
| 59 |
token: ${{ secrets.CODECOV_TOKEN }}
|
| 60 |
file: ./coverage.xml
|
|
|
|
| 54 |
poetry run pytest --cov=llmdataparser --cov-report=xml
|
| 55 |
|
| 56 |
- name: Upload coverage to Codecov
|
| 57 |
+
uses: codecov/codecov-action@v5
|
| 58 |
with:
|
| 59 |
token: ${{ secrets.CODECOV_TOKEN }}
|
| 60 |
file: ./coverage.xml
|
.github/workflows/docker.yml
CHANGED
|
@@ -9,32 +9,22 @@ on:
|
|
| 9 |
- "docker-compose.yml"
|
| 10 |
- "pyproject.toml"
|
| 11 |
- "poetry.lock"
|
| 12 |
-
pull_request:
|
| 13 |
-
branches: [main]
|
| 14 |
-
paths:
|
| 15 |
-
- "Dockerfile"
|
| 16 |
-
- ".dockerignore"
|
| 17 |
-
- "docker-compose.yml"
|
| 18 |
-
- "pyproject.toml"
|
| 19 |
-
- "poetry.lock"
|
| 20 |
|
| 21 |
jobs:
|
| 22 |
docker:
|
| 23 |
-
# Only run this job if:
|
| 24 |
-
# 1. It's a push to main (merge), OR
|
| 25 |
-
# 2. It's a pull request
|
| 26 |
-
if: github.event_name == 'push' || github.event_name == 'pull_request'
|
| 27 |
runs-on: ubuntu-latest
|
| 28 |
steps:
|
| 29 |
- name: Checkout
|
| 30 |
uses: actions/checkout@v4
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
- name: Set up Docker Buildx
|
| 33 |
uses: docker/setup-buildx-action@v3
|
| 34 |
|
| 35 |
-
# Only run Docker login and push when merging to main
|
| 36 |
- name: Login to Docker Hub
|
| 37 |
-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 38 |
uses: docker/login-action@v3
|
| 39 |
with:
|
| 40 |
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
@@ -44,8 +34,10 @@ jobs:
|
|
| 44 |
uses: docker/build-push-action@v5
|
| 45 |
with:
|
| 46 |
context: .
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
| 50 |
cache-from: type=registry,ref=jeff52415/llmdataparser:latest
|
| 51 |
cache-to: type=inline
|
|
|
|
|
|
| 9 |
- "docker-compose.yml"
|
| 10 |
- "pyproject.toml"
|
| 11 |
- "poetry.lock"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
jobs:
|
| 14 |
docker:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
runs-on: ubuntu-latest
|
| 16 |
steps:
|
| 17 |
- name: Checkout
|
| 18 |
uses: actions/checkout@v4
|
| 19 |
|
| 20 |
+
- name: Get version from pyproject.toml
|
| 21 |
+
run: |
|
| 22 |
+
echo "VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)" >> $GITHUB_ENV
|
| 23 |
+
|
| 24 |
- name: Set up Docker Buildx
|
| 25 |
uses: docker/setup-buildx-action@v3
|
| 26 |
|
|
|
|
| 27 |
- name: Login to Docker Hub
|
|
|
|
| 28 |
uses: docker/login-action@v3
|
| 29 |
with:
|
| 30 |
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
| 34 |
uses: docker/build-push-action@v5
|
| 35 |
with:
|
| 36 |
context: .
|
| 37 |
+
push: true
|
| 38 |
+
tags: |
|
| 39 |
+
jeff52415/llmdataparser:latest
|
| 40 |
+
jeff52415/llmdataparser:v${{ env.VERSION }}
|
| 41 |
cache-from: type=registry,ref=jeff52415/llmdataparser:latest
|
| 42 |
cache-to: type=inline
|
| 43 |
+
platforms: linux/amd64,linux/arm64
|