Skip to content

Commit e9b3f22

Browse files
committed
Use overrides for using the same branchname over multiple repos
1 parent 95ac3d8 commit e9b3f22

File tree

7 files changed

+151
-179
lines changed

7 files changed

+151
-179
lines changed

.github/workflows/coverage.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
name: pytest-coverage-comment
44
on:
55
pull_request:
6-
branches:
7-
- '*'
86

97
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
108
# `contents` is for permission to the contents of the repository.
@@ -18,16 +16,15 @@ jobs:
1816
build:
1917
runs-on: ubuntu-latest
2018
steps:
21-
- uses: actions/checkout@v3
22-
with:
23-
fetch-depth: 0
19+
- uses: actions/checkout@v4
2420

2521
- name: Set up PDM
2622
uses: pdm-project/setup-pdm@v4
23+
with:
24+
cache: true
2725

28-
- name: Install dependencies
29-
run: |
30-
pdm install
26+
- name: Install dependencies with multirepo
27+
uses: chipflow/pdm-multirepo@v1
3128

3229
- name: Build coverage file
3330
run: |

.github/workflows/deploy-docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
- name: Setup PDM
1414
uses: pdm-project/setup-pdm@v4
1515
with:
16-
python-version: 3.12
1716
cache: true
1817

1918
- name: Install dependencies

.github/workflows/main.yaml

Lines changed: 42 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ jobs:
1818

1919
- name: Set up PDM
2020
uses: pdm-project/setup-pdm@v4
21+
with:
22+
cache: true
2123

22-
- name: Re-lock PDM dependencies
23-
run: pdm lock -d
24-
25-
- name: Install dependencies
26-
run: pdm install
24+
- name: Install dependencies with multirepo
25+
uses: chipflow/pdm-multirepo@v1
2726

2827
- name: Run tests
2928
run: pdm run test
@@ -42,89 +41,64 @@ jobs:
4241
with:
4342
fetch-depth: 0
4443
- 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
44+
run: ./tools/license_check.sh
4745

4846
test-submit:
4947
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
dry: [true, false]
51+
repo:
52+
- name: "ChipFlow/chipflow-examples"
53+
design: "minimal"
54+
env:
55+
DRY: ${{ matrix.dry && '--dry-run' || '' }}
56+
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
57+
our_path: "${{ github.workspace}}/${{ github.repo }}"
58+
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
59+
60+
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
61+
5062
steps:
5163
- name: Check out source code
5264
uses: actions/checkout@v4
5365
with:
54-
fetch-depth: 0
55-
path: chipflow-lib
66+
path: ${{ env.our_path }}
5667

57-
- name: Check out chipflow-examples
68+
- name: Check out ${{ matrix.repo.name }}
5869
uses: actions/checkout@v4
5970
with:
60-
repository: ChipFlow/chipflow-examples
61-
fetch-depth: 0
62-
path: chipflow-examples
63-
64-
- name: Set up PDM
65-
uses: pdm-project/setup-pdm@v4
66-
with:
67-
python-version: "3.10"
68-
cache: true
69-
cache-dependency-path: "./**/pyproject.toml"
71+
repository: ${{ matrix.repo.name }}
72+
path: ${{ env.test_repo_path }}
7073

71-
- name: Re-lock PDM dependencies
72-
working-directory: ./chipflow-examples
73-
run: pdm lock -d
74-
75-
- name: Install dependencies
76-
working-directory: ./chipflow-examples
74+
- name: Check for branch ${{ github.head_ref }}
75+
working-directory: ${{ env.test_repo_path }}
76+
if: github.event_name == 'pull_request'
7777
run: |
78-
pdm install
79-
pdm run python -m ensurepip
80-
pdm run python -m pip install -e ../chipflow-lib
81-
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
78+
git remote update
79+
git checkout ${{ github.head_ref }} || echo "Falling back to main"
10680
10781
- name: Set up PDM
10882
uses: pdm-project/setup-pdm@v4
10983
with:
110-
python-version: "3.10"
84+
python-version: '3.10'
11185
cache: true
112-
cache-dependency-path: "./**/pyproject.toml"
113-
114-
- name: Re-lock PDM dependencies
115-
working-directory: ./chipflow-examples
116-
run: pdm lock -d
86+
cache-dependency-path: './**/pyproject.toml'
11787

118-
- name: Install dependencies
119-
working-directory: ./chipflow-examples
120-
run: |
121-
pdm install
122-
pdm run python -m ensurepip
123-
pdm run python -m pip install -e ../chipflow-lib
88+
- name: Install dependencies with multirepo
89+
uses: chipflow/pdm-multirepo@v1
90+
with:
91+
working-directory: ${{ env.test_repo_path }}
12492

12593
- name: Run tests
126-
working-directory: ./chipflow-examples/minimal
94+
working-directory: ${{ env.test_repo_path }}
12795
run: |
12896
pdm test
97+
98+
- name: Submit build ${{ env.is_dry }}
99+
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
100+
run: |
129101
pdm run chipflow pin lock
130-
pdm run chipflow silicon submit --dry-run
102+
pdm run chipflow silicon submit --wait $DRY
103+
env:
104+
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}

.github/workflows/preview-docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ jobs:
1717
- name: Setup PDM
1818
uses: pdm-project/setup-pdm@v4
1919
with:
20-
python-version: 3.12
2120
cache: true
2221

23-
- name: Install dependencies
24-
run: pdm install
22+
- name: Install dependencies with multirepo
23+
uses: chipflow/pdm-multirepo@v1
2524

2625
- name: Build docs
2726
run: pdm docs

0 commit comments

Comments
 (0)