Skip to content

Commit 57d00e3

Browse files
committed
wip
1 parent 9b26295 commit 57d00e3

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

.github/workflows/test-examples.yml

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
CHIPFLOW_API_KEY:
77
required: true
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
test-all:
1114
runs-on: ubuntu-latest
@@ -15,6 +18,7 @@ jobs:
1518
repo:
1619
- name: "ChipFlow/chipflow-examples"
1720
design: "minimal"
21+
artifact: chipflow-examples
1822
env:
1923
DRY: ${{ matrix.dry && '--dry-run' || '' }}
2024
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
@@ -36,18 +40,34 @@ jobs:
3640
path: ${{ env.test_repo_path }}
3741

3842
- name: Check for branch ${{ github.head_ref }}
43+
id: check-head-ref
3944
working-directory: ${{ env.test_repo_path }}
4045
if: github.event_name == 'pull_request'
4146
run: |
4247
git remote update
43-
git checkout ${{ github.head_ref }} || echo "${{github.head_ref}} not found, checking base ${{github.base_ref}}"
48+
git checkout ${{ github.head_ref }}
49+
if [ $? -eq 0 ]; then
50+
echo "Using branch ${{github.head_ref}}"
51+
echo "found-branch=1\n" >> $GITHUB_OUTPUT
52+
else
53+
echo "${{github.head_ref}} not found, checking base ${{github.base_ref}}"
54+
echo "found-branch=0\n" >> $GITHUB_OUTPUT
55+
fi
4456
4557
- name: Check for branch ${{ github.base_ref }}
46-
working-directory: ${{ env.test_repo_path }}
47-
if: github.event_name == 'pull_request'
58+
id: check-base-ref
59+
working-directory: ${{ env.test_repo_path }}x
60+
if: github.event_name == 'pull_request' && steps.check-head-ref == 0
4861
run: |
4962
git remote update
50-
git checkout ${{ github.base_ref }} || echo "${{github.base_ref}} not found Falling back to main"
63+
git checkout ${{ github.base_ref }}
64+
if [ $? -eq 0 ]; then
65+
echo "Using branch ${{github.base_ref}}"
66+
echo "found-branch=1\n" >> $GITHUB_OUTPUT
67+
else
68+
|| echo "${{github.base_ref}} not found Falling back to main"
69+
echo "found-branch=0\n" >> $GITHUB_OUTPUT
70+
fi
5171
5272
5373
- name: Set up PDM
@@ -68,44 +88,30 @@ jobs:
6888
pdm test-cov
6989
7090
- name: Run sim
71-
working-directory: ${{ env.test_repo_path }}
91+
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
7292
run: |
73-
pdm run coverage run -a chipflow pin lock
74-
pdm run coverage run -a chipflow sim
75-
pdm run coverage run -a chipflow software
93+
pdm run coverage run -a ../.venv/bin/chipflow pin lock
94+
pdm run coverage run -a ../.venv/bin/chipflow sim
95+
pdm run coverage run -a ../.venv/bin/chipflow software
7696
./build/sim/sim_soc
7797
7898
- name: Submit build ${{ env.is_dry }}
7999
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
80100
run: |
81-
pdm run coverage run -a chipflow pin lock
82-
pdm run coverage run -a chipflow silicon submit --wait $DRY | cat
83-
mv .coverage .coverage-${{matrix.repo.name}}-${{matrix.dry}}
101+
pdm run coverage run -a ../.venv/bin/chipflow pin lock
102+
pdm run coverage run -a ../.venv/bin/chipflow silicon submit --wait $DRY | cat
84103
env:
85104
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
86105

87-
- name: Upload coverage artefact
88-
uses: actions/upload-artifact@v4
89-
with:
90-
name: coverage-${{matrix.repo.name}}-${{matrix.dry}}
91-
path: .coverage-${{matrix.repo.name}}-${{matrix.dry}}
92-
93-
coverage:
94-
needs: [test-all]
95-
steps:
96-
- name: Fetch coverage artefacts
97-
uses: actions/download-artifact@v4
98-
with:
99-
path: coverage/
100-
merge-multiple: true
101-
- name: Combine coverage artefacts
102-
run: pdm coverage combine coverage/
103106
- name: Generate coverage report
104-
run: pdm coverage html
105-
- name: upload html coverage artifact
106-
uses: actions/upload-pages-artifact@v1
107-
with:
108-
path: './htmlcov/'
107+
working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }}
108+
run: pdm run coverage html
109+
109110
- name: deploy to Github Pages
110-
uses: actions/deploy-pages@v2
111-
id: deployment
111+
uses: JamesIves/github-pages-deploy-action@v4
112+
with:
113+
folder: '${{ env.test_repo_path }}/${{ matrix.repo.design }}/htmlcov/'
114+
branch: gh-pages
115+
clean: false
116+
force: false
117+
target-folder: coverage-${{matrix.artifact}}-${{matrix.dry}}

0 commit comments

Comments
 (0)