Skip to content

Commit 234104d

Browse files
committed
Move testing examples to reusable workflow
1 parent e9b3f22 commit 234104d

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
@@ -44,61 +44,6 @@ 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
48+
secrets:
49+
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)