Skip to content

Commit d84e844

Browse files
committed
Move testing examples to reusable workflow
1 parent 0ce8de2 commit d84e844

File tree

2 files changed

+63
-56
lines changed

2 files changed

+63
-56
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -42,59 +42,4 @@ jobs:
4242
run: ./tools/license_check.sh
4343

4444
test-submit:
45-
runs-on: ubuntu-latest
46-
strategy:
47-
matrix:
48-
dry: [true, false]
49-
repo:
50-
- name: "ChipFlow/chipflow-examples"
51-
design: "minimal"
52-
env:
53-
DRY: ${{ matrix.dry && '--dry-run' || '' }}
54-
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
55-
our_path: "${{ github.workspace}}/${{ github.repo }}"
56-
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
57-
58-
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
59-
60-
steps:
61-
- name: Check out source code
62-
uses: actions/checkout@v4
63-
with:
64-
path: ${{ env.our_path }}
65-
66-
- name: Check out ${{ matrix.repo.name }}
67-
uses: actions/checkout@v4
68-
with:
69-
repository: ${{ matrix.repo.name }}
70-
path: ${{ env.test_repo_path }}
71-
72-
- name: Check for branch ${{ github.head_ref }}
73-
working-directory: ${{ env.test_repo_path }}
74-
if: github.event_name == 'pull_request'
75-
run: |
76-
git remote update
77-
git checkout ${{ github.head_ref }} || echo "Falling back to main"
78-
79-
- name: Set up PDM
80-
uses: pdm-project/setup-pdm@v4
81-
with:
82-
python-version: '3.10'
83-
cache: true
84-
cache-dependency-path: './**/pyproject.toml'
85-
86-
- name: Install dependencies with multirepo
87-
uses: chipflow/pdm-multirepo@v1
88-
89-
- name: Run tests
90-
working-directory: ${{ env.test_repo_path }}
91-
run: |
92-
pdm test
93-
94-
- name: Submit build ${{ env.is_dry }}
95-
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
96-
run: |
97-
pdm run chipflow pin lock
98-
pdm run chipflow silicon submit --wait $DRY
99-
env:
100-
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
45+
uses: ./.github/workflows/test-examples.yml
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
51+
- name: Run tests
52+
working-directory: ${{ env.test_repo_path }}
53+
run: |
54+
pdm test
55+
56+
- name: Submit build ${{ env.is_dry }}
57+
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
58+
run: |
59+
pdm run chipflow pin lock
60+
pdm run chipflow silicon submit --wait $DRY
61+
env:
62+
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}

0 commit comments

Comments
 (0)