|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches-ignore: |
| 4 | + - update-yosys-* |
| 5 | + - renovate/* |
| 6 | + tags: |
| 7 | + - v* |
| 8 | + pull_request: |
| 9 | + |
| 10 | +name: CI |
| 11 | + |
| 12 | +# TODO: Print outputs on failing steps. This can be done with something like: |
| 13 | +# gzip -c cover.vcd | base64 | base64 -d | gunzip > cover-out.vcd |
| 14 | + |
| 15 | +jobs: |
| 16 | + ci-quickstart: |
| 17 | + name: Minimal Dependencies Check |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.11" |
| 24 | + - uses: pdm-project/setup-pdm@v4 |
| 25 | + with: |
| 26 | + python-version: 3.11 |
| 27 | + cache: false |
| 28 | + - uses: dtolnay/rust-toolchain@stable |
| 29 | + with: |
| 30 | + targets: riscv32i-unknown-none-elf |
| 31 | + # Simulate installing Amaranth with builtin-yosys outside of PDM. |
| 32 | + - name: Install Minimal Deps |
| 33 | + run: | |
| 34 | + pdm run python -m ensurepip |
| 35 | + pdm run python -m pip install amaranth[builtin-yosys] |
| 36 | + pdm install --prod |
| 37 | + # Test code gen both within and outside a PDM script. |
| 38 | + - name: Test Generate Verilog with Minimal Deps |
| 39 | + run: | |
| 40 | + pdm run python -m sentinel.gen -o sentinel-direct.v |
| 41 | + pdm gen -o sentinel-pdm.v |
| 42 | + - name: Test Import |
| 43 | + run: pdm run python -c 'from sentinel.top import Top' |
| 44 | + - name: Install PDM Demo Groups and Prepare YoWASP |
| 45 | + run: | |
| 46 | + pdm install -G examples -G yowasp |
| 47 | + pdm use-yowasp |
| 48 | + - name: Check Demo Bitstream Generation with Minimal Deps |
| 49 | + run: | |
| 50 | + pdm demo -i csr -p ice40_hx8k_b_evn |
| 51 | + pdm demo-rust -i csr -p ice40_hx8k_b_evn |
| 52 | +
|
| 53 | + ci-basic: |
| 54 | + name: Basic CI Check |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + os: [ubuntu-latest] |
| 58 | + runs-on: ${{ matrix.os }} |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - uses: actions/setup-python@v5 |
| 63 | + with: |
| 64 | + python-version: "3.11" |
| 65 | + - uses: pdm-project/setup-pdm@v4 |
| 66 | + with: |
| 67 | + python-version: 3.11 |
| 68 | + cache: true |
| 69 | + - uses: dtolnay/rust-toolchain@stable |
| 70 | + with: |
| 71 | + targets: riscv32i-unknown-none-elf |
| 72 | + # GCC already installed. |
| 73 | + # - name: Install riscv64 GCC (for tests) and x64 GCC Linker Driver (for Rust) |
| 74 | + # run: sudo apt install -y gcc-riscv64-unknown-elf gcc |
| 75 | + - name: Install riscv64 GCC (for tests) |
| 76 | + run: sudo apt install -y gcc-riscv64-unknown-elf |
| 77 | + - name: Set oss-cad-suite vars (for cache) |
| 78 | + run: | |
| 79 | + echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version) |
| 80 | + - name: Cache OSS CAD Suite |
| 81 | + id: cache-oss-cad-suite |
| 82 | + uses: actions/cache@v4 |
| 83 | + with: |
| 84 | + path: ~/cache/ |
| 85 | + key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }} |
| 86 | + - name: Download OSS CAD Suite |
| 87 | + if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true' |
| 88 | + run: | |
| 89 | + mkdir -p ~/cache/oss-cad-suite-linux-x64 |
| 90 | + wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz |
| 91 | + tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64 |
| 92 | + - name: Set OSS CAD Suite path |
| 93 | + run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin` |
| 94 | + - name: Install PDM dependencies |
| 95 | + run: pdm install -G examples -G dev |
| 96 | + - name: Lint |
| 97 | + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} |
| 98 | + run: | |
| 99 | + pdm install -G lint |
| 100 | + pdm run lint |
| 101 | + - name: Build docs |
| 102 | + # ReadTheDocs handles docs, this is more of a lint than anything. |
| 103 | + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} |
| 104 | + run: | |
| 105 | + pdm install -G doc |
| 106 | + pdm run doc |
| 107 | + pdm run doc-test |
| 108 | + - name: Check links |
| 109 | + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} |
| 110 | + continue-on-error: true |
| 111 | + run: | |
| 112 | + pdm install -G doc |
| 113 | + pdm run doc-linkck |
| 114 | + - name: Run Pytest/Doc Tests |
| 115 | + run: | |
| 116 | + pdm test-quick |
| 117 | + - name: Test Generate Verilog |
| 118 | + # LD_PRELOAD, which GHA seems to set by default, interferes with |
| 119 | + # oss-cad-suite setup by mixing incompatible libcs, so unset it |
| 120 | + # for any commands requiring yosys/nextpnr. |
| 121 | + run: | |
| 122 | + LD_PRELOAD="" pdm gen -o sentinel.v |
| 123 | + # Test that the following generates correctly: |
| 124 | + # 1. IceStick, Wishbone Periphs, Default demo. This is also |
| 125 | + # benchmarked in the next step separately. |
| 126 | + # 2. HX8K Eval, CSR Periphs, Rust demo |
| 127 | + - name: Check Gateware Generation |
| 128 | + run: | |
| 129 | + LD_PRELOAD="" pdm demo -n |
| 130 | + LD_PRELOAD="" pdm demo-rust -n -p ice40_hx8k_b_evn -i csr |
| 131 | + # Get an idea of whether the full default prime-counting firmware |
| 132 | + # demo fits into 1280 LUTs or exceeds it a bit. This also |
| 133 | + # checks whether a demo bitstream build was successful. |
| 134 | + # |
| 135 | + # I will remove continue-on-error once I'm confident the demo |
| 136 | + # fits into 1280 LUTs on more than just my machines (*nix/Win). |
| 137 | + # HINT: abc compiled with clang seems to optimize worse than abc |
| 138 | + # compiled with gcc, regardless of OS. |
| 139 | + - name: Benchmark Demo Bitstream |
| 140 | + continue-on-error: true |
| 141 | + run: | |
| 142 | + LD_PRELOAD="" pdm bench-luts |
| 143 | +
|
| 144 | + ci-riscof: |
| 145 | + name: RISCOF Check |
| 146 | + runs-on: ubuntu-latest |
| 147 | + steps: |
| 148 | + - uses: actions/checkout@v4 |
| 149 | + - uses: actions/setup-python@v5 |
| 150 | + with: |
| 151 | + python-version: "3.11" |
| 152 | + - uses: pdm-project/setup-pdm@v4 |
| 153 | + with: |
| 154 | + python-version: 3.11 |
| 155 | + cache: true |
| 156 | + - name: Install riscv64 GCC (for tests) |
| 157 | + run: sudo apt install -y gcc-riscv64-unknown-elf |
| 158 | + - name: Set oss-cad-suite vars (for cache) |
| 159 | + run: | |
| 160 | + echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version) |
| 161 | + - name: Cache OSS CAD Suite |
| 162 | + id: cache-oss-cad-suite |
| 163 | + uses: actions/cache@v4 |
| 164 | + with: |
| 165 | + path: ~/cache/ |
| 166 | + key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }} |
| 167 | + - name: Download OSS CAD Suite |
| 168 | + if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true' |
| 169 | + run: | |
| 170 | + mkdir -p ~/cache/oss-cad-suite-linux-x64 |
| 171 | + wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz |
| 172 | + tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64 |
| 173 | + - name: Set OSS CAD Suite path |
| 174 | + run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin` |
| 175 | + - name: Install PDM dependencies |
| 176 | + run: pdm install -G dev -G riscof |
| 177 | + - name: Run RISCOF Suite |
| 178 | + run: | |
| 179 | + LD_PRELOAD="" pdm riscof-all |
| 180 | +
|
| 181 | + ci-rvformal: |
| 182 | + name: RISC-V Formal Check |
| 183 | + runs-on: ubuntu-latest |
| 184 | + |
| 185 | + steps: |
| 186 | + - uses: actions/checkout@v4 |
| 187 | + - uses: actions/setup-python@v5 |
| 188 | + with: |
| 189 | + python-version: "3.11" |
| 190 | + - uses: pdm-project/setup-pdm@v4 |
| 191 | + with: |
| 192 | + python-version: 3.11 |
| 193 | + cache: true |
| 194 | + - name: Install riscv64 GCC (for tests) |
| 195 | + run: sudo apt install -y gcc-riscv64-unknown-elf |
| 196 | + - name: Set oss-cad-suite vars (for cache) |
| 197 | + run: | |
| 198 | + echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version) |
| 199 | + - name: Cache OSS CAD Suite |
| 200 | + id: cache-oss-cad-suite |
| 201 | + uses: actions/cache@v4 |
| 202 | + with: |
| 203 | + path: ~/cache/ |
| 204 | + key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }} |
| 205 | + - name: Download OSS CAD Suite |
| 206 | + if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true' |
| 207 | + run: | |
| 208 | + mkdir -p ~/cache/oss-cad-suite-linux-x64 |
| 209 | + wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz |
| 210 | + tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64 |
| 211 | + - name: Set OSS CAD Suite path |
| 212 | + run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin` |
| 213 | + - name: Install PDM dependencies |
| 214 | + run: pdm install -G dev |
| 215 | + - name: Run RISC-V Formal |
| 216 | + run: | |
| 217 | + LD_PRELOAD="" pdm rvformal-all |
0 commit comments