-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (119 loc) · 3.72 KB
/
Copy pathci.yml
File metadata and controls
125 lines (119 loc) · 3.72 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Python lint deps
run: pip install flake8==7.1.1
- name: Python lint
run: flake8 src test --max-line-length=150 --exclude=src/vendor --ignore=E501,W503,E402,E722 || true
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '18'
- name: JavaScript lint
run: |
npm init -y >/dev/null 2>&1
npm install eslint@9.0.0 >/dev/null 2>&1
npx eslint src/ test/ || true
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Python unit tests
run: |
pip install pytest==8.3.3 reportlab pymysql >/dev/null 2>&1
PYTHONPATH=src python -m pytest test/unit/ -v --tb=short || true
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '18'
- name: JS tests
run: |
for f in test/unit/*.test.js; do
echo "--- Running $f ---"
node "$f" || true
done
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '18'
- name: Install Python deps
run: pip install pymysql reportlab pytest
- name: Run integration tests
run: make check || true
db-integration:
name: Database Integration Test
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.11
env:
MYSQL_ROOT_PASSWORD: testpass
MYSQL_DATABASE: slurm_acct_db
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install deps
run: pip install pymysql reportlab
- name: Install MySQL client
run: sudo apt-get update && sudo apt-get install -y default-mysql-client
- name: Load test schema
run: mysql -h 127.0.0.1 -u root -ptestpass slurm_acct_db < test/example_slurmdb_for_testing.sql
- name: Create test slurmdbd.conf
run: |
mkdir -p /tmp/slurm
cat > /tmp/slurm/slurmdbd.conf << 'EOF'
StorageType=accounting_storage/mysql
StorageHost=127.0.0.1
StoragePort=3306
StorageUser=root
StoragePass=testpass
StorageLoc=slurm_acct_db
EOF
- name: Run slurmdb.py integration test
run: |
PYTHONPATH=src python3 src/slurmdb.py \
--conf /tmp/slurm/slurmdbd.conf \
--start 2024-01-01 --end 2024-12-31 \
--output - | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'OK: {len(d.get(\"details\",[]))} accounts')"
echo "Database integration test passed"
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Bandit
run: pip install bandit==1.8.0
- name: Run Bandit
run: bandit -r src --skip B404,B603,B607 || true