Skip to content

Commit ddb8b3b

Browse files
committed
add ci run
1 parent 9fee147 commit ddb8b3b

File tree

1 file changed

+31
-74
lines changed

1 file changed

+31
-74
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@ name: Tests
22

33
on:
44
push:
5-
branches: [main, develop]
6-
paths-ignore:
7-
- "website/**"
8-
- "docs/**"
9-
- "*.md"
10-
- ".gitignore"
5+
branches: [main, develop, findhao/setup_ci, findhao/add_linter]
116
pull_request:
127
branches: [main]
13-
paths-ignore:
14-
- "website/**"
15-
- "docs/**"
16-
- "*.md"
17-
- ".gitignore"
188
workflow_dispatch:
199
inputs:
2010
test-type:
@@ -33,9 +23,9 @@ on:
3323
type: boolean
3424

3525
jobs:
36-
test:
37-
runs-on: 4-core-ubuntu-gpu-t4
38-
timeout-minutes: 120
26+
format-check:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 10
3929
steps:
4030
- uses: actions/checkout@v4
4131

@@ -44,77 +34,37 @@ jobs:
4434
with:
4535
python-version: "3.11"
4636

47-
- name: Get daily cache timestamp
48-
id: daily-cache
49-
run: |
50-
# Calculate date (e.g., 2024-01-15) for daily cache expiration
51-
DATE_STAMP=$(date +"%Y-%m-%d")
52-
echo "date=$DATE_STAMP" >> $GITHUB_OUTPUT
53-
echo "Using daily cache stamp: $DATE_STAMP"
54-
55-
- name: Get weekly cache timestamp
56-
id: weekly-cache
57-
run: |
58-
# Calculate year-week (e.g., 2024-03) for weekly cache expiration
59-
WEEK_STAMP=$(date +"%Y-%U")
60-
echo "week=$WEEK_STAMP" >> $GITHUB_OUTPUT
61-
echo "Using weekly cache stamp: $WEEK_STAMP"
62-
6337
- name: Cache pip dependencies
6438
uses: actions/cache@v3
6539
with:
6640
path: ~/.cache/pip
67-
key: ${{ runner.os }}-pip-3.11-${{ steps.daily-cache.outputs.date }}
41+
key: ${{ runner.os }}-pip-format-${{ hashFiles('**/pyproject.toml') }}
6842
restore-keys: |
69-
${{ runner.os }}-pip-3.11-
43+
${{ runner.os }}-pip-format-
7044
71-
- name: Cache APT packages
72-
uses: actions/cache@v3
73-
with:
74-
path: |
75-
/var/cache/apt/archives
76-
/var/lib/apt/lists
77-
key: ${{ runner.os }}-apt-${{ hashFiles('.ci/setup.sh') }}-${{ steps.weekly-cache.outputs.week }}
78-
restore-keys: |
79-
${{ runner.os }}-apt-${{ hashFiles('.ci/setup.sh') }}-
80-
${{ runner.os }}-apt-
45+
- name: Install development dependencies
46+
run: |
47+
make install-dev
8148
82-
- name: Get Triton latest commit
83-
id: triton-commit
49+
- name: Check code formatting
8450
run: |
85-
# Check if jq is available
86-
if ! command -v jq &> /dev/null; then
87-
echo "jq not found, installing..."
88-
sudo apt-get update && sudo apt-get install -y jq
89-
fi
51+
make format-check
9052
91-
# Get commit with error handling
92-
echo "Fetching latest Triton commit..."
93-
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 "")
53+
- name: Check linting
54+
run: |
55+
make lint-check || (echo "❌ Linting failed. Please run 'make format' to fix formatting issues, then commit the changes." && exit 1)
9456
95-
if [ -n "$COMMIT" ] && [ "$COMMIT" != "null" ]; then
96-
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
97-
echo "cache-key=$COMMIT" >> $GITHUB_OUTPUT
98-
echo "✅ Using Triton commit: $COMMIT"
99-
else
100-
echo "❌ Failed to get Triton commit, using 'main' as fallback"
101-
# Force cache miss by using timestamp when API fails
102-
TIMESTAMP=$(date +%Y%m%d%H%M%S)
103-
echo "commit=main" >> $GITHUB_OUTPUT
104-
echo "cache-key=main-fallback-$TIMESTAMP" >> $GITHUB_OUTPUT
105-
echo "⚠️ Using fallback cache key: main-fallback-$TIMESTAMP"
106-
fi
57+
test:
58+
runs-on: 4-core-ubuntu-gpu-t4
59+
timeout-minutes: 120
60+
needs: format-check
61+
steps:
62+
- uses: actions/checkout@v4
10763

108-
- name: Cache Triton source and build
109-
uses: actions/cache@v3
64+
- name: Set up Python 3.11
65+
uses: actions/setup-python@v4
11066
with:
111-
path: |
112-
/tmp/triton
113-
/tmp/triton-cache
114-
key: ${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-${{ steps.triton-commit.outputs.cache-key }}
115-
restore-keys: |
116-
${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-
117-
${{ runner.os }}-triton-source-
67+
python-version: "3.11"
11868

11969
- name: Setup environment
12070
env:
@@ -127,7 +77,6 @@ jobs:
12777
- name: Install Triton from source
12878
env:
12979
CONDA_ENV: tritonparse
130-
TRITON_COMMIT: ${{ steps.triton-commit.outputs.commit }}
13180
run: |
13281
bash .ci/install-triton.sh
13382
@@ -137,6 +86,14 @@ jobs:
13786
run: |
13887
bash .ci/install-project.sh
13988
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+
14097
- name: Run tests
14198
env:
14299
CONDA_ENV: tritonparse

0 commit comments

Comments
 (0)