Skip to content

Commit 1aee622

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

File tree

2 files changed

+69
-58
lines changed

2 files changed

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

0 commit comments

Comments
 (0)