Skip to content

Commit 570e5f7

Browse files
authored
Update ci.yml
1 parent 534a4df commit 570e5f7

File tree

1 file changed

+30
-76
lines changed

1 file changed

+30
-76
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,44 @@
1-
name: CI Pipeline
1+
name: RideSharing CI
22

33
on:
44
push:
5-
branches: [ "*" ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ "*" ]
7+
branches: [ main ]
88

99
jobs:
10-
11-
# =======================================================
12-
# 1. Python Lint + Test Job
13-
# =======================================================
14-
tests:
10+
build-and-test:
1511
runs-on: ubuntu-latest
16-
timeout-minutes: 10
17-
18-
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v3
21-
22-
- name: Set up Python
23-
uses: actions/setup-python@v4
24-
with:
25-
python-version: '3.10'
26-
27-
- name: Cache pip packages
28-
uses: actions/cache@v3
29-
with:
30-
path: ~/.cache/pip
31-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
32-
restore-keys: |
33-
${{ runner.os }}-pip-
34-
35-
- name: Install dependencies
36-
run: |
37-
pip install --upgrade pip
38-
pip install -r requirements.txt
39-
pip install black flake8 pytest
4012

41-
- name: Lint with flake8
42-
run: |
43-
flake8 src || true
44-
45-
- name: Format check with black
46-
run: |
47-
black --check src
48-
49-
- name: Run unit tests
50-
run: |
51-
pytest -q
52-
53-
54-
# =======================================================
55-
# 2. Docker Build Job
56-
# =======================================================
57-
docker-build:
58-
runs-on: ubuntu-latest
59-
needs: tests
60-
timeout-minutes: 15
13+
services:
14+
postgres:
15+
image: postgres:15
16+
ports:
17+
- 5432:5432
18+
env:
19+
POSTGRES_DB: rides
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: postgres
22+
23+
redis:
24+
image: redis:7
25+
ports:
26+
- 6379:6379
6127

6228
steps:
63-
- name: Checkout repository
64-
uses: actions/checkout@v3
65-
66-
- name: Set up Docker Buildx
67-
uses: docker/setup-buildx-action@v2
29+
- uses: actions/checkout@v3
6830

69-
- name: Cache Docker layers
70-
uses: actions/cache@v3
71-
with:
72-
path: /tmp/.buildx-cache
73-
key: ${{ runner.os }}-buildx-${{ github.sha }}
74-
restore-keys: |
75-
${{ runner.os }}-buildx-
31+
- name: Set up Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: "3.11"
7635

77-
- name: Build Driver Location Service image
78-
run: |
79-
docker build \
80-
-f src/driver-location-service/Dockerfile \
81-
-t driver-location-service .
36+
- name: Install dependencies
37+
run: |
38+
pip install -r requirements.txt
8239
83-
- name: Build Dispatch Service image
84-
run: |
85-
docker build \
86-
-f src/dispatch-service/Dockerfile \
87-
-t dispatch-service .
40+
- name: Run Tests
41+
run: pytest --cov=services tests/
8842

89-
- name: List built Docker images
90-
run: docker images
43+
- name: Build Docker Images
44+
run: docker-compose build

0 commit comments

Comments
 (0)