[proj] UART D1 sign-off #1453
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
| # Copyright lowRISC Contributors (COSMIC project). | |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| 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"] | |
| defaults: | |
| run: | |
| shell: "nix develop -c bash -e {0}" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Prepare Nix environment | |
| run: | | |
| true | |
| - name: License check | |
| run: | | |
| reuse lint | |
| - name: Check auto-generated artefacts | |
| run: | | |
| util/artefacts.py --check | |
| - name: Lint - Ruff | |
| run: | | |
| ruff check | |
| - name: Generate software buildsystem | |
| run: | | |
| cmake -B build/sw -S sw | |
| - name: Lint - Clang Format | |
| run: | | |
| util/clang_format.py -i --dry-run -Werror | |
| - name: Lint - Clang Tidy | |
| run: | | |
| util/clang_tidy.py | |
| verilator-test: | |
| runs-on: ["self-hosted", "nixos", "X64"] | |
| needs: lint-check | |
| defaults: | |
| run: | |
| shell: "nix develop -c bash -e {0}" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Prepare Nix environment | |
| run: | | |
| true | |
| - name: Generate software buildsystem | |
| run: | | |
| cmake -B build/sw -S sw | |
| - name: Build software | |
| run: | | |
| cmake --build build/sw -j $(nproc) | |
| - name: Build verilator | |
| run: | | |
| JOBS=$(($(nproc) / 4)) | |
| MAKEFLAGS="-j$JOBS" fusesoc --cores-root=. run --target=sim --tool=verilator --setup --build lowrisc:mocha:top_chip_verilator | |
| - name: Run verilator software tests | |
| # Exclude tests marked 'slow' from quick CI runs. | |
| run: | | |
| ctest --test-dir build/sw -R sim_verilator -LE slow --output-on-failure -j $(nproc) | |
| fpga-cache-check: | |
| runs-on: ["self-hosted", "nixos", "X64"] | |
| needs: lint-check | |
| outputs: | |
| bitstream-hash: ${{ steps.hash-bitstream.outputs.hash }} | |
| cache-hit: ${{ steps.cache.outputs.cache-hit }} | |
| 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.BITSTREAM }} | |
| ${{ env.UTILIZATION_FILE }} | |
| key: ${{ steps.hash-bitstream.outputs.hash }} | |
| lookup-only: true | |
| fpga-build: | |
| if: needs.fpga-cache-check.outputs.cache-hit != 'true' | |
| runs-on: ["ubuntu-22.04-bitstream"] | |
| needs: [verilator-test, fpga-cache-check] | |
| outputs: | |
| bitstream-hash: ${{ steps.hash-bitstream.outputs.hash }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # This step is a workaround and should be removed when the container is fixed. | |
| - name: Uninstall Nix | |
| run: | | |
| sudo rm -rf /etc/nix /etc/profile.d/nix.sh /etc/tmpfiles.d/nix-daemon.conf \ | |
| /nix ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile ~root/.cache/nix | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v27 | |
| with: | |
| extra_nix_config: | | |
| substituters = https://nix-cache.lowrisc.org/public/ https://cache.nixos.org/ | |
| trusted-public-keys = nix-cache.lowrisc.org-public-1:O6JLD0yXzaJDPiQW1meVu32JIDViuaPtGDfjlOopU7o= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
| - uses: actions/cache@v5 | |
| id: cache | |
| with: | |
| path: | | |
| ${{ env.BITSTREAM }} | |
| ${{ env.UTILIZATION_FILE }} | |
| key: ${{ needs.fpga-cache-check.outputs.bitstream-hash }} | |
| - name: Build bitstream | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| module load xilinx/vivado | |
| nix run .#bitstream-build | |
| fpga-test: | |
| runs-on: ["self-hosted", "ubuntu-22.04-fpga", "genesys2"] | |
| if: always() && (needs.fpga-build.result == 'success' || needs.fpga-build.result == 'skipped') | |
| needs: [fpga-cache-check, fpga-build] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # This step is a workaround and should be removed when the container is fixed. | |
| - name: Uninstall Nix | |
| run: | | |
| sudo rm -rf /etc/nix /etc/profile.d/nix.sh /etc/tmpfiles.d/nix-daemon.conf \ | |
| /nix ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile ~root/.cache/nix | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v27 | |
| with: | |
| extra_nix_config: | | |
| substituters = https://nix-cache.lowrisc.org/public/ https://cache.nixos.org/ | |
| trusted-public-keys = nix-cache.lowrisc.org-public-1:O6JLD0yXzaJDPiQW1meVu32JIDViuaPtGDfjlOopU7o= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ${{ env.BITSTREAM }} | |
| ${{ env.UTILIZATION_FILE }} | |
| key: ${{ needs.fpga-cache-check.outputs.bitstream-hash }} | |
| fail-on-cache-miss: true | |
| - name: Build software | |
| shell: "nix develop -c bash -e {0}" | |
| run: | | |
| cmake -B build/sw -S sw | |
| cmake --build build/sw -j $(nproc) | |
| - name: Flash bitstream | |
| run: | | |
| nix run .#bitstream-load | |
| - name: Run FPGA tests | |
| # Exclude tests marked 'slow' from quick CI runs. | |
| shell: "nix develop -c bash -e {0}" | |
| run: | | |
| ctest --test-dir build/sw -R fpga -LE slow --output-on-failure |