-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (83 loc) · 2.4 KB
/
behave.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
name: Run behave
on:
push:
branches:
- "**"
pull_request:
branches:
- main
- develop
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
behave:
name: Run Behave
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Cache Docker images.
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yaml') }}
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose make
- name: Check Docker state (pre-build)
run: docker ps
- name: Build Docker images
run: make build
env:
PYTHON_IMAGE_VER: "${{ matrix.python-version }}"
- name: Migrate Database
run: make migrate
- name: Run Application
run: make run
- name: Check Docker state (pre-test)
run: docker ps
- name: Run pytest + behave with Coverage
env:
POSTGRES_USER: scram
POSTGRES_DB: test_scram
run: make coverage.xml
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
- name: Upload Coverage to Coveralls
if: matrix.python-version == '3.12'
uses: coverallsapp/github-action@v2
- name: Upload Coverage to GitHub
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
- name: Display Coverage Metrics
if: matrix.python-version == '3.12'
uses: 5monkeys/cobertura-action@v14
with:
minimum_coverage: "50"
- name: Check Docker state (post-test)
if: always()
run: docker ps
- name: Stop Services
if: always()
run: make stop
- name: Clean Up
if: always()
run: make clean