diff --git a/.github/workflows/_cocotb_test.yml b/.github/workflows/_cocotb_test.yml new file mode 100644 index 000000000..f1b97d517 --- /dev/null +++ b/.github/workflows/_cocotb_test.yml @@ -0,0 +1,37 @@ +on: + workflow_call: + +jobs: + cocotb_test: + strategy: + fail-fast: false + runs-on: + group: iris_runners + container: + image: ghcr.io/pandablocks/pandablocks-dev-container:latest + options: --privileged + + steps: + + # Git repositories + - name: Checkout Source + uses: actions/checkout@v4 + with: + path: repos/PandABlocks-fpga + # require history to get back to last tag for version number of branches + fetch-depth: 0 + + - name: Checkout rootfs and Give Directory Perms + uses: ./repos/PandABlocks-fpga/.github/actions/setupenv + + - name: Run cocotb tests + run: | + cd PandABlocks-fpga && ln -s CONFIG.example CONFIG && make cocotb_tests + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + name: nvc-coverage + files: cocotb_coverage.xml + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 5bc0d36c9..9d118d576 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -20,46 +20,9 @@ jobs: make_zpkg: uses: ./.github/workflows/_make_zpkg.yml + # cocotb tests cocotb_test: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository - strategy: - fail-fast: false - - runs-on: ubuntu-latest - steps: - - # Git repositories - - name: Checkout Source - uses: actions/checkout@v2 - with: - path: PandABlocks-fpga - # require history to get back to last tag for version number of branches - fetch-depth: 0 - - # Login into ghcr - - name: login to ghcr - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Run cocotb tests - run: | - docker pull ghcr.io/pandablocks/pandablocks-dev-container:4.0a7 - docker run \ - --net=host \ - -v "${{ github.workspace }}:/repos" \ - -v "${{ github.workspace }}/build:/build" \ - ghcr.io/pandablocks/pandablocks-dev-container:4.0a7 \ - /bin/bash -c \ - "cd PandABlocks-fpga && ln -s CONFIG.example CONFIG && make cocotb_tests" - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - name: nvc-coverage - files: cocotb_coverage.xml - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + uses: ./.github/workflows/_cocotb_test.yml release: needs: [ make_boot, make_zpkg, test_hdl, test_matrix, test_python_autogen, cocotb_test ] @@ -78,4 +41,5 @@ jobs: needs: [test_matrix, test_python_autogen] uses: ./.github/workflows/_test_hdl.yml with: - matrix: ${{needs.test_matrix.outputs.matrix}} \ No newline at end of file + matrix: ${{needs.test_matrix.outputs.matrix}} +