-
Notifications
You must be signed in to change notification settings - Fork 228
60 lines (56 loc) · 1.52 KB
/
unit-tests.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
name: UnitTests
on:
push:
# Only trigger on branches, not on tags
branches:
- 'main'
- 'develop'
paths-ignore:
- '.github/**'
- 'docs/**'
- 'README.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip stuff
- name: Install Swirl
run: ./install.sh
- name: Install pytest unit tests
run: ./install-test.sh
- name: Run pytest unit tests
run: pytest
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Set branch name
id: extract_branch
run: |
BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3)
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV
- name: Write branch and run_id to file
run: |
echo "${{ env.branch }}" > ./artifacts/branch.txt
echo "${{ github.run_id }}" > ./artifacts/run_id.txt
- name: Upload branch and run_id files as artifact
uses: actions/upload-artifact@v3
with:
name: branch-info-${{ github.run_id }}
path: |
./artifacts/branch.txt
./artifacts/run_id.txt
- name: Upload log files
if: always()
uses: actions/upload-artifact@v3
with:
name: log-files
path: |
logs/
/var/log/syslog*