@@ -33,53 +33,64 @@ jobs:
33
33
run : |
34
34
curl -o pci.ids.new https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
35
35
36
- - name : Check for changes
37
- id : check_changes
36
+ - name : Check for sha256 change
37
+ id : check_sha256
38
38
run : |
39
39
# Calculate new checksum
40
40
NEW_CHECKSUM=$(sha256sum pci.ids.new | cut -d' ' -f1)
41
41
42
42
# Check if checksum file exists and compare
43
43
if [ ! -f pci.ids.sha256 ]; then
44
- echo "No existing checksum file found. Will proceed with update."
44
+ echo "Cached checksum file not found. Will proceed with update."
45
45
echo "has_changes=true" >> "$GITHUB_OUTPUT"
46
46
echo "$NEW_CHECKSUM" > pci.ids.sha256
47
47
else
48
48
OLD_CHECKSUM=$(cat pci.ids.sha256)
49
49
if [ "$NEW_CHECKSUM" != "$OLD_CHECKSUM" ]; then
50
- echo "Changes detected in pci.ids file "
50
+ echo "pci.ids checksum is different "
51
51
echo "$NEW_CHECKSUM" > pci.ids.sha256
52
52
echo "has_changes=true" >> "$GITHUB_OUTPUT"
53
53
else
54
- echo "No changes detected in pci.ids file "
54
+ echo "No changes detected in pci.ids"
55
55
echo "has_changes=false" >> "$GITHUB_OUTPUT"
56
56
rm pci.ids.new
57
57
exit 0
58
58
fi
59
59
fi
60
60
61
61
- name : Update files and generate database
62
- if : steps.check_changes .outputs.has_changes == 'true'
62
+ if : steps.check_sha256 .outputs.has_changes == 'true'
63
63
run : |
64
64
mv torchruntime/gpu_pci_ids.db old.db
65
65
export PYTHONPATH=$PYTHONPATH:$(pwd)
66
66
python scripts/txt_to_db.py pci.ids.new torchruntime/gpu_pci_ids.db
67
67
68
68
- name : Get the DB diff
69
- if : steps.check_changes.outputs.has_changes == 'true'
69
+ id : check_db_diff
70
+ if : steps.check_sha256.outputs.has_changes == 'true'
70
71
run : |
71
72
python scripts/sqldiff.py old.db torchruntime/gpu_pci_ids.db > db_diff.txt
73
+ diff_count=$(cat db_diff.txt | wc -l)
74
+ if [ "$diff_count" -eq "0" ]; then
75
+ echo "No changes detected in db diff"
76
+ echo "has_changes=false" >> "$GITHUB_OUTPUT"
77
+ exit 0
78
+ else
79
+ echo "db diff is different"
80
+ cat db_diff.txt
81
+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
82
+ fi
72
83
echo 'DIFF_OUTPUT<<EOF' >> $GITHUB_ENV
73
84
cat db_diff.txt >> $GITHUB_ENV
74
85
echo 'EOF' >> $GITHUB_ENV
75
86
76
87
- name : Run tests
77
- if : steps.check_changes .outputs.has_changes == 'true'
88
+ if : steps.check_db_diff .outputs.has_changes == 'true'
78
89
run : |
79
90
python -m pytest
80
91
81
92
- name : Update version in pyproject.toml
82
- if : steps.check_changes .outputs.has_changes == 'true'
93
+ if : steps.check_db_diff .outputs.has_changes == 'true'
83
94
id : update_version
84
95
run : |
85
96
python - <<EOF
@@ -111,19 +122,19 @@ jobs:
111
122
ls -l torchruntime/gpu_pci_ids.db
112
123
113
124
- name : Configure Git
114
- if : steps.check_changes .outputs.has_changes == 'true'
125
+ if : steps.check_db_diff .outputs.has_changes == 'true'
115
126
run : |
116
127
git config --local user.email "github-actions[bot]@users.noreply.github.com"
117
128
git config --local user.name "github-actions[bot]"
118
129
119
130
- name : Commit changes
120
- if : steps.check_changes .outputs.has_changes == 'true'
131
+ if : steps.check_db_diff .outputs.has_changes == 'true'
121
132
run : |
122
133
git add pci.ids.sha256 torchruntime/gpu_pci_ids.db pyproject.toml
123
134
git commit -m "Update PCI database, raw data file and version"
124
135
125
136
- name : Create Release
126
- if : steps.check_changes .outputs.has_changes == 'true'
137
+ if : steps.check_db_diff .outputs.has_changes == 'true'
127
138
uses : softprops/action-gh-release@v1
128
139
with :
129
140
tag_name : v${{ steps.update_version.outputs.new_version }}
@@ -136,7 +147,7 @@ jobs:
136
147
prerelease : false
137
148
138
149
- name : Push changes
139
- if : steps.check_changes .outputs.has_changes == 'true'
150
+ if : steps.check_db_diff .outputs.has_changes == 'true'
140
151
run : git push && git push --tags
141
152
142
153
- name : Cleanup
0 commit comments