1919 fetch-depth : 0
2020 - name : Set up PDM
2121 uses : pdm-project/setup-pdm@v4
22+
23+ - name : Generate overrides to use current branch if PR
24+ if : github.event_name == 'pull_request'
25+ run : |
26+ pdm run tools/gen_overrides.py ${{github.head_ref}} > overrides.txt
27+ echo "Generated overrides:"
28+ cat overrides.txt
29+
30+ - name : Relock PDM
31+ if : github.event_name != 'pull_request'
32+ run : pdm lock -d
33+
34+ - name : Relock PDM (PR)
35+ if : github.event_name == 'pull_request'
36+ run : pdm lock -d --override overrides.txt
37+
2238 - name : Install dependencies
2339 run : |
2440 pdm install
@@ -39,75 +55,66 @@ jobs:
3955 with :
4056 fetch-depth : 0
4157 - name : Check source code licenses
42- run : |
43- 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
58+ run : ./tools/license_check.sh
4459
4560 test-submit :
4661 runs-on : ubuntu-latest
62+ strategy :
63+ matrix :
64+ dry : [true, false]
65+ env :
66+ DRY : ${{ matrix.dry && '--dry-run' || '' }}
67+ IS_DRY : ${{ matrix.dry && '(dry run)' || '' }}
68+ name : ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
69+
4770 steps :
48- - name : Check out source code
49- uses : actions/checkout@v4
50- with :
51- fetch-depth : 0
52- path : chipflow-lib
5371 - name : Check out chipflow-examples
5472 uses : actions/checkout@v4
5573 with :
5674 repository : ChipFlow/chipflow-examples
5775 fetch-depth : 0
5876 path : chipflow-examples
77+ ref : ${{ github.head_ref || 'refs/heads/main' }}
5978
6079 - name : Set up PDM
6180 uses : pdm-project/setup-pdm@v4
6281 with :
63- python-version : " 3.10"
82+ python-version : ' 3.10'
6483 cache : true
65- cache-dependency-path : " ./**/pyproject.toml"
66- - name : Install dependencies
84+ cache-dependency-path : ' ./**/pyproject.toml'
85+
86+ - name : Generate overrides to use current branch if PR
6787 working-directory : ./chipflow-examples
88+ if : github.event_name == 'pull_request'
6889 run : |
69- pdm install
70- pdm run python -m ensurepip
71- pdm run python -m pip install -e ../chipflow-lib
72- - name : Run tests
90+ pdm run tools/gen_overrides.py ${{github.head_ref}} > overrides.txt
91+ echo "Generated overrides:"
92+ cat overrides.txt
93+
94+ - name : Relock PDM
7395 working-directory : ./chipflow-examples
74- run : |
75- pdm test
76- pdm run chipflow pin lock
77- pdm run chipflow silicon submit --wait
78- env :
79- CHIPFLOW_API_KEY : ${{ secrets.CHIPFLOW_API_KEY}}
96+ if : github.event_name != 'pull_request'
97+ run : pdm lock -d
8098
81- test-submit-dry :
82- runs-on : ubuntu-latest
83- steps :
84- - name : Check out source code
85- uses : actions/checkout@v4
86- with :
87- fetch-depth : 0
88- path : chipflow-lib
89- - name : Check out chipflow-examples
90- uses : actions/checkout@v4
91- with :
92- repository : ChipFlow/chipflow-examples
93- fetch-depth : 0
94- path : chipflow-examples
99+ - name : Relock PDM (PR)
100+ working-directory : ./chipflow-examples
101+ if : github.event_name == 'pull_request'
102+ run : pdm lock -d --override overrides.txt
95103
96- - name : Set up PDM
97- uses : pdm-project/setup-pdm@v4
98- with :
99- python-version : " 3.10"
100- cache : true
101- cache-dependency-path : " ./**/pyproject.toml"
102104 - name : Install dependencies
103105 working-directory : ./chipflow-examples
104106 run : |
105107 pdm install
106- pdm run python -m ensurepip
107- pdm run python -m pip install -e ../chipflow-lib
108+
108109 - name : Run tests
109110 working-directory : ./chipflow-examples
110111 run : |
111112 pdm test
113+
114+ - name : Submit build ${{ env.is_dry }}
115+ working-directory : ./chipflow-examples/minimal
116+ run : |
112117 pdm run chipflow pin lock
113- pdm run chipflow silicon submit --dry-run
118+ pdm run chipflow silicon submit --wait $DRY
119+ env :
120+ CHIPFLOW_API_KEY : ${{ secrets.CHIPFLOW_API_KEY}}
0 commit comments