-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.25 KB
/
unittests.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
# .github/workflows/python-tests.yml
name: Unit Tests
on:
push:
branches:
- '*' # Trigger on push to all branches
jobs:
test:
runs-on: ubuntu-latest # The environment to run the job in
steps:
- name: Checkout code
uses: actions/checkout@v3 # Checkout the repository code
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Specify the Python version to use
- name: Install dependencies
run: |
if [ -f requirements.txt ]; then
echo "requirements.txt found, installing dependencies..."
python -m pip install --upgrade pip
pip install -r requirements.txt
else
echo "requirements.txt not found, skipping dependency installation."
fi
- name: Run tests
run: |
mkdir -p test-results # Create directory for test results
python -m unittest discover -s tests -p "*test.py" | tee test-results/test_output.log
# Here, we're redirecting output to a log file in the test-results directory
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: unittest-results
path: test-results/test_output.log