-
Notifications
You must be signed in to change notification settings - Fork 7
220 lines (195 loc) · 8.26 KB
/
digest_sim.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: 'Fetch and Test SIM Model changes'
on:
#push:
repository_dispatch:
types: [digest_latest_Release]
jobs:
SIM_Model_Digest_and_test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
scenarios:
- pass
- fail
- no_tb
env:
MODE: ${{ matrix.scenarios }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: switch to branch
run: |
git branch -a
BRANCH='${{ matrix.scenarios }}_sim_${{ github.event.client_payload.new_release }}_internal'
set +e
git ls-remote --exit-code --heads origin $BRANCH >/dev/null 2>&1
EXIT_CODE=$?
if [[ $EXIT_CODE == '0' ]]; then
echo "Git branch '$BRANCH' exists in the remote repository"
main_last_commit=`git log -1 --pretty=format:"%H"`
git checkout $BRANCH
git pull origin $BRANCH
git reset --hard $main_last_commit
elif [[ $EXIT_CODE == '2' ]]; then
echo "Git branch '$BRANCH' does not exist in the remote repository"
fi
- name: Install Simulator
run: sudo apt install -y iverilog
- name: Download Latest Release
uses: robinraju/[email protected]
with:
repository: "${{ secrets.SRC_RELEASE_REPO }}"
latest: true
fileName: "generic-*.tar.gz"
token: "${{ secrets.SIM_MODEL_DOWNLOAD }}"
- name: Unzip Release
run: |
cd ..
echo "payload: ${{ github.event.client_payload.new_release }}"
for file in $(ls -1 $GITHUB_WORKSPACE/*.tar.gz)
do
echo $file
tar -xvf $file
done
ls -l
- name: tree
run: tree && cd .. && tree
- name: find the diff
run: |
python3 primitive_parser.py --src=./../sim_models/verilog/ --dest=./sim_models/verilog/ --release=${{ github.event.client_payload.new_release }}
- name: File to push
id: do_push
run: |
# logic: in each case, look for file dump by python script
case "${{ matrix.scenarios }}" in
"pass")
echo "updates are from ${{ matrix.scenarios }}"
passfile="Pass_prim.txt"
if [ -f "$passfile" ]; then
echo "Pass file found"
all_files=`cat $passfile`
echo $all_files
echo "path_to_commit=$all_files" >> $GITHUB_ENV
echo "has_changed=true" >> $GITHUB_OUTPUT
fi
;;
"fail")
echo "updates are from ${{ matrix.scenarios }}"
failfile="Fail_prim.txt"
if [ -f "$failfile" ]; then
echo "Fail file found"
all_files=`cat $failfile`
echo $all_files
echo "path_to_commit=$all_files" >> $GITHUB_ENV
echo "has_changed=true" >> $GITHUB_OUTPUT
fi
;;
"no_tb")
echo "updates are from ${{ matrix.scenarios }}"
noTBfile="no_tb.txt"
if [ -f "$noTBfile" ]; then
echo "no_tb file found"
all_files=`cat $noTBfile`
echo $all_files
echo "path_to_commit=$all_files" >> $GITHUB_ENV
echo "has_changed=true" >> $GITHUB_OUTPUT
fi
;;
*)
echo "Invalid value: ${{ matrix.scenarios }}"
;;
esac
- name: cat email.txt
if: success() || failure()
id: pr_decision
run: |
if [ -f email.txt ]
then
cat email.txt
else
echo "Kindly check your python script as it failed somewhere. Link to fail Github Action is ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> email.txt
fi
if [ -f subject.txt ]
then
cat subject.txt
else
echo "${{ github.repository }} Python Script failed to find the diff" >> subject.txt
fi
case "${{ matrix.scenarios }}" in
"pass")
echo "updates are from ${{ matrix.scenarios }}"
echo "email_ids=${{ secrets.ONLY_EMAIL_ID }}" >> $GITHUB_ENV
;;
"fail")
echo "updates are from ${{ matrix.scenarios }}"
#echo "email_ids=${{ secrets.EMAIL_IDS }}" >> $GITHUB_ENV
echo "email_ids=${{ secrets.ONLY_EMAIL_ID }}" >> $GITHUB_ENV
;;
"no_tb")
echo "updates are from ${{ matrix.scenarios }}"
echo "email_ids=${{ secrets.ONLY_EMAIL_ID }}" >> $GITHUB_ENV
;;
*)
echo "Invalid value: ${{ matrix.scenarios }}"
;;
esac
- name: blackbox simulation
run: |
set +e
iverilog -g2012 ./blackbox_models/cell_sim_blackbox.v
if [ $? -eq 0 ]
then
echo -e "'\n\tBlack Box Compilation has passed\n" >> email.txt
else
echo -e "'\n\tBlack Box Compilation has failed\n" >> email.txt
fi
- name: show current status
run:
git status
- name: Add and Push
uses: GuillaumeFalourd/[email protected]
if: contains(steps.do_push.outputs.has_changed, 'true')
with:
email: [email protected]
name: NadeemYaseen
commit_message: Added SIM change files from ${{ github.event.client_payload.new_release }}
files: "${{ env.path_to_commit }}"
target_branch: ${{ matrix.scenarios }}_sim_${{ github.event.client_payload.new_release }}
access_token: ${{ secrets.SIM_MODEL_DOWNLOAD }}
force: true
# if all pass then create PR.
- name: Create PR
if: ${{ matrix.scenarios == 'pass' && steps.do_push.outputs.has_changed == 'true' }}
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ matrix.scenarios }}_sim_${{ github.event.client_payload.new_release }} # branch having xmls files
destination_branch: "main" # name of branch on which PR go
pr_title: "Pulling SIMs release ${{ github.event.client_payload.new_release }} into main. " # Title of pull request
pr_body: "An automated PR to check in New SIMs Release. Click on the link to see regression results ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" # Full markdown support, requires pr_title
pr_reviewer: "bilal458,moinijaz" # Comma-separated list (no spaces)
#pr_reviewer: "ashrafnisar"
pr_assignee: "NadeemYaseen" # Comma-separated list (no spaces)
pr_label: "openfpga_castor_pd_sim" # Comma-separated list (no spaces)
pr_allow_empty: true # Creates pull request even if there are no changes
github_token: ${{ secrets.SIM_MODEL_DOWNLOAD }}
- name: Send Email
if: success() || failure()
uses: dawidd6/[email protected]
with:
server_address: ${{secrets.MAIL_SERVER}}
server_port: ${{secrets.MAIL_SERVERPORT}}
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "${{ env.SUBJECT }} for release ${{ github.event.client_payload.new_release }}. Changes are in branch ${{ matrix.scenarios }}_sim_${{ github.event.client_payload.new_release }}"
body: file://email.txt
#to: [email protected]
to: "${{ env.email_ids }}"
from: ${{secrets.MAIL_USERNAME}}
#attachments: and2_verilog.tar.gz