|
| 1 | +# Copyright © 2019-2023 |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +# |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | + |
| 14 | +name: CI |
| 15 | + |
| 16 | +on: [push, pull_request] |
| 17 | + |
| 18 | +jobs: |
| 19 | + setup: |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + submodules: recursive |
| 27 | + |
| 28 | + - name: Cache Toolchain Directory |
| 29 | + id: cache-toolchain |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: tools |
| 33 | + key: ${{ runner.os }}-toolchain-v0.1 |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-toolchain- |
| 36 | +
|
| 37 | + - name: Cache Third Party Directory |
| 38 | + id: cache-thirdparty |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: third_party |
| 42 | + key: ${{ runner.os }}-thirdparty-v0.1 |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-thirdparty- |
| 45 | +
|
| 46 | + - name: Install Dependencies |
| 47 | + if: steps.cache-toolchain.outputs.cache-hit != 'true' || steps.cache-thirdparty.outputs.cache-hit != 'true' |
| 48 | + run: | |
| 49 | + sudo bash ./ci/system_updates.sh |
| 50 | +
|
| 51 | + - name: Setup Toolchain |
| 52 | + if: steps.cache-toolchain.outputs.cache-hit != 'true' |
| 53 | + run: | |
| 54 | + TOOLDIR=$PWD/tools |
| 55 | + mkdir -p build |
| 56 | + cd build |
| 57 | + ../configure --tooldir=$TOOLDIR |
| 58 | + ci/toolchain_install.sh --all |
| 59 | +
|
| 60 | + - name: Setup Third Party |
| 61 | + if: steps.cache-thirdparty.outputs.cache-hit != 'true' |
| 62 | + run: | |
| 63 | + make -C third_party > /dev/null |
| 64 | +
|
| 65 | + # build: |
| 66 | + # runs-on: ubuntu-20.04 |
| 67 | + # needs: setup |
| 68 | + # strategy: |
| 69 | + # matrix: |
| 70 | + # xlen: [32, 64] |
| 71 | + |
| 72 | + # steps: |
| 73 | + # - name: Checkout code |
| 74 | + # uses: actions/checkout@v2 |
| 75 | + |
| 76 | + # - name: Install Dependencies |
| 77 | + # run: | |
| 78 | + # sudo bash ./ci/system_updates.sh |
| 79 | + |
| 80 | + # - name: Cache Toolchain Directory |
| 81 | + # id: cache-toolchain |
| 82 | + # uses: actions/cache@v2 |
| 83 | + # with: |
| 84 | + # path: tools |
| 85 | + # key: ${{ runner.os }}-toolchain-v0.1 |
| 86 | + # restore-keys: | |
| 87 | + # ${{ runner.os }}-toolchain- |
| 88 | + |
| 89 | + # - name: Cache Third Party Directory |
| 90 | + # id: cache-thirdparty |
| 91 | + # uses: actions/cache@v2 |
| 92 | + # with: |
| 93 | + # path: third_party |
| 94 | + # key: ${{ runner.os }}-thirdparty-v0.1 |
| 95 | + # restore-keys: | |
| 96 | + # ${{ runner.os }}-thirdparty- |
| 97 | + |
| 98 | + # - name: Run Build |
| 99 | + # run: | |
| 100 | + # TOOLDIR=$PWD/tools |
| 101 | + # mkdir -p build${{ matrix.xlen }} |
| 102 | + # cd build${{ matrix.xlen }} |
| 103 | + # ../configure --tooldir=$TOOLDIR --xlen=${{ matrix.xlen }} |
| 104 | + # source ci/toolchain_env.sh |
| 105 | + # make software -s > /dev/null |
| 106 | + # make tests -s > /dev/null |
| 107 | + |
| 108 | + # - name: Upload Build Artifact |
| 109 | + # uses: actions/upload-artifact@v2 |
| 110 | + # with: |
| 111 | + # name: build-${{ matrix.xlen }} |
| 112 | + # path: build${{ matrix.xlen }} |
| 113 | + |
| 114 | + # tests: |
| 115 | + # runs-on: ubuntu-20.04 |
| 116 | + # needs: build |
| 117 | + # strategy: |
| 118 | + # matrix: |
| 119 | + # name: [regression, opencl, config1, config2, debug, stress] |
| 120 | + # xlen: [32, 64] |
| 121 | + |
| 122 | + # steps: |
| 123 | + # - name: Checkout code |
| 124 | + # uses: actions/checkout@v2 |
| 125 | + |
| 126 | + # - name: Install Dependencies |
| 127 | + # run: | |
| 128 | + # sudo bash ./ci/system_updates.sh |
| 129 | + |
| 130 | + # - name: Cache Toolchain Directory |
| 131 | + # id: cache-toolchain |
| 132 | + # uses: actions/cache@v2 |
| 133 | + # with: |
| 134 | + # path: tools |
| 135 | + # key: ${{ runner.os }}-toolchain-v0.1 |
| 136 | + # restore-keys: | |
| 137 | + # ${{ runner.os }}-toolchain- |
| 138 | + |
| 139 | + # - name: Cache Third Party Directory |
| 140 | + # id: cache-thirdparty |
| 141 | + # uses: actions/cache@v2 |
| 142 | + # with: |
| 143 | + # path: third_party |
| 144 | + # key: ${{ runner.os }}-thirdparty-v0.1 |
| 145 | + # restore-keys: | |
| 146 | + # ${{ runner.os }}-thirdparty- |
| 147 | + |
| 148 | + # - name: Download Build Artifact |
| 149 | + # uses: actions/download-artifact@v2 |
| 150 | + # with: |
| 151 | + # name: build-${{ matrix.xlen }} |
| 152 | + # path: build${{ matrix.xlen }} |
| 153 | + |
| 154 | + # - name: Run tests |
| 155 | + # run: | |
| 156 | + # cd build${{ matrix.xlen }} |
| 157 | + # source ci/toolchain_env.sh |
| 158 | + # chmod -R +x . # Ensure all files have executable permissions |
| 159 | + # if [ "${{ matrix.name }}" == "regression" ]; then |
| 160 | + # ./ci/regression.sh --unittest |
| 161 | + # ./ci/regression.sh --isa |
| 162 | + # ./ci/regression.sh --kernel |
| 163 | + # ./ci/regression.sh --synthesis |
| 164 | + # ./ci/regression.sh --regression |
| 165 | + # else |
| 166 | + # ./ci/regression.sh --${{ matrix.name }} |
| 167 | + # fi |
| 168 | + |
| 169 | + build_vm: |
| 170 | + runs-on: ubuntu-20.04 |
| 171 | + needs: setup |
| 172 | + strategy: |
| 173 | + matrix: |
| 174 | + xlen: [32, 64] |
| 175 | + |
| 176 | + steps: |
| 177 | + - name: Checkout code |
| 178 | + uses: actions/checkout@v4 |
| 179 | + |
| 180 | + - name: Install Dependencies |
| 181 | + run: | |
| 182 | + sudo bash ./ci/system_updates.sh |
| 183 | +
|
| 184 | + - name: Cache Toolchain Directory |
| 185 | + id: cache-toolchain |
| 186 | + uses: actions/cache@v4 |
| 187 | + with: |
| 188 | + path: tools |
| 189 | + key: ${{ runner.os }}-toolchain-v0.1 |
| 190 | + restore-keys: | |
| 191 | + ${{ runner.os }}-toolchain- |
| 192 | +
|
| 193 | + - name: Cache Third Party Directory |
| 194 | + id: cache-thirdparty |
| 195 | + uses: actions/cache@v4 |
| 196 | + with: |
| 197 | + path: third_party |
| 198 | + key: ${{ runner.os }}-thirdparty-v0.1 |
| 199 | + restore-keys: | |
| 200 | + ${{ runner.os }}-thirdparty- |
| 201 | +
|
| 202 | + - name: Run Build |
| 203 | + run: | |
| 204 | + TOOLDIR=$PWD/tools |
| 205 | + mkdir -p build${{ matrix.xlen }}-vm |
| 206 | + cd build${{ matrix.xlen }}-vm |
| 207 | + ../configure --tooldir=$TOOLDIR --xlen=${{ matrix.xlen }} --vm_enable=1 |
| 208 | + source ci/toolchain_env.sh |
| 209 | + make software -s > /dev/null |
| 210 | + make tests -s > /dev/null |
| 211 | +
|
| 212 | + - name: Upload Build Artifact |
| 213 | + uses: actions/upload-artifact@v4 |
| 214 | + with: |
| 215 | + name: build-${{ matrix.xlen }}-vm |
| 216 | + path: build${{ matrix.xlen }}-vm |
| 217 | + |
| 218 | + test_vm: |
| 219 | + runs-on: ubuntu-20.04 |
| 220 | + needs: build_vm |
| 221 | + strategy: |
| 222 | + fail-fast: false |
| 223 | + matrix: |
| 224 | + name: [regression, opencl, cache, config1, config2, debug, stress, vm] |
| 225 | + xlen: [32, 64] |
| 226 | + |
| 227 | + steps: |
| 228 | + - name: Checkout code |
| 229 | + uses: actions/checkout@v4 |
| 230 | + |
| 231 | + - name: Install Dependencies |
| 232 | + run: | |
| 233 | + sudo bash ./ci/system_updates.sh |
| 234 | +
|
| 235 | + - name: Cache Toolchain Directory |
| 236 | + id: cache-toolchain |
| 237 | + uses: actions/cache@v4 |
| 238 | + with: |
| 239 | + path: tools |
| 240 | + key: ${{ runner.os }}-toolchain-v0.1 |
| 241 | + restore-keys: | |
| 242 | + ${{ runner.os }}-toolchain- |
| 243 | +
|
| 244 | + - name: Cache Third Party Directory |
| 245 | + id: cache-thirdparty |
| 246 | + uses: actions/cache@v4 |
| 247 | + with: |
| 248 | + path: third_party |
| 249 | + key: ${{ runner.os }}-thirdparty-v0.1 |
| 250 | + restore-keys: | |
| 251 | + ${{ runner.os }}-thirdparty- |
| 252 | +
|
| 253 | + - name: Download Build Artifact |
| 254 | + uses: actions/download-artifact@v4 |
| 255 | + with: |
| 256 | + name: build-${{ matrix.xlen }}-vm |
| 257 | + path: build${{ matrix.xlen }}-vm |
| 258 | + |
| 259 | + - name: Run tests |
| 260 | + run: | |
| 261 | + cd build${{ matrix.xlen }}-vm |
| 262 | + source ci/toolchain_env.sh |
| 263 | + chmod -R +x . # Ensure all files have executable permissions |
| 264 | + ./ci/regression.sh --vm |
| 265 | +
|
| 266 | + complete: |
| 267 | + runs-on: ubuntu-20.04 |
| 268 | + needs: test_vm |
| 269 | + |
| 270 | + steps: |
| 271 | + - name: Check Completion |
| 272 | + run: echo "All matrix jobs passed" |
0 commit comments