Skip to content

Commit 6eef960

Browse files
committed
Move testing examples to reusable workflow
1 parent 52096f8 commit 6eef960

File tree

2 files changed

+71
-58
lines changed

2 files changed

+71
-58
lines changed

.github/workflows/main.yaml

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -45,61 +45,6 @@ jobs:
4545
run: ./tools/license_check.sh
4646

4747
test-submit:
48-
runs-on: ubuntu-latest
49-
strategy:
50-
matrix:
51-
dry: [true, false]
52-
repo:
53-
- name: "ChipFlow/chipflow-examples"
54-
design: "minimal"
55-
env:
56-
DRY: ${{ matrix.dry && '--dry-run' || '' }}
57-
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
58-
our_path: "${{ github.workspace}}/${{ github.repo }}"
59-
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
60-
61-
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
62-
63-
steps:
64-
- name: Check out source code
65-
uses: actions/checkout@v4
66-
with:
67-
path: ${{ env.our_path }}
68-
69-
- name: Check out ${{ matrix.repo.name }}
70-
uses: actions/checkout@v4
71-
with:
72-
repository: ${{ matrix.repo.name }}
73-
path: ${{ env.test_repo_path }}
74-
75-
- name: Check for branch ${{ github.head_ref }}
76-
working-directory: ${{ env.test_repo_path }}
77-
if: github.event_name == 'pull_request'
78-
run: |
79-
git remote update
80-
git checkout ${{ github.head_ref }} || echo "Falling back to main"
81-
82-
- name: Set up PDM
83-
uses: pdm-project/setup-pdm@v4
84-
with:
85-
python-version: '3.10'
86-
cache: true
87-
cache-dependency-path: './**/pyproject.toml'
88-
89-
- name: Install dependencies with multirepo
90-
uses: chipflow/pdm-multirepo@v1
91-
with:
92-
working-directory: ${{ env.test_repo_path }}
93-
94-
- name: Run tests
95-
working-directory: ${{ env.test_repo_path }}
96-
run: |
97-
pdm test
98-
99-
- name: Submit build ${{ env.is_dry }}
100-
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
101-
run: |
102-
pdm run chipflow pin lock
103-
pdm run chipflow silicon submit --wait $DRY
104-
env:
105-
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
48+
uses: ./.github/workflows/test-examples.yml
49+
secrets:
50+
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Reusable workflow to test everything in chipflow-examples works
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
CHIPFLOW_API_KEY:
7+
required: true
8+
9+
jobs:
10+
test-submit:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
dry: [true, false]
15+
repo:
16+
- name: "ChipFlow/chipflow-examples"
17+
design: "minimal"
18+
env:
19+
DRY: ${{ matrix.dry && '--dry-run' || '' }}
20+
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
21+
our_path: "${{ github.workspace}}/${{ github.repo }}"
22+
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
23+
24+
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
25+
26+
steps:
27+
- name: Check out source code
28+
uses: actions/checkout@v4
29+
with:
30+
path: ${{ env.our_path }}
31+
32+
- name: Check out ${{ matrix.repo.name }}
33+
uses: actions/checkout@v4
34+
with:
35+
repository: ${{ matrix.repo.name }}
36+
path: ${{ env.test_repo_path }}
37+
38+
- name: Check for branch ${{ github.head_ref }}
39+
working-directory: ${{ env.test_repo_path }}
40+
if: github.event_name == 'pull_request'
41+
run: |
42+
git remote update
43+
git checkout ${{ github.head_ref }} || echo "Falling back to main"
44+
45+
- name: Set up PDM
46+
uses: pdm-project/setup-pdm@v4
47+
with:
48+
python-version: '3.10'
49+
cache: true
50+
cache-dependency-path: './**/pyproject.toml'
51+
52+
- name: Install dependencies with multirepo
53+
uses: chipflow/pdm-multirepo@v1
54+
with:
55+
working-directory: ${{ env.test_repo_path }}
56+
57+
- name: Run tests
58+
working-directory: ${{ env.test_repo_path }}
59+
run: |
60+
pdm test
61+
62+
- name: Submit build ${{ env.is_dry }}
63+
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
64+
run: |
65+
pdm run chipflow pin lock
66+
pdm run chipflow silicon submit --wait $DRY
67+
env:
68+
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}

0 commit comments

Comments
 (0)