-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (148 loc) · 5.72 KB
/
run_IP.yaml
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
name: 'Run IP'
on:
workflow_call:
inputs:
is-ip:
description: 'Flag if the CI is an IP CI'
required: false
type: boolean
default: false
url:
description: 'IP Repo URL'
required: true
type: string
test-names:
description: 'Test Names'
required: true
type: string
name:
description: 'IP Name'
required: true
type: string
buses:
description: 'Bus Types'
required: true
type: string
jobs:
Setup-Work-Space:
runs-on: ubuntu-latest
steps:
- name: Setup Env Vars
run: |
echo "EF_UVM_PATH=${{ github.workspace }}/${{ inputs.name }}/verify/uvm-python/EF_UVM" >> $GITHUB_ENV
echo "IP_PATH=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
echo "MY_WORKSPACE=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
- name: Install IP (EF_UVM)
if: ${{ !inputs.is-ip }}
run: git clone ${{ inputs.url }} ${{ env.IP_PATH }}
- name: Install EF_UVM (EF_UVM)
if: ${{ !inputs.is-ip }}
uses: actions/checkout@v4
with:
path: ${{ env.EF_UVM_PATH }}
- name: Install IP (IP)
uses: actions/checkout@v4
with:
path: ${{ env.IP_PATH }}
- name: Install EF_UVM (EF_UVM)
run: |
git clone https://github.com/efabless/EF_UVM.git ${{ env.EF_UVM_PATH }}
- name: Upload Workspace
uses: actions/upload-artifact@v4
with:
path: ${{ env.MY_WORKSPACE }}
name: ${{ inputs.name }}-workspace
Prepare-Tests-Matrix:
needs: ["Setup-Work-Space"]
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.set-tests-matrix.outputs.tests }}
steps:
- name: Setup Env Vars
run: |
echo "EF_UVM_PATH=${{ github.workspace }}/${{ inputs.name }}/verify/uvm-python/EF_UVM" >> $GITHUB_ENV
echo "IP_PATH=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
echo "MY_WORKSPACE=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
- name: Download Workspace
uses: actions/download-artifact@v4
with:
name: ${{ inputs.name }}-workspace
path: ${{ env.MY_WORKSPACE }}
- name: Set Tests Matrix
id: set-tests-matrix
run: |
python3 ${{ env.EF_UVM_PATH }}/.github/scripts/get_tests_matrix.py --tests ${{ inputs.test-names }} --buses ${{ inputs.buses }}
echo "tests=$(python3 ${{ env.EF_UVM_PATH }}/.github/scripts/get_tests_matrix.py --tests ${{ inputs.test-names }} --buses ${{ inputs.buses }})" >> "$GITHUB_OUTPUT"
Run-IP:
needs: [Prepare-Tests-Matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.Prepare-Tests-Matrix.outputs.tests) }}
name: ${{ matrix.tests.bus }} / ${{ matrix.tests.test }}
steps:
- name: Set Env Variables
shell: bash
run: |
echo "EF_UVM_PATH=${{ github.workspace }}/${{ inputs.name }}/verify/uvm-python/EF_UVM" >> $GITHUB_ENV
echo "IP_PATH=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
echo "MY_WORKSPACE=${{ github.workspace }}/${{ inputs.name }}" >> $GITHUB_ENV
echo "WORKING_DIRECTORY=${{ env.IP_PATH }}/verify/uvm-python" >> $GITHUB_ENV
echo "SIM_DIRECTORY=${{ env.WORKING_DIRECTORY }}/sim" >> $GITHUB_ENV
- name: Download Workspace
uses: actions/download-artifact@v4
with:
name: ${{ inputs.name }}-workspace
path: ${{ env.MY_WORKSPACE }}
- name: Setup OpenLane
if: ${{ matrix.tests.tag == 'GL' }}
uses: efabless/EF_UVM/.github/actions/setup-openlane-nix/action.yaml
- name: Install Docker Image
run: docker pull efabless/dv:cocotb
- name: Run Test
shell: bash
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
for test in ${{ matrix.tests.test }}; do
echo "Running Test $test"
make run_$test SIM_TAG=${{ matrix.tests.tag }} BUS_TYPE=${{ matrix.tests.bus }}
done
- name: Check Test Results
shell: bash
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
passed_count=$(find ${{ env.SIM_DIRECTORY }}/* -type f -name 'passed' | wc -l)
failed_count=$(find ${{ env.SIM_DIRECTORY }}/* -type f -name 'failed' | wc -l)
unknown_count=$(find ${{ env.SIM_DIRECTORY }}/* -type f -name 'unknown' | wc -l)
echo "Passed: $passed_count"
echo "Failed: $failed_count"
echo "Unknown: $unknown_count"
if [ "$passed_count" -eq 0 ]; then
echo "Error: No passed test results found"
exit 1
elif [ "$failed_count" -ne 0 ] || [ "$unknown_count" -ne 0 ]; then
echo "Error: There are failed or unknown test results"
exit 1
else
echo "All tests passed successfully"
fi
- name: Save IP Commit Hash
if: always()
shell: bash
working-directory: ${{ env.WORKING_DIRECTORY }}
run: git rev-parse --verify HEAD > ${{ env.SIM_DIRECTORY }}/ip-commit-hash.txt
- name: Save EF_UVM Commit Hash
if: always()
shell: bash
run: git rev-parse --verify HEAD > ${{ env.SIM_DIRECTORY }}/EF_UVM-commit-hash.txt
- name: Tar Sim Directory
if: always()
shell: bash
working-directory: ${{ env.WORKING_DIRECTORY }}
run: tar -czf sim.tar.gz sim
- name: Upload Logs and Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.name }}-${{ matrix.tests.bus }}-${{ matrix.tests.test }}-sim
path: ${{ env.WORKING_DIRECTORY }}/*.tar.gz