Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Reusable workflow to test everything in chipflow-examples works | ||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| CHIPFLOW_API_KEY: | ||
| required: true | ||
| jobs: | ||
| test-all: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| dry: [true, false] | ||
| repo: | ||
| - name: "ChipFlow/chipflow-examples" | ||
| design: "minimal" | ||
| env: | ||
| DRY: ${{ matrix.dry && '--dry-run' || '' }} | ||
| is_dry: ${{ matrix.dry && '(dry run)' || '' }} | ||
| our_path: "${{ github.workspace}}/${{ github.repo }}" | ||
| test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}" | ||
| name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }} | ||
| 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' | ||
| run: | | ||
| git remote update | ||
| git checkout ${{ github.head_ref }} | ||
| if [ $? -eq 0 ]; then | ||
| echo "Using branch ${{github.head_ref}}" | ||
| echo "found-branch=1\n" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "${{github.head_ref}} not found, checking base ${{github.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 == 0 | ||
| run: | | ||
| git remote update | ||
| git checkout ${{ github.base_ref }} | ||
| if [ $? -eq 0 ]; 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@v3 | ||
| with: | ||
| working-directory: ${{ env.test_repo_path }} | ||
| - name: Run tests | ||
| working-directory: ${{ env.test_repo_path }} | ||
| run: | | ||
| pdm test-cov | ||
| - name: Run sim | ||
| working-directory: ${{ env.test_repo_path }} | ||
| run: | | ||
| pdm run coverage run -a chipflow pin lock | ||
| pdm run coverage run -a chipflow sim | ||
| pdm run coverage run -a chipflow software | ||
| ./build/sim/sim_soc | ||
| - name: Submit build ${{ env.is_dry }} | ||
| working-directory: ${{ env.test_repo_path }}/${{ matrix.repo.design }} | ||
| run: | | ||
| pdm run coverage run -a chipflow pin lock | ||
| pdm run coverage run -a chipflow silicon submit --wait $DRY | cat | ||
| mv .coverage .coverage-${{matrix.repo.name}}-${{matrix.dry}} | ||
| env: | ||
| CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}} | ||
| - name: Upload coverage artefact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-${{matrix.repo.name}}-${{matrix.dry}} | ||
| path: .coverage-${{matrix.repo.name}}-${{matrix.dry}} | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| needs: [test-all] | ||
| steps: | ||
| - name: Fetch coverage artefacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: coverage/ | ||
| merge-multiple: true | ||
| - name: Combine coverage artefacts | ||
| run: pdm coverage combine coverage/ | ||
| - name: Generate coverage report | ||
| run: pdm coverage html | ||
| - name: upload html coverage artifact | ||
| uses: actions/upload-pages-artifact@v1 | ||
| with: | ||
| path: './htmlcov/' | ||
| - name: deploy to Github Pages | ||
| uses: actions/deploy-pages@v2 | ||
| id: deployment | ||