-
Notifications
You must be signed in to change notification settings - Fork 24
119 lines (101 loc) · 4.04 KB
/
precheck_test.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
name: MPW Precheck
on:
# Runs on Every Push
push:
# Runs on Pull Requests
pull_request:
workflow_dispatch:
jobs:
mpw-precheck:
runs-on: ubuntu-latest
strategy:
matrix:
repo: ['caravel_user_project','caravel_user_mini','caravel_user_sram','caravel_user_project_analog','openframe_timer_example']
# repo: ['caravel_user_sram']
fail-fast: false # Allow other jobs to continue if one fails
steps:
- name: Checkout efabless/mpw_precheck
uses: actions/checkout@v3
with:
repository: efabless/mpw_precheck
path: mpw_precheck
- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v3
with:
repository: efabless/${{ matrix.repo }}
path: ${{ matrix.repo }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('mpw_precheck/dependencies/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker image
run: |
docker buildx create --use
docker buildx build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
--output type=docker \
--tag mpw_precheck:latest \
mpw_precheck/dependencies
timeout-minutes: 15
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Cache PDK
id: cache-pdk
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/pdk
key: ${{ runner.os }}-pdk-${{ hashFiles('**/volare.toml') }}
- name: Install Volare and PDK
if: steps.cache-pdk.outputs.cache-hit != 'true'
run: |
python3 -m pip install --upgrade --no-cache-dir volare
# mkdir -p ${{ github.workspace }}/pdk
volare enable 6d4d11780c40b20ee63cc98e645307a9bf2b2ab8 --pdk-root ${{ github.workspace }}/pdk
env:
PDK_ROOT: ${{ github.workspace }}/pdk
- name: Run MPW Precheck
run: |
export INPUT_DIRECTORY=${{ github.workspace }}/${{ matrix.repo }}
export PRECHECK_ROOT=${{ github.workspace }}/mpw_precheck
export OUTPUT_DIRECTORY=$INPUT_DIRECTORY/mpw_precheck_result
export OUTPUT=$OUTPUT_DIRECTORY/logs/precheck.log
export PDK_ROOT=${{ github.workspace }}/pdk
export PDKPATH=$PDK_ROOT/sky130A
# ls $PDK_ROOT
# ls $PDKPATH
# docker pull efabless/mpw_precheck:latest
docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" -v "$PDK_ROOT":"$PDK_ROOT" -e INPUT_DIRECTORY="$INPUT_DIRECTORY" -e PDK_ROOT="$PDK_ROOT" -e PDKPATH="$PDKPATH" -u $(id -u "$USER"):$(id -g "$USER") mpw_precheck:latest bash -c "cd $PRECHECK_ROOT; python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_path $PDKPATH --output_directory $OUTPUT_DIRECTORY"
# ls $INPUT_DIRECTORY
# ls $OUTPUT_DIRECTORY
# ls $OUTPUT_DIRECTORY/logs
cnt=$(grep -c "All Checks Passed" "$OUTPUT")
if ! [[ $cnt ]]; then cnt=0; fi
if [[ $cnt -eq 1 ]]; then exit 0; fi
exit 2
- name: Upload MPW Precheck output
uses: actions/upload-artifact@v3
if: failure()
with:
name: mpw-precheck-results-${{ matrix.repo }}
path: ${{ github.workspace }}/${{ matrix.repo }}/mpw_precheck_result
# - name: Check for failures
# run: |
# if [ -f "${{ github.workspace }}/mpw_precheck_output/mpw_precheck_results.txt" ]; then
# if grep -q "FAIL" "${{ github.workspace }}/mpw_precheck_output/mpw_precheck_results.txt"; then
# echo "MPW Precheck failed for ${{ matrix.repo }}"
# exit 1
# else
# echo "MPW Precheck passed for ${{ matrix.repo }}"
# fi
# else
# echo "Results file not found for ${{ matrix.repo }}"
# exit 1
# fi