@@ -2,9 +2,19 @@ name: Tests
22
33on :
44 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"
611 pull_request :
712 branches : [main]
13+ paths-ignore :
14+ - " website/**"
15+ - " docs/**"
16+ - " *.md"
17+ - " .gitignore"
818 workflow_dispatch :
919 inputs :
1020 test-type :
3444 with :
3545 python-version : " 3.11"
3646
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-
4547 - name : Install development dependencies
4648 run : |
4749 make install-dev
6668 with :
6769 python-version : " 3.11"
6870
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+
69143 - name : Setup environment
70144 env :
71145 CONDA_ENV : tritonparse
77151 - name : Install Triton from source
78152 env :
79153 CONDA_ENV : tritonparse
154+ TRITON_COMMIT : ${{ steps.triton-commit.outputs.commit }}
80155 run : |
81156 bash .ci/install-triton.sh
82157
@@ -86,14 +161,6 @@ jobs:
86161 run : |
87162 bash .ci/install-project.sh
88163
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-
97164 - name : Run tests
98165 env :
99166 CONDA_ENV : tritonparse
0 commit comments