-
Notifications
You must be signed in to change notification settings - Fork 17
38 lines (31 loc) · 1.03 KB
/
test-python.yml
File metadata and controls
38 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Run Tests in Docker
on:
workflow_call:
jobs:
test:
name: Run Pytest in Docker
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Cache Docker layers for faster builds
# This helps avoid redundant builds if Docker images haven't changed
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.buildx-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
# Step 3: Make docker.sh executable
- name: Ensure docker.sh is executable
run: chmod +x ./docker.sh
# Step 4: Build Docker Images for Testing
# Using docker-compose.test.yml config
- name: Build Docker for Testing
run: MODE=test ./docker.sh build
# Step 5: Run Pytest in Docker
- name: Run Tests with Pytest
run: |
MODE=test ./docker.sh run --rm test pytest tests