forked from ambicuity/New-Grad-Jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 3.45 KB
/
ci.yml
File metadata and controls
103 lines (90 loc) · 3.45 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
name: CI — Lint & Validate
on:
pull_request:
branches: [main]
push:
branches: [main]
paths:
- 'scripts/**'
- 'config.yml'
- 'requirements.txt'
- '.github/workflows/**'
permissions: read-all
jobs:
lint-and-validate:
name: Python Lint & Syntax Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install flake8
- name: Syntax check — update_jobs.py
run: python -m py_compile scripts/update_jobs.py
- name: Syntax check — generate_companies.py
run: python -m py_compile scripts/generate_companies.py
- name: Syntax check — test_config.py
run: python -m py_compile test_config.py
- name: Syntax check — fix_nan_only.py
run: python -m py_compile scripts/fix_nan_only.py
- name: Flake8 lint (errors only, E9/F-class)
run: |
# Stop on syntax errors and undefined names only.
# Style warnings (E501 long lines, W503, etc.) are informational.
flake8 scripts/ --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Validate config.yml structure
run: |
python - <<'EOF'
import yaml, sys
with open("config.yml") as f:
config = yaml.safe_load(f)
required_keys = ["filtering", "readme"]
for key in required_keys:
if key not in config:
print(f"ERROR: Missing required top-level key in config.yml: '{key}'")
sys.exit(1)
print(f"✅ config.yml is valid YAML with all required keys.")
greenhouse = config.get("greenhouse", {}).get("companies", [])
lever = config.get("lever", {}).get("companies", [])
print(f" Greenhouse companies: {len(greenhouse)}")
print(f" Lever companies: {len(lever)}")
EOF
- name: Run unit tests
run: python test_config.py
- name: Check for duplicate API URLs in config.yml
run: |
python - <<'EOF'
import yaml, sys
with open("config.yml") as f:
config = yaml.safe_load(f)
urls = []
for section in ['greenhouse', 'lever', 'workday']:
companies = config.get('apis', config).get(section, {}).get('companies', [])
for c in companies:
url = c.get('url', c.get('workday_url', ''))
if url:
urls.append((section, c.get('name', ''), url))
seen = {}
duplicates = []
for section, name, url in urls:
if url in seen:
duplicates.append(f" DUPLICATE: {url} ({name} in {section}) already defined as {seen[url]}")
else:
seen[url] = f"{name} in {section}"
if duplicates:
print("❌ Duplicate API URLs found in config.yml:")
for d in duplicates:
print(d)
sys.exit(1)
print(f"✅ No duplicate URLs found across {len(urls)} entries.")
EOF