Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
pull_request:
branches: ["main"]

env:
BITSTREAM: build/lowrisc_mocha_chip_mocha_genesys2_0/synth-vivado/lowrisc_mocha_chip_mocha_genesys2_0.bit
UTILIZATION_FILE: build/lowrisc_mocha_chip_mocha_genesys2_0/synth-vivado/lowrisc_mocha_chip_mocha_genesys2_0.runs/impl_1/chip_mocha_genesys2_utilization_placed.rpt

jobs:
lint-check:
runs-on: ["self-hosted", "nixos", "X64"]
Expand Down Expand Up @@ -110,7 +114,9 @@ jobs:
- uses: actions/cache@v5
id: cache
with:
path: build/lowrisc_mocha_chip_mocha_genesys2_0/synth-vivado/lowrisc_mocha_chip_mocha_genesys2_0.bit
path: |
${{ env.BITSTREAM }}
${{ env.UTILIZATION_FILE }}
key: ${{ steps.hash-bitstream.outputs.hash }}
lookup-only: true

Expand Down Expand Up @@ -141,7 +147,9 @@ jobs:

- uses: actions/cache@v5
with:
path: build/lowrisc_mocha_chip_mocha_genesys2_0/synth-vivado/lowrisc_mocha_chip_mocha_genesys2_0.bit
path: |
${{ env.BITSTREAM }}
${{ env.UTILIZATION_FILE }}
key: ${{ needs.fpga-build.outputs.bitstream-hash }}
fail-on-cache-miss: true

Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright lowRISC Contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: Release

permissions:
contents: write

on:
release:
types: [created]

jobs:
# This job will only succeed if a bitstream was published by a previous CI run to make sure it
# passed the tests.
bistream-release:
runs-on: ["self-hosted", "nixos", "X64"]
env:
ARTEFACT: build/lowrisc_mocha_chip_mocha_genesys2_0/synth-vivado/lowrisc_mocha_chip_mocha_genesys2_0.bit

steps:
- uses: actions/checkout@v5

- name: Hash Bitstream
id: hash-bitstream
run: |
echo "hash=$(nix run .#bitstream-hash)" >> $GITHUB_OUTPUT

- uses: actions/cache@v5
id: cache
with:
path: ${{ env.ARTEFACT }}
key: ${{ steps.hash-bitstream.outputs.hash }}
fail-on-cache-miss: true

- uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
prerelease: true
files: ${{ env.ARTEFACT }}


verilator-release:
runs-on: ["self-hosted", "nixos", "X64"]
env:
ARTEFACT: build/lowrisc_mocha_top_chip_verilator_0/sim-verilator/Vtop_chip_verilator

defaults:
run:
shell: "nix develop -c bash -e {0}"

steps:
- uses: actions/checkout@v5

- name: Prepare Nix environment
run: |
true

- name: Build verilator
run: |
JOBS=$(($(nproc) / 2))
MAKEFLAGS="-j$JOBS" fusesoc --cores-root=. run --target=sim --tool=verilator --setup --build lowrisc:mocha:top_chip_verilator

- uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
prerelease: true
files: ${{ env.ARTEFACT }}

software-release:
runs-on: ["self-hosted", "nixos", "X64"]
env:
SOURCE: build/sw/device/examples
ARTEFACT: examples.tar.gz

defaults:
run:
shell: "nix develop -c bash -e {0}"

steps:
- uses: actions/checkout@v5

- name: Prepare Nix environment
run: |
true

- name: Generate artefacts
run: |
cmake -B build/sw -S sw
cmake --build build/sw -j $(nproc) --target hello_world
cmake --install build/sw/ --prefix release --component hello_world
tar -czvf ${{ env.ARTEFACT }} release

- uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
prerelease: true
files: ${{ env.ARTEFACT }}
1 change: 1 addition & 0 deletions sw/cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ macro(mocha_add_executable_artefacts NAME)

install(TARGETS ${NAME} DESTINATION . COMPONENT ${NAME})
install(FILES "$<TARGET_FILE:${NAME}>.vmem" DESTINATION . COMPONENT ${NAME})
install(FILES "$<TARGET_FILE:${NAME}>.bin" DESTINATION . COMPONENT ${NAME})
endmacro()

# for a given executable, add a test that runs the executable
Expand Down