Set up RISCOF #79
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: risc-v CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build_ci_image: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
outputs: | |
image-tag: ${{ steps.meta.outputs.tags }} | |
image-primary-tag: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | |
image-digest: ${{ steps.build.outputs.digest }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/utoss/risc-v | |
tags: | | |
type=ref,event=branch,prefix=ci-branch- | |
type=ref,event=pr,prefix=ci-pr- | |
type=raw,value=latest,prefix=ci-,enable={{is_default_branch}} | |
- name: Build and push Docker image | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.ci | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
cache-from: | | |
type=gha | |
type=registry,ref=ghcr.io/utoss/risc-v:buildcache | |
cache-to: | | |
type=gha,mode=max | |
type=registry,ref=ghcr.io/utoss/risc-v:buildcache,mode=max | |
build_and_test: | |
timeout-minutes: 30 | |
needs: build_ci_image | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.build_ci_image.outputs.image-primary-tag }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build top | |
id: build-top | |
run: make build_top | |
- name: Build testbench | |
id: build-testbench | |
run: make build_tb | |
- name: Run testbench | |
run: make run_tb | |
- name: Upload VCD files | |
uses: actions/upload-artifact@v4 | |
if: steps.build-testbench.outcome == 'success' | |
with: | |
name: vcd-files | |
path: test/vcd/*.vcd | |
retention-days: 7 | |
- name: Upload VVP files | |
uses: actions/upload-artifact@v4 | |
if: steps.build-top.outcome == 'success' | |
with: | |
name: vvp-files | |
path: out/*.vvp | |
retention-days: 7 | |
riscof: | |
timeout-minutes: 30 | |
needs: [build_ci_image, build_and_test] | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ needs.build_ci_image.outputs.image-primary-tag }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build DUT | |
run: make riscof_build_dut | |
- name: Validate YAML | |
run: make riscof_validateyaml | |
- name: Clone arch-test | |
run: make riscof_clone_archtest | |
- name: Run RISCOF | |
run: make riscof_run |