11
11
jobs :
12
12
setup :
13
13
runs-on : ubuntu-latest
14
- outputs :
15
- cache-hit : ${{ steps.cache-deps.outputs.cache-hit }}
16
14
strategy :
17
15
matrix :
18
16
python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
37
35
with :
38
36
python-version : ${{ matrix.python-version }}
39
37
40
- # Step 4: Cache dependencies
41
- - name : Cache dependencies
42
- id : cache-deps
43
- uses : actions/cache@v3
44
- with :
45
- path : ~/.cache/pip
46
- key : pip-cache-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
47
-
48
- # Step 5: Install dependencies if not cached
49
- - name : Install dependencies
50
- if : steps.cache-deps.outputs.cache-hit != 'true'
51
- run : |
52
- python -m pip install --upgrade pip
53
- pip install setuptools wheel
54
- pip install .
55
- pip install pytest
56
-
57
38
# Step 6: Create .env file
58
39
- name : Create .env file
59
40
run : |
76
57
- name : Verify .env file
77
58
run : cat .env
78
59
79
- test :
80
- needs : setup # Ensure setup is completed before running tests
81
- runs-on : ubuntu-latest
82
- strategy :
83
- matrix :
84
- python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
85
- fail-fast : false # Ensures all test jobs run even if one fails
86
-
87
- steps :
88
- # Step 1: Checkout correct branch
89
- - name : Checkout Code
90
- uses : actions/checkout@v3
91
- with :
92
- ref : 315-Unittest-via-Github-actions # Ensure correct branch
93
-
94
- # Step 2: Restore Cached Dependencies
95
- - name : Restore Cached Dependencies
96
- uses : actions/cache@v3
97
- with :
98
- path : ~/.cache/pip
99
- key : pip-cache-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
100
-
101
- # Step 3: Set up Python
102
- - name : Set up Python ${{ matrix.python-version }}
103
- uses : actions/setup-python@v4
104
- with :
105
- python-version : ${{ matrix.python-version }}
106
-
107
- # Step 4: Install dependencies (if cache is empty)
108
- - name : Install dependencies (if needed)
109
- run : |
110
- python -m pip install --upgrade pip
111
- pip install setuptools wheel
112
- pip install .
113
- pip install pytest
114
-
115
60
# Step 8: Start FIWARE services
116
61
- name : Start FIWARE Services
117
62
run : |
@@ -127,9 +72,23 @@ jobs:
127
72
curl -s http://localhost:8668/version && break || sleep 5
128
73
done
129
74
75
+ # Step 4: Install dependencies (if cache is empty)
76
+ - name : Install dependencies (if needed)
77
+ run : |
78
+ python -m pip install --upgrade pip
79
+ pip install setuptools wheel
80
+ pip install .
81
+ pip install pytest
82
+
130
83
# Step 10: Debug - Show Running Docker Containers
131
84
- name : Debug - Show Running Docker Containers
132
85
run : docker ps -a
86
+
87
+ # Step 6: Navigate back to tests folder
88
+ - name : Navigate to Tests Folder
89
+ run : |
90
+ cd $GITHUB_WORKSPACE
91
+ ls -la
133
92
134
93
# Step 6: Run Tests
135
94
- name : Run tests with unittest and pytest
0 commit comments