-
Notifications
You must be signed in to change notification settings - Fork 28
130 lines (111 loc) · 3.96 KB
/
validate-problems.yml
File metadata and controls
130 lines (111 loc) · 3.96 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
126
127
128
129
130
name: Validate Problems
on:
pull_request:
paths:
- 'algorithmic/problems/**'
- 'research/problems/**'
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
algorithmic: ${{ steps.detect.outputs.algorithmic }}
research: ${{ steps.detect.outputs.research }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Detect changed problems
id: detect
run: |
# Detect changed algorithmic problems
ALG=$(python scripts/detect_changed_problems.py --track algorithmic --base-ref origin/${{ github.base_ref }} -v 2>&1 | tail -1)
echo "algorithmic=$ALG" >> $GITHUB_OUTPUT
echo "Algorithmic problems: $ALG"
# Detect changed research problems
RES=$(python scripts/detect_changed_problems.py --track research --base-ref origin/${{ github.base_ref }} -v 2>&1 | tail -1)
echo "research=$RES" >> $GITHUB_OUTPUT
echo "Research problems: $RES"
validate-algorithmic:
needs: detect-changes
if: needs.detect-changes.outputs.algorithmic != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: uv sync
- name: Validate problems
run: |
echo "Validating algorithmic problems: ${{ needs.detect-changes.outputs.algorithmic }}"
uv run python scripts/validate_problems.py \
--track algorithmic \
--problems ${{ needs.detect-changes.outputs.algorithmic }}
validate-research:
needs: detect-changes
if: needs.detect-changes.outputs.research != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: uv sync
- name: Setup AWS credentials
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = $AWS_ACCESS_KEY_ID
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
EOF
cat > ~/.aws/config << EOF
[default]
region = us-east-1
EOF
echo "AWS credentials configured"
- name: Setup GCP credentials
env:
GCP_CREDS: ${{ secrets.GCP_CREDENTIALS }}
run: |
if [ -n "$GCP_CREDS" ]; then
echo "$GCP_CREDS" > /tmp/gcp-key.json
echo "GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp-key.json" >> $GITHUB_ENV
gcloud auth activate-service-account --key-file=/tmp/gcp-key.json
gcloud config set project ${{ secrets.GCP_PROJECT_ID }}
echo "GCP credentials configured"
fi
- name: Generate SSH key for SkyPilot
run: |
mkdir -p ~/.ssh
if [ ! -f ~/.ssh/sky-key ]; then
ssh-keygen -t rsa -b 4096 -f ~/.ssh/sky-key -N "" -C "sky-ci"
echo "Generated SSH key for SkyPilot"
fi
- name: Setup SkyPilot
run: |
uv run sky check aws gcp || echo "SkyPilot check failed, continuing..."
- name: Validate problems
timeout-minutes: 30
run: |
echo "Validating research problems: ${{ needs.detect-changes.outputs.research }}"
uv run python scripts/validate_problems.py \
--track research \
--timeout 1200 \
--problems ${{ needs.detect-changes.outputs.research }} \
--verbose