Skip to content

Commit 4ba8343

Browse files
Add Docker build/push to CI and update workflows for cf-precheck
- publish.yml: add Docker job that builds and pushes to Docker Hub after PyPI publish succeeds - precheck_test.yml: use cf-precheck CLI instead of old mpw_precheck.py - build-docker.sh: fix org name from efabless to chipfoundry Made-with: Cursor
1 parent 4397996 commit 4ba8343

3 files changed

Lines changed: 69 additions & 44 deletions

File tree

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
name: MPW Precheck
1+
name: Precheck CI
22

33
on:
44
push:
55
pull_request:
66
workflow_dispatch:
77

88
jobs:
9-
mpw-precheck:
9+
precheck:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
1313
include:
1414
- repo: 'caravel_user_project'
15-
skip_checks: 'default gpio_defines'
16-
# - repo: 'caravel_user_mini'
17-
# skip_checks: ''
15+
skip_checks: 'gpio_defines'
1816
- repo: 'caravel_user_sram'
1917
skip_checks: 'gpio_defines lvs'
2018
- repo: 'caravel_user_project_analog'
21-
skip_checks: 'default gpio_defines lvs'
19+
skip_checks: 'gpio_defines lvs'
2220
- repo: 'openframe_user_project'
2321
skip_checks: ''
2422
fail-fast: false
2523

2624
steps:
27-
- name: Checkout chipfoundry/mpw_precheck
25+
- name: Checkout mpw_precheck
2826
uses: actions/checkout@v4
2927
with:
3028
repository: chipfoundry/mpw_precheck
@@ -56,7 +54,7 @@ jobs:
5654
--output type=docker \
5755
--tag mpw_precheck:latest \
5856
mpw_precheck/dependencies
59-
timeout-minutes: 30 # Increased timeout to 30 minutes
57+
timeout-minutes: 30
6058

6159
- name: Move cache
6260
run: |
@@ -78,41 +76,32 @@ jobs:
7876
env:
7977
PDK_ROOT: ${{ github.workspace }}/pdk
8078

81-
- name: Run MPW Precheck
79+
- name: Run Precheck
8280
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=""
81+
INPUT_DIR=${{ github.workspace }}/${{ matrix.repo }}
82+
OUTPUT_DIR=$INPUT_DIR/precheck_results
83+
PDK_ROOT=${{ github.workspace }}/pdk
84+
PDK_PATH=$PDK_ROOT/sky130A
85+
86+
SKIP_ARGS=""
9187
if [ -n "${{ matrix.skip_checks }}" ]; then
92-
SKIP_CHECKS_ARG="--skip_checks ${{ matrix.skip_checks }}"
88+
SKIP_ARGS="--skip-checks ${{ matrix.skip_checks }}"
9389
fi
9490
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
91+
docker run \
92+
-v "$INPUT_DIR":"$INPUT_DIR" \
93+
-v "$PDK_ROOT":"$PDK_ROOT" \
94+
mpw_precheck:latest \
95+
cf-precheck \
96+
-i "$INPUT_DIR" \
97+
-p "$PDK_PATH" \
98+
-c /opt/caravel \
99+
-o "$OUTPUT_DIR" \
100+
$SKIP_ARGS
112101
113-
- name: Upload MPW Precheck output
102+
- name: Upload Precheck results
114103
uses: actions/upload-artifact@v4
115104
if: failure()
116105
with:
117-
name: mpw-precheck-results-${{ matrix.repo }}
118-
path: ${{ github.workspace }}/${{ matrix.repo }}/mpw_precheck_result
106+
name: precheck-results-${{ matrix.repo }}
107+
path: ${{ github.workspace }}/${{ matrix.repo }}/precheck_results

.github/workflows/publish.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Python Package to PyPI
1+
name: Publish to PyPI and Docker Hub
22

33
on:
44
push:
@@ -10,9 +10,8 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
publish:
13+
pypi:
1414
runs-on: ubuntu-latest
15-
1615
steps:
1716
- name: Checkout code
1817
uses: actions/checkout@v4
@@ -28,10 +27,47 @@ jobs:
2827
pip install build
2928
3029
- name: Build package
31-
run: |
32-
python -m build
30+
run: python -m build
3331

3432
- name: Publish package to PyPI
3533
uses: pypa/gh-action-pypi-publish@release/v1
3634
with:
3735
password: ${{ secrets.PYPI_TOKEN }}
36+
37+
docker:
38+
needs: pypi
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Log in to Docker Hub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ secrets.DOCKERHUB_USERNAME }}
51+
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
53+
- name: Wait for PyPI availability
54+
run: |
55+
VERSION=$(python3 -c "import re; print(re.search(r'\"([^\"]+)\"', open('src/cf_precheck/__init__.py').read()).group(1))")
56+
echo "Waiting for cf-precheck==$VERSION on PyPI..."
57+
for i in $(seq 1 30); do
58+
if pip index versions cf-precheck 2>/dev/null | grep -q "$VERSION"; then
59+
echo "cf-precheck $VERSION is available on PyPI"
60+
break
61+
fi
62+
echo "Attempt $i/30 - not yet available, waiting 10s..."
63+
sleep 10
64+
done
65+
66+
- name: Build and push Docker image
67+
uses: docker/build-push-action@v5
68+
with:
69+
context: dependencies
70+
push: true
71+
tags: chipfoundry/mpw_precheck:latest
72+
cache-from: type=gha
73+
cache-to: type=gha,mode=max

dependencies/build-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
mkdir -p logs/docker
1717
echo "dir created"
18-
docker build --rm -t efabless/mpw_precheck:latest . | tee logs/docker/mpw_precheck.build.txt
18+
docker build --rm -t chipfoundry/mpw_precheck:latest . | tee logs/docker/mpw_precheck.build.txt

0 commit comments

Comments
 (0)