22
22
with :
23
23
python-version : 3.11 # Use Python version 3.11
24
24
25
- # Cache dependencies
26
- - name : Cache pip
27
- uses : actions/cache@v3
28
- with :
29
- path : ~/.cache/pip
30
- key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
31
- restore-keys : |
32
- ${{ runner.os }}-pip-
33
-
34
25
# Install build dependencies
35
26
- name : Install build dependencies
36
27
run : |
@@ -41,12 +32,51 @@ jobs:
41
32
- name : Install dependencies
42
33
run : pip install -r requirements.txt # Install dependencies from requirements.txt
43
34
35
+ test :
36
+ needs : setup
37
+ runs-on : ubuntu-latest
38
+ steps :
39
+ - name : Checkout code
40
+ uses : actions/checkout@v3
41
+
42
+ - name : Set up Python 3.11
43
+ uses : actions/setup-python@v3
44
+ with :
45
+ python-version : 3.11
46
+
47
+ # Install build dependencies
48
+ - name : Install build dependencies
49
+ run : |
50
+ python -m pip install --upgrade pip
51
+ pip install setuptools==58.0.4 wheel
52
+
53
+ - name : Install dependencies
54
+ run : pip install -r requirements.txt
55
+
56
+ # Run test suite
57
+ - name : Run tests
58
+ run : pytest # Execute tests using pytest
59
+
44
60
security :
45
61
needs : setup
46
62
runs-on : ubuntu-latest
47
63
steps :
48
64
- name : Checkout code
49
- uses : actions/checkout@v4
65
+ uses : actions/checkout@v3
66
+
67
+ - name : Set up Python 3.11
68
+ uses : actions/setup-python@v3
69
+ with :
70
+ python-version : 3.11
71
+
72
+ # Install build dependencies
73
+ - name : Install build dependencies
74
+ run : |
75
+ python -m pip install --upgrade pip
76
+ pip install setuptools==58.0.4 wheel
77
+
78
+ - name : Install dependencies
79
+ run : pip install -r requirements.txt
50
80
51
81
# Run security checks
52
82
- name : Run security checks
@@ -59,11 +89,26 @@ jobs:
59
89
runs-on : ubuntu-latest
60
90
steps :
61
91
- name : Checkout code
62
- uses : actions/checkout@v4
92
+ uses : actions/checkout@v3
93
+
94
+ - name : Set up Python 3.11
95
+ uses : actions/setup-python@v3
96
+ with :
97
+ python-version : 3.11
98
+
99
+ # Install build dependencies
100
+ - name : Install build dependencies
101
+ run : |
102
+ python -m pip install --upgrade pip
103
+ pip install setuptools==58.0.4 wheel
104
+
105
+ - name : Install dependencies
106
+ run : pip install -r requirements.txt
63
107
64
108
# Build the Docker image
65
109
- name : Build Docker image
66
110
run : docker build -t transcendence .
111
+ run : docker build -t transcendence .
67
112
68
113
deploy :
69
114
needs : build
84
129
85
130
# Conditional deployment based on branch
86
131
- name : Deploy to server
87
- if : github.ref == 'refs/heads/main'
88
132
run : ssh user@server "docker pull ${DOCKER_HUB_USERNAME}/transcendence:latest && docker-compose up --build -d"
89
-
90
- - name : Deploy to development server
91
- if : github.ref == 'refs/heads/develop'
92
- run : ssh user@dev-server "docker pull ${DOCKER_HUB_USERNAME}/transcendence:latest && docker-compose up --build -d"
0 commit comments