Skip to content

Commit 561f293

Browse files
committed
Move testing examples to reusable workflow
1 parent 28aa2f5 commit 561f293

File tree

2 files changed

+65
-58
lines changed

2 files changed

+65
-58
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -44,61 +44,4 @@ jobs:
4444
run: ./tools/license_check.sh
4545

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

0 commit comments

Comments
 (0)