1919 - name : Set up PDM
2020 uses : pdm-project/setup-pdm@v4
2121
22- - name : Re-lock PDM dependencies
22+ - name : Generate overrides to use current branch if PR
23+ if : github.event_name == 'pull_request'
24+ run : |
25+ pdm run tools/gen_overrides.py ${{github.head_ref}} > overrides.txt
26+ echo "Generated overrides:"
27+ cat overrides.txt
28+
29+ - name : Relock PDM
30+ if : github.event_name != 'pull_request'
2331 run : pdm lock -d
2432
33+ - name : Relock PDM (PR)
34+ if : github.event_name == 'pull_request'
35+ run : pdm lock -d --override overrides.txt
36+
2537 - name : Install dependencies
2638 run : pdm install
2739
@@ -42,11 +54,18 @@ jobs:
4254 with :
4355 fetch-depth : 0
4456 - name : Check source code licenses
45- run : |
46- docker run --platform=linux/amd64 -v ${PWD}:/src ghcr.io/google/addlicense -v -check -l BSD-2-Clause -c "ChipFlow" -s=only -ignore **/__init__.py **/*.py
57+ run : ./tools/license_check.sh
4758
4859 test-submit :
4960 runs-on : ubuntu-latest
61+ strategy :
62+ matrix :
63+ dry : [true, false]
64+ env :
65+ DRY : ${{ matrix.dry && '--dry-run' || '' }}
66+ IS_DRY : ${{ matrix.dry && '(dry run)' || '' }}
67+ name : ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
68+
5069 steps :
5170 - name : Check out source code
5271 uses : actions/checkout@v4
@@ -60,71 +79,47 @@ jobs:
6079 repository : ChipFlow/chipflow-examples
6180 fetch-depth : 0
6281 path : chipflow-examples
82+ ref : ${{ github.head_ref || 'refs/heads/main' }}
6383
6484 - name : Set up PDM
6585 uses : pdm-project/setup-pdm@v4
6686 with :
67- python-version : " 3.10"
87+ python-version : ' 3.10'
6888 cache : true
6989 cache-dependency-path : " ./**/pyproject.toml"
7090
71- - name : Re-lock PDM dependencies
72- working-directory : ./chipflow-examples
73- run : pdm lock -d
74-
75- - name : Install dependencies
91+ - name : Generate overrides to use current branch if PR
7692 working-directory : ./chipflow-examples
93+ if : github.event_name == 'pull_request'
7794 run : |
78- pdm install
79- pdm run python -m ensurepip
80- pdm run python -m pip install -e ../chipflow-lib
95+ pdm run tools/gen_overrides.py ${{github.head_ref}} > overrides.txt
96+ echo "Generated overrides:"
97+ cat overrides.txt
8198
82- - name : Run tests
83- working-directory : ./chipflow-examples/minimal
84- run : |
85- pdm test
86- pdm run chipflow pin lock
87- pdm run chipflow silicon submit --wait
88- env :
89- CHIPFLOW_API_KEY : ${{ secrets.CHIPFLOW_API_KEY}}
90-
91- test-submit-dry :
92- runs-on : ubuntu-latest
93- steps :
94- - name : Check out source code
95- uses : actions/checkout@v4
96- with :
97- fetch-depth : 0
98- path : chipflow-lib
99-
100- - name : Check out chipflow-examples
101- uses : actions/checkout@v4
102- with :
103- repository : ChipFlow/chipflow-examples
104- fetch-depth : 0
105- path : chipflow-examples
106-
107- - name : Set up PDM
108- uses : pdm-project/setup-pdm@v4
109- with :
110- python-version : " 3.10"
111- cache : true
112- cache-dependency-path : " ./**/pyproject.toml"
113-
114- - name : Re-lock PDM dependencies
99+ - name : Relock PDM
115100 working-directory : ./chipflow-examples
101+ if : github.event_name != 'pull_request'
116102 run : pdm lock -d
117103
104+ - name : Relock PDM (PR)
105+ working-directory : ./chipflow-examples
106+ if : github.event_name == 'pull_request'
107+ run : pdm lock -d --override overrides.txt
108+
118109 - name : Install dependencies
119110 working-directory : ./chipflow-examples
120111 run : |
121112 pdm install
122- pdm run python -m ensurepip
123- pdm run python -m pip install -e ../chipflow-lib
124113
125114 - name : Run tests
126115 working-directory : ./chipflow-examples/minimal
127116 run : |
128117 pdm test
118+
119+ - name : Submit build ${{ env.is_dry }}
120+ working-directory : ./chipflow-examples/minimal
121+ run : |
129122 pdm run chipflow pin lock
130- pdm run chipflow silicon submit --dry-run
123+ pdm run chipflow silicon submit --wait $DRY
124+ env :
125+ CHIPFLOW_API_KEY : ${{ secrets.CHIPFLOW_API_KEY}}
0 commit comments