@@ -2,9 +2,19 @@ name: Tests
2
2
3
3
on :
4
4
push :
5
- branches : [main, develop, findhao/setup_ci, findhao/add_linter]
5
+ branches : [main, develop, findhao/add_linter]
6
+ paths-ignore :
7
+ - " website/**"
8
+ - " docs/**"
9
+ - " *.md"
10
+ - " .gitignore"
6
11
pull_request :
7
12
branches : [main]
13
+ paths-ignore :
14
+ - " website/**"
15
+ - " docs/**"
16
+ - " *.md"
17
+ - " .gitignore"
8
18
workflow_dispatch :
9
19
inputs :
10
20
test-type :
34
44
with :
35
45
python-version : " 3.11"
36
46
37
- - name : Cache pip dependencies
38
- uses : actions/cache@v3
39
- with :
40
- path : ~/.cache/pip
41
- key : ${{ runner.os }}-pip-format-${{ hashFiles('**/pyproject.toml') }}
42
- restore-keys : |
43
- ${{ runner.os }}-pip-format-
44
-
45
47
- name : Install development dependencies
46
48
run : |
47
49
make install-dev
66
68
with :
67
69
python-version : " 3.11"
68
70
71
+ - name : Get daily cache timestamp
72
+ id : daily-cache
73
+ run : |
74
+ # Calculate date (e.g., 2024-01-15) for daily cache expiration
75
+ DATE_STAMP=$(date +"%Y-%m-%d")
76
+ echo "date=$DATE_STAMP" >> $GITHUB_OUTPUT
77
+ echo "Using daily cache stamp: $DATE_STAMP"
78
+
79
+ - name : Get weekly cache timestamp
80
+ id : weekly-cache
81
+ run : |
82
+ # Calculate year-week (e.g., 2024-03) for weekly cache expiration
83
+ WEEK_STAMP=$(date +"%Y-%U")
84
+ echo "week=$WEEK_STAMP" >> $GITHUB_OUTPUT
85
+ echo "Using weekly cache stamp: $WEEK_STAMP"
86
+
87
+ - name : Cache pip dependencies
88
+ uses : actions/cache@v3
89
+ with :
90
+ path : ~/.cache/pip
91
+ key : ${{ runner.os }}-pip-3.11-${{ steps.daily-cache.outputs.date }}
92
+ restore-keys : |
93
+ ${{ runner.os }}-pip-3.11-
94
+
95
+ - name : Cache APT packages
96
+ uses : actions/cache@v3
97
+ with :
98
+ path : |
99
+ /var/cache/apt/archives
100
+ /var/lib/apt/lists
101
+ key : ${{ runner.os }}-apt-${{ hashFiles('.ci/setup.sh') }}-${{ steps.weekly-cache.outputs.week }}
102
+ restore-keys : |
103
+ ${{ runner.os }}-apt-${{ hashFiles('.ci/setup.sh') }}-
104
+ ${{ runner.os }}-apt-
105
+
106
+ - name : Get Triton latest commit
107
+ id : triton-commit
108
+ run : |
109
+ # Check if jq is available
110
+ if ! command -v jq &> /dev/null; then
111
+ echo "jq not found, installing..."
112
+ sudo apt-get update && sudo apt-get install -y jq
113
+ fi
114
+
115
+ # Get commit with error handling
116
+ echo "Fetching latest Triton commit..."
117
+ COMMIT=$(curl -s --max-time 30 --retry 3 https://api.github.com/repos/triton-lang/triton/commits/main | jq -r .sha 2>/dev/null || echo "")
118
+
119
+ if [ -n "$COMMIT" ] && [ "$COMMIT" != "null" ]; then
120
+ echo "commit=$COMMIT" >> $GITHUB_OUTPUT
121
+ echo "cache-key=$COMMIT" >> $GITHUB_OUTPUT
122
+ echo "✅ Using Triton commit: $COMMIT"
123
+ else
124
+ echo "❌ Failed to get Triton commit, using 'main' as fallback"
125
+ # Force cache miss by using timestamp when API fails
126
+ TIMESTAMP=$(date +%Y%m%d%H%M%S)
127
+ echo "commit=main" >> $GITHUB_OUTPUT
128
+ echo "cache-key=main-fallback-$TIMESTAMP" >> $GITHUB_OUTPUT
129
+ echo "⚠️ Using fallback cache key: main-fallback-$TIMESTAMP"
130
+ fi
131
+
132
+ - name : Cache Triton source and build
133
+ uses : actions/cache@v3
134
+ with :
135
+ path : |
136
+ /tmp/triton
137
+ /tmp/triton-cache
138
+ key : ${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-${{ steps.triton-commit.outputs.cache-key }}
139
+ restore-keys : |
140
+ ${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-
141
+ ${{ runner.os }}-triton-source-
142
+
69
143
- name : Setup environment
70
144
env :
71
145
CONDA_ENV : tritonparse
77
151
- name : Install Triton from source
78
152
env :
79
153
CONDA_ENV : tritonparse
154
+ TRITON_COMMIT : ${{ steps.triton-commit.outputs.commit }}
80
155
run : |
81
156
bash .ci/install-triton.sh
82
157
@@ -86,14 +161,6 @@ jobs:
86
161
run : |
87
162
bash .ci/install-project.sh
88
163
89
- - name : Cache pip dependencies
90
- uses : actions/cache@v3
91
- with :
92
- path : ~/.cache/pip
93
- key : ${{ runner.os }}-pip-3.11-${{ hashFiles('**/pyproject.toml') }}
94
- restore-keys : |
95
- ${{ runner.os }}-pip-3.11-
96
-
97
164
- name : Run tests
98
165
env :
99
166
CONDA_ENV : tritonparse
0 commit comments