Skip to content

Commit 33ab93c

Browse files
committed
wip
1 parent f17ec8c commit 33ab93c

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

.github/workflows/main.yaml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,25 @@ jobs:
5555
with:
5656
fetch-depth: 0
5757
- name: Check source code licenses
58-
run: |
59-
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
6059

6160
test-submit:
6261
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+
6370
steps:
6471
- name: Check out source code
6572
uses: actions/checkout@v4
6673
with:
6774
fetch-depth: 0
6875
path: chipflow-lib
76+
6977
- name: Check out chipflow-examples
7078
uses: actions/checkout@v4
7179
with:
@@ -76,54 +84,43 @@ jobs:
7684
- name: Set up PDM
7785
uses: pdm-project/setup-pdm@v4
7886
with:
79-
python-version: "3.10"
87+
python-version: '3.10'
8088
cache: true
81-
cache-dependency-path: "./**/pyproject.toml"
82-
- name: Install dependencies
89+
cache-dependency-path: './**/pyproject.toml'
90+
91+
- name: Generate overrides to use current branch if PR
8392
working-directory: ./chipflow-examples
93+
if: github.event_name == 'pull_request'
8494
run: |
85-
pdm install
86-
pdm run python -m ensurepip
87-
pdm run python -m pip install -e ../chipflow-lib
88-
- name: Run tests
95+
pdm run tools/gen_overrides.py ${{github.head_ref}} > overrides.txt
96+
echo "Generated overrides:"
97+
cat overrides.txt
98+
99+
- name: Relock PDM
89100
working-directory: ./chipflow-examples
90-
run: |
91-
pdm test
92-
pdm run chipflow pin lock
93-
pdm run chipflow silicon submit --wait
94-
env:
95-
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
101+
if: github.event_name != 'pull_request'
102+
run: pdm lock -d
96103

97-
test-submit-dry:
98-
runs-on: ubuntu-latest
99-
steps:
100-
- name: Check out source code
101-
uses: actions/checkout@v4
102-
with:
103-
fetch-depth: 0
104-
path: chipflow-lib
105-
- name: Check out chipflow-examples
106-
uses: actions/checkout@v4
107-
with:
108-
repository: ChipFlow/chipflow-examples
109-
fetch-depth: 0
110-
path: chipflow-examples
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
111108

112-
- name: Set up PDM
113-
uses: pdm-project/setup-pdm@v4
114-
with:
115-
python-version: "3.10"
116-
cache: true
117-
cache-dependency-path: "./**/pyproject.toml"
118109
- name: Install dependencies
119110
working-directory: ./chipflow-examples
120111
run: |
121112
pdm install
122113
pdm run python -m ensurepip
123114
pdm run python -m pip install -e ../chipflow-lib
115+
124116
- name: Run tests
125117
working-directory: ./chipflow-examples
126118
run: |
127119
pdm test
120+
121+
- name: Submit build ${{ env.is_dry }}
122+
run: |
128123
pdm run chipflow pin lock
129-
pdm run chipflow silicon submit --dry-run
124+
pdm run chipflow silicon submit --wait $DRY
125+
env:
126+
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}

tools/license_check.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
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
3+
4+

0 commit comments

Comments
 (0)