|
| 1 | +name: MPW Precheck |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + mpw-precheck: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - repo: 'caravel_user_project' |
| 15 | + skip_checks: 'default gpio_defines' |
| 16 | + - repo: 'caravel_user_mini' |
| 17 | + skip_checks: '' |
| 18 | + - repo: 'caravel_user_sram' |
| 19 | + skip_checks: 'gpio_defines lvs' |
| 20 | + - repo: 'caravel_user_project_analog' |
| 21 | + skip_checks: 'default gpio_defines lvs' |
| 22 | + - repo: 'openframe_timer_example' |
| 23 | + skip_checks: '' |
| 24 | + fail-fast: false |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout efabless/mpw_precheck |
| 28 | + uses: actions/checkout@v3 |
| 29 | + with: |
| 30 | + repository: efabless/mpw_precheck |
| 31 | + path: mpw_precheck |
| 32 | + |
| 33 | + - name: Checkout ${{ matrix.repo }} |
| 34 | + uses: actions/checkout@v3 |
| 35 | + with: |
| 36 | + repository: efabless/${{ matrix.repo }} |
| 37 | + path: ${{ matrix.repo }} |
| 38 | + |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@v2 |
| 41 | + |
| 42 | + - name: Cache Docker layers |
| 43 | + uses: actions/cache@v3 |
| 44 | + with: |
| 45 | + path: /tmp/.buildx-cache |
| 46 | + key: ${{ runner.os }}-buildx-${{ hashFiles('mpw_precheck/dependencies/Dockerfile') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-buildx- |
| 49 | +
|
| 50 | + - name: Build Docker image |
| 51 | + run: | |
| 52 | + docker buildx create --use |
| 53 | + docker buildx build \ |
| 54 | + --cache-from=type=local,src=/tmp/.buildx-cache \ |
| 55 | + --cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \ |
| 56 | + --output type=docker \ |
| 57 | + --tag mpw_precheck:latest \ |
| 58 | + mpw_precheck/dependencies |
| 59 | + timeout-minutes: 30 # Increased timeout to 30 minutes |
| 60 | + |
| 61 | + - name: Move cache |
| 62 | + run: | |
| 63 | + rm -rf /tmp/.buildx-cache |
| 64 | + mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
| 65 | +
|
| 66 | + - name: Cache PDK |
| 67 | + id: cache-pdk |
| 68 | + uses: actions/cache@v3 |
| 69 | + with: |
| 70 | + path: ${{ github.workspace }}/pdk |
| 71 | + key: ${{ runner.os }}-pdk-${{ hashFiles('**/volare.toml') }} |
| 72 | + |
| 73 | + - name: Install Volare and PDK |
| 74 | + if: steps.cache-pdk.outputs.cache-hit != 'true' |
| 75 | + run: | |
| 76 | + python3 -m pip install --upgrade --no-cache-dir volare |
| 77 | + volare enable 6d4d11780c40b20ee63cc98e645307a9bf2b2ab8 --pdk-root ${{ github.workspace }}/pdk |
| 78 | + env: |
| 79 | + PDK_ROOT: ${{ github.workspace }}/pdk |
| 80 | + |
| 81 | + - name: Run MPW Precheck |
| 82 | + run: | |
| 83 | + export INPUT_DIRECTORY=${{ github.workspace }}/${{ matrix.repo }} |
| 84 | + export PRECHECK_ROOT=${{ github.workspace }}/mpw_precheck |
| 85 | + export OUTPUT_DIRECTORY=$INPUT_DIRECTORY/mpw_precheck_result |
| 86 | + export OUTPUT=$OUTPUT_DIRECTORY/logs/precheck.log |
| 87 | + export PDK_ROOT=${{ github.workspace }}/pdk |
| 88 | + export PDKPATH=$PDK_ROOT/sky130A |
| 89 | + |
| 90 | + SKIP_CHECKS_ARG="" |
| 91 | + if [ -n "${{ matrix.skip_checks }}" ]; then |
| 92 | + SKIP_CHECKS_ARG="--skip_checks ${{ matrix.skip_checks }}" |
| 93 | + fi |
| 94 | +
|
| 95 | + docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" \ |
| 96 | + -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" \ |
| 97 | + -v "$PDK_ROOT":"$PDK_ROOT" \ |
| 98 | + -e INPUT_DIRECTORY="$INPUT_DIRECTORY" \ |
| 99 | + -e PDK_ROOT="$PDK_ROOT" \ |
| 100 | + -e PDKPATH="$PDKPATH" \ |
| 101 | + -u $(id -u "$USER"):$(id -g "$USER") \ |
| 102 | + mpw_precheck:latest \ |
| 103 | + bash -c "cd $PRECHECK_ROOT && python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_path $PDKPATH --output_directory $OUTPUT_DIRECTORY --skip_checks $SKIP_CHECKS_ARG" |
| 104 | +
|
| 105 | + if grep -q "All Checks Passed" "$OUTPUT"; then |
| 106 | + echo "All checks passed for ${{ matrix.repo }}" |
| 107 | + exit 0 |
| 108 | + else |
| 109 | + echo "Checks failed for ${{ matrix.repo }}" |
| 110 | + exit 1 |
| 111 | + fi |
| 112 | +
|
| 113 | + - name: Upload MPW Precheck output |
| 114 | + uses: actions/upload-artifact@v3 |
| 115 | + if: failure() |
| 116 | + with: |
| 117 | + name: mpw-precheck-results-${{ matrix.repo }} |
| 118 | + path: ${{ github.workspace }}/${{ matrix.repo }}/mpw_precheck_result |
0 commit comments