|
| 1 | +#!/bin/bash |
| 2 | +#: |
| 3 | +#: name = "build-and-test" |
| 4 | +#: variety = "basic" |
| 5 | +#: target = "ubuntu-20.04" |
| 6 | +#: |
| 7 | +#: output_rules = [ |
| 8 | +#: "/work/oxidecomputer/quartz/build/latest/**/*", |
| 9 | +#: ] |
| 10 | + |
| 11 | +set -o errexit |
| 12 | +set -o pipefail |
| 13 | +set -o xtrace |
| 14 | + |
| 15 | +# |
| 16 | +# The token authentication mechanism that affords us access to other private |
| 17 | +# repositories requires that we use HTTPS URLs for GitHub, rather than SSH. |
| 18 | +# |
| 19 | +override_urls=( |
| 20 | + 'git://github.com/' |
| 21 | + 'git@github.com:' |
| 22 | + 'ssh://github.com/' |
| 23 | + 'ssh://git@github.com/' |
| 24 | +) |
| 25 | +for (( i = 0; i < ${#override_urls[@]}; i++ )); do |
| 26 | + git config --add --global url.https://github.com/.insteadOf \ |
| 27 | + "${override_urls[$i]}" |
| 28 | +done |
| 29 | + |
| 30 | +# |
| 31 | +# Require that cargo use the git CLI instead of the built-in support. This |
| 32 | +# achieves two things: first, SSH URLs should be transformed on fetch without |
| 33 | +# requiring Cargo.toml rewriting, which is especially difficult in transitive |
| 34 | +# dependencies; second, Cargo does not seem willing on its own to look in |
| 35 | +# ~/.netrc and find the temporary token that buildomat generates for our job, |
| 36 | +# so we must use git which uses curl. |
| 37 | +# |
| 38 | +export CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 39 | + |
| 40 | +git submodule sync |
| 41 | +git submodule update --init --recursive |
| 42 | + |
| 43 | +pfexec apt -y update |
| 44 | +pfexec apt -y install make |
| 45 | + |
| 46 | +# |
| 47 | +# Install yosys from pre-built toolchain as specified |
| 48 | +# |
| 49 | +banner Yosys Install |
| 50 | +YOSYS_TOOLCHAIN="https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-08-25/oss-cad-suite-linux-x64-20220825.tgz" |
| 51 | +wget -q $YOSYS_TOOLCHAIN |
| 52 | +tar zxf oss-cad-suite-linux-x64* |
| 53 | + |
| 54 | +# |
| 55 | +# Install pre-built bsv toolchain as specified and add bsc/bin folder to path |
| 56 | +# |
| 57 | +banner Bluespec Install |
| 58 | +BSV_TOOLCHAIN="https://github.com/B-Lang-org/bsc/releases/download/2022.01/bsc-2022.01-ubuntu-20.04.tar.gz" |
| 59 | +wget -q $BSV_TOOLCHAIN |
| 60 | +tar zxf bsc-2022.01-ubuntu* |
| 61 | + |
| 62 | +# |
| 63 | +# Now do bsc contrib (not part of the binary release) |
| 64 | +# This works but takes a non-zero amount of time, so it is commented out because we don't currently depend on it |
| 65 | +# |
| 66 | +# git clone --recursive https://github.com/B-Lang-org/bsc-contrib.git |
| 67 | +# pushd bsc-contrib |
| 68 | +# make PREFIX=/work/oxidecomputer/quartz/bsc-2022.01-ubuntu-20.04 BSC=/work/oxidecomputer/quartz/bsc-2022.01-ubuntu-20.04/bin/bsc |
| 69 | +# popd |
| 70 | + |
| 71 | +# |
| 72 | +# Do cobalt setup (python packages required) |
| 73 | +# |
| 74 | +banner cobalt Setup |
| 75 | +pushd vnd/cobalt |
| 76 | +# |
| 77 | +# Install cobalt-related python stuff, ninja + other 3rd party things |
| 78 | +# |
| 79 | +pfexec apt -y install python3-pip ninja-build |
| 80 | +pip3 install -r requirements.txt |
| 81 | +popd |
| 82 | + |
| 83 | +# |
| 84 | +# Prep for build by setting up the BUILD.vars that cobble needs |
| 85 | +# then making a build directory and initializing cobble |
| 86 | +# |
| 87 | +cp BUILD.vars.buildomat BUILD.vars |
| 88 | + |
| 89 | +mkdir build |
| 90 | +pushd build |
| 91 | + |
| 92 | +# |
| 93 | +# Initialize cobalt |
| 94 | +# |
| 95 | +../vnd/cobalt/vnd/cobble/cobble init .. --reinit |
| 96 | + |
| 97 | +# |
| 98 | +# Do the build |
| 99 | +# |
| 100 | +banner FPGA Builds |
| 101 | + |
| 102 | +# Get all bit files and build them |
| 103 | +./cobble list | grep .bit | while read line; do ./cobble build -v "$line"; done |
| 104 | + |
0 commit comments