Skip to content

Commit 67db2bc

Browse files
Merge pull request #75 | [ci] Add ruff checks
[ci] Add ruff checks
2 parents 35c644a + 9de1c4f commit 67db2bc

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,23 @@ name: prof-correctness
22
on:
33
push:
44
schedule:
5-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
66
jobs:
7+
ruff:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11+
- name: Set up Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.11"
15+
- name: Install ruff
16+
run: pip install --no-cache-dir ruff
17+
- name: Run ruff format check
18+
run: ruff format --check .
19+
- name: Run ruff lint check
20+
if: success() || failure()
21+
run: ruff check .
722
ddprof:
823
uses: ./.github/workflows/test.yml
924
with:

scenarios/python_basic_3.11/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
def target(n):
88
sleep(n)
99

10+
1011
if __name__ == "__main__":
1112
# Simple application that creates two threads with different durations:
1213
# - MainThread runs target() for 2 seconds

scenarios/python_cpu/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,34 @@
44
x = 0
55
i = 0
66

7+
78
def main():
89
global x, i
9-
EXECUTION_TIME_SEC = int(os.getenv("EXECUTION_TIME_SEC", "10")) # defaults to 10 if not set
10+
EXECUTION_TIME_SEC = int(
11+
os.getenv("EXECUTION_TIME_SEC", "10")
12+
) # defaults to 10 if not set
1013
end = time() + EXECUTION_TIME_SEC
1114
while time() < end:
1215
a()
1316
b()
1417
# We add a print to prevent optimization that could turn this into a no-op program
1518
print(x)
1619

20+
1721
def a():
1822
global x, i
1923
i = 0
2024
while i < 1000000:
2125
x += i
2226
i += 1
2327

28+
2429
def b():
2530
global x, i
2631
i = 0
2732
while i < 2000000:
2833
x += i
2934
i += 1
3035

36+
3137
main()

0 commit comments

Comments
 (0)