Skip to content

Commit 559146b

Browse files
authored
Create ci.yml
1 parent c2b37d9 commit 559146b

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/ci.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI/CD
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build-and-test:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
python-version: ["3.12"]
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
19+
- name: Cache dependencies
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.cache/pip
23+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
24+
restore-keys: |
25+
${{ runner.os }}-pip-
26+
27+
- name: Install dependencies
28+
run: |
29+
make install
30+
31+
- name: Run code formatting check
32+
run: |
33+
make format
34+
35+
- name: Run linting
36+
run: |
37+
make lint
38+
39+
- name: Lint Dockerfiles
40+
run: |
41+
docker run --rm -i hadolint/hadolint < Dockerfile.app
42+
docker run --rm -i hadolint/hadolint < Dockerfile.ollama
43+
44+
docker-build:
45+
needs: build-and-test
46+
runs-on: ubuntu-latest
47+
if: github.ref == 'refs/heads/main'
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v1
54+
55+
- name: Build Docker images
56+
env:
57+
AT_USERNAME: ${{ secrets.AT_USERNAME }}
58+
AT_API_KEY: ${{ secrets.AT_API_KEY }}
59+
run: |
60+
make docker_build
61+
- name: Cleanup Docker resources
62+
run: |
63+
docker-compose down --remove-orphans

0 commit comments

Comments
 (0)