|
| 1 | +name: ci/gh-actions/cli |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths-ignore: |
| 6 | + - 'docs/**' |
| 7 | + - '**/README.md' |
| 8 | + pull_request: |
| 9 | + paths-ignore: |
| 10 | + - 'docs/**' |
| 11 | + - '**/README.md' |
| 12 | + |
| 13 | +# The below variables reduce repetitions across similar targets |
| 14 | +env: |
| 15 | + REMOVE_BUNDLED_PACKAGES : sudo rm -rf /usr/local |
| 16 | + # ARCH="default" (not "native") ensures, that a different execution host can execute binaries compiled elsewhere. |
| 17 | + BUILD_DEFAULT_LINUX: 'cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D ENABLE_FUZZ_TEST=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build --target all && cmake --build build --target wallet_api' |
| 18 | + APT_INSTALL_LINUX: 'apt -y install build-essential cargo cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler ccache curl git' |
| 19 | + APT_SET_CONF: | |
| 20 | + tee -a /etc/apt/apt.conf.d/80-custom << EOF |
| 21 | + Acquire::Retries "3"; |
| 22 | + Acquire::http::Timeout "120"; |
| 23 | + Acquire::ftp::Timeout "120"; |
| 24 | + EOF |
| 25 | + CCACHE_SETTINGS: | |
| 26 | + ccache --max-size=150M |
| 27 | + ccache --set-config=compression=true |
| 28 | + USE_DEVICE_TREZOR_MANDATORY: ON |
| 29 | + |
| 30 | +jobs: |
| 31 | + build-macos: |
| 32 | + name: 'macOS (brew)' |
| 33 | + runs-on: macOS-latest |
| 34 | + env: |
| 35 | + CCACHE_TEMPDIR: /tmp/.ccache-temp |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + submodules: recursive |
| 40 | + - uses: actions/cache@v4 |
| 41 | + with: |
| 42 | + path: /Users/runner/Library/Caches/ccache |
| 43 | + key: ccache-${{ runner.os }}-build-${{ github.sha }} |
| 44 | + restore-keys: ccache-${{ runner.os }}-build- |
| 45 | + - uses: ./.github/actions/set-make-job-count |
| 46 | + - name: install dependencies |
| 47 | + run: | |
| 48 | + brew uninstall cmake |
| 49 | + brew update |
| 50 | + brew install --quiet cmake boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf ccache |
| 51 | + - name: build |
| 52 | + run: | |
| 53 | + ${{env.CCACHE_SETTINGS}} |
| 54 | + make -j${{env.MAKE_JOB_COUNT}} |
| 55 | +
|
| 56 | + build-windows: |
| 57 | + name: 'Windows (MSYS2)' |
| 58 | + runs-on: windows-latest |
| 59 | + env: |
| 60 | + CCACHE_TEMPDIR: C:\Users\runneradmin\.ccache-temp |
| 61 | + CCACHE_DIR: C:\Users\runneradmin\.ccache |
| 62 | + defaults: |
| 63 | + run: |
| 64 | + shell: msys2 {0} |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + submodules: recursive |
| 69 | + - uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: C:\Users\runneradmin\.ccache |
| 72 | + key: ccache-${{ runner.os }}-build-${{ github.sha }} |
| 73 | + restore-keys: ccache-${{ runner.os }}-build- |
| 74 | + - uses: msys2/setup-msys2@v2 |
| 75 | + with: |
| 76 | + update: true |
| 77 | + install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound mingw-w64-x86_64-rust git pkg-config |
| 78 | + - uses: ./.github/actions/set-make-job-count |
| 79 | + - name: build |
| 80 | + run: | |
| 81 | + ${{env.CCACHE_SETTINGS}} |
| 82 | + make release-static -j${{env.MAKE_JOB_COUNT}} |
| 83 | +
|
| 84 | + build-arch: |
| 85 | + name: 'Arch Linux' |
| 86 | + runs-on: ubuntu-latest |
| 87 | + container: |
| 88 | + image: archlinux:latest |
| 89 | + steps: |
| 90 | + - name: install dependencies |
| 91 | + run: pacman -Syyu --noconfirm base-devel git rust cmake boost openssl zeromq unbound libsodium readline expat gtest python3 doxygen graphviz hidapi libusb protobuf |
| 92 | + - name: configure git |
| 93 | + run: git config --global --add safe.directory '*' |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + with: |
| 96 | + submodules: recursive |
| 97 | + - uses: ./.github/actions/set-make-job-count |
| 98 | + - name: build |
| 99 | + env: |
| 100 | + CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} |
| 101 | + run: ${{env.BUILD_DEFAULT_LINUX}} |
| 102 | + |
| 103 | + build-debian: |
| 104 | + # Oldest supported Debian version |
| 105 | + name: 'Debian 11' |
| 106 | + runs-on: ubuntu-latest |
| 107 | + container: |
| 108 | + image: debian:11 |
| 109 | + env: |
| 110 | + DEBIAN_FRONTEND: noninteractive |
| 111 | + steps: |
| 112 | + - name: set apt conf |
| 113 | + run: ${{env.APT_SET_CONF}} |
| 114 | + - name: update apt |
| 115 | + run: apt update |
| 116 | + - name: install monero dependencies |
| 117 | + run: ${{env.APT_INSTALL_LINUX}} |
| 118 | + - name: install rust |
| 119 | + # Debian 11 ships Rust 1.48.0. We need >=1.69 to build FCMP++. |
| 120 | + run: | |
| 121 | + curl -O https://static.rust-lang.org/rustup/archive/1.27.1/x86_64-unknown-linux-gnu/rustup-init |
| 122 | + echo "6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d rustup-init" | sha256sum -c |
| 123 | + chmod +x rustup-init |
| 124 | + ./rustup-init -y --default-toolchain 1.69 |
| 125 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 126 | + - name: configure git |
| 127 | + run: git config --global --add safe.directory '*' |
| 128 | + - uses: actions/checkout@v4 |
| 129 | + with: |
| 130 | + submodules: recursive |
| 131 | + - uses: ./.github/actions/set-make-job-count |
| 132 | + - name: build |
| 133 | + env: |
| 134 | + CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} |
| 135 | + run: ${{env.BUILD_DEFAULT_LINUX}} |
| 136 | + |
| 137 | + build-ubuntu: |
| 138 | + name: ${{ matrix.name }} |
| 139 | + runs-on: ubuntu-latest |
| 140 | + strategy: |
| 141 | + fail-fast: false |
| 142 | + matrix: |
| 143 | + include: |
| 144 | + # Most popular Ubuntu LTS version |
| 145 | + - name: Ubuntu 22.04 |
| 146 | + container: ubuntu:22.04 |
| 147 | + container: |
| 148 | + image: ${{ matrix.container }} |
| 149 | + env: |
| 150 | + DEBIAN_FRONTEND: noninteractive |
| 151 | + CCACHE_TEMPDIR: /tmp/.ccache-temp |
| 152 | + CCACHE_DIR: ~/.ccache |
| 153 | + steps: |
| 154 | + - name: set apt conf |
| 155 | + run: ${{env.APT_SET_CONF}} |
| 156 | + - name: update apt |
| 157 | + run: apt update |
| 158 | + - name: install monero dependencies |
| 159 | + run: ${{env.APT_INSTALL_LINUX}} |
| 160 | + - name: configure git |
| 161 | + run: git config --global --add safe.directory '*' |
| 162 | + - uses: actions/checkout@v4 |
| 163 | + with: |
| 164 | + submodules: recursive |
| 165 | + - uses: actions/cache@v4 |
| 166 | + with: |
| 167 | + path: ~/.ccache |
| 168 | + key: ccache-${{ matrix.container }}-build-${{ github.sha }} |
| 169 | + restore-keys: ccache-${{ matrix.container }}-build- |
| 170 | + - uses: ./.github/actions/set-make-job-count |
| 171 | + - name: build |
| 172 | + env: |
| 173 | + CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} |
| 174 | + run: | |
| 175 | + ${{env.CCACHE_SETTINGS}} |
| 176 | + ${{env.BUILD_DEFAULT_LINUX}} |
| 177 | +
|
| 178 | + test-ubuntu: |
| 179 | + name: "${{ matrix.name }} (tests)" |
| 180 | + runs-on: ubuntu-latest |
| 181 | + strategy: |
| 182 | + matrix: |
| 183 | + include: |
| 184 | + # Oldest supported Ubuntu LTS version |
| 185 | + - name: Ubuntu 20.04 |
| 186 | + container: ubuntu:20.04 |
| 187 | + container: |
| 188 | + image: ${{ matrix.container }} |
| 189 | + env: |
| 190 | + DEBIAN_FRONTEND: noninteractive |
| 191 | + CCACHE_TEMPDIR: /tmp/.ccache-temp |
| 192 | + CCACHE_DIR: ~/.ccache |
| 193 | + # Setting up a loop device (losetup) requires additional capabilities. |
| 194 | + # tests/create_test_disks.sh |
| 195 | + options: --privileged |
| 196 | + steps: |
| 197 | + - name: set apt conf |
| 198 | + run: ${{env.APT_SET_CONF}} |
| 199 | + - name: update apt |
| 200 | + run: apt update |
| 201 | + - name: install monero dependencies |
| 202 | + run: ${{env.APT_INSTALL_LINUX}} |
| 203 | + - name: install pip |
| 204 | + run: apt install -y python3-pip |
| 205 | + - name: install Python dependencies |
| 206 | + run: pip install requests psutil monotonic zmq deepdiff |
| 207 | + - name: configure git |
| 208 | + run: git config --global --add safe.directory '*' |
| 209 | + - uses: actions/checkout@v4 |
| 210 | + with: |
| 211 | + submodules: recursive |
| 212 | + - uses: actions/cache@v4 |
| 213 | + with: |
| 214 | + path: ~/.ccache |
| 215 | + key: ccache-${{ matrix.container }}-build-${{ github.sha }} |
| 216 | + restore-keys: ccache-${{ matrix.container }}-build- |
| 217 | + - name: create dummy disk drives for testing |
| 218 | + run: tests/create_test_disks.sh >> $GITHUB_ENV |
| 219 | + - uses: ./.github/actions/set-make-job-count |
| 220 | + - name: tests |
| 221 | + env: |
| 222 | + CTEST_OUTPUT_ON_FAILURE: ON |
| 223 | + DNS_PUBLIC: tcp://9.9.9.9 |
| 224 | + CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} |
| 225 | + run: | |
| 226 | + ${{env.CCACHE_SETTINGS}} |
| 227 | + ${{env.BUILD_DEFAULT_LINUX}} |
| 228 | + cmake --build build --target test |
| 229 | +
|
| 230 | + source-archive: |
| 231 | + name: "source archive" |
| 232 | + runs-on: ubuntu-latest |
| 233 | + container: |
| 234 | + image: ubuntu:20.04 |
| 235 | + env: |
| 236 | + DEBIAN_FRONTEND: noninteractive |
| 237 | + steps: |
| 238 | + - name: set apt conf |
| 239 | + run: ${{env.APT_SET_CONF}} |
| 240 | + - name: update apt |
| 241 | + run: apt update |
| 242 | + - name: install dependencies |
| 243 | + run: apt install -y git python3-pip |
| 244 | + - name: configure git |
| 245 | + run: git config --global --add safe.directory '*' |
| 246 | + - uses: actions/checkout@v4 |
| 247 | + with: |
| 248 | + fetch-depth: 0 |
| 249 | + submodules: recursive |
| 250 | + - name: archive |
| 251 | + run: | |
| 252 | + pip install git-archive-all |
| 253 | + export VERSION="monero-$(git describe)" |
| 254 | + export OUTPUT="$VERSION.tar" |
| 255 | + echo "OUTPUT=$OUTPUT" >> $GITHUB_ENV |
| 256 | + git-archive-all --prefix "$VERSION/" --force-submodules "$OUTPUT" |
| 257 | + - uses: actions/upload-artifact@v4 |
| 258 | + with: |
| 259 | + name: ${{ env.OUTPUT }} |
| 260 | + path: ${{ env.OUTPUT }} |
0 commit comments