-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (110 loc) · 3.91 KB
/
test-examples.yml
File metadata and controls
125 lines (110 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Reusable workflow to test everything in chipflow-examples works
on:
workflow_call:
secrets:
CHIPFLOW_API_KEY:
required: true
inputs:
CHIPFLOW_API_ORIGIN:
required: true
type: string
CHIPFLOW_BACKEND_VERSION:
required: true
type: string
ENVIRONMENT:
required: true
type: string
jobs:
test-submit:
runs-on: ubuntu-latest
environment: ${{ vars.ENVIRONMENT }}
strategy:
matrix:
repo:
- name: "ChipFlow/chipflow-examples"
design: "minimal"
- name: "ChipFlow/chipflow-examples"
design: "mcu_soc"
env:
our_path: ${{ github.workspace}}
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
name: 'Submit examples: ${{matrix.repo.design}}'
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
path: ${{ env.our_path }}
- name: Check out ${{ matrix.repo.name }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo.name }}
path: ${{ env.test_repo_path }}
- name: Check for branch ${{ github.head_ref }}
id: check-head-ref
working-directory: ${{ env.test_repo_path }}
if: github.event_name == 'pull_request'
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
git remote update
if git checkout $HEAD_REF; then
echo "Using branch $HEAD_REF"
echo "found-branch=1\n" >> $GITHUB_OUTPUT
else
echo "$HEAD_REF not found, checking base $BASE_REF"
echo "found-branch=0\n" >> $GITHUB_OUTPUT
fi
- name: Check for branch ${{ github.base_ref }}
id: check-base-ref
working-directory: ${{ env.test_repo_path }}x
if: github.event_name == 'pull_request' && steps.check-head-ref.outputs.found-branch == '0'
run: |
git remote update
if git checkout ${{ github.base_ref }}; then
echo "Using branch ${{github.base_ref}}"
echo "found-branch=1\n" >> $GITHUB_OUTPUT
else
|| echo "${{github.base_ref}} not found Falling back to main"
echo "found-branch=0\n" >> $GITHUB_OUTPUT
fi
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.10'
cache: true
cache-dependency-path: './**/pyproject.toml'
- name: Install dependencies with multirepo
uses: chipflow/pdm-multirepo@v4
with:
working-directory: ${{ env.test_repo_path }}
- name: Run tests
working-directory: ${{ env.test_repo_path }}
run: |
pdm test
- name: Run simulation check
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
run: |
pdm run chipflow pin lock
pdm sim-check
- name: Submit build dry run
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
run: |
set -o pipefail
pdm run chipflow silicon submit --dry-run
- name: Upload build artefacts
uses: actions/upload-artifact@v4
with:
name: submit-artefacts-${{ matrix.repo.design }}
path: |
${{ env.test_repo_path }}/${{ matrix.repo.design }}/rtlil
${{ env.test_repo_path }}/${{ matrix.repo.design }}/config
- name: Submit build (Dry - backend submit currently disabled)
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
run: |
set -o pipefail
pdm run chipflow silicon submit --wait --dry | cat
env:
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
CHIPFLOW_API_ORIGIN: ${{ inputs.CHIPFLOW_API_ORIGIN }}
CHIPFLOW_BACKEND_VERSION: ${{ inputs.CHIPFLOW_BACKEND_VERSION }}