2023-10-26 00:39:57 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ "main" ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ "main" ]
|
2024-02-12 13:39:15 +00:00
|
|
|
workflow_dispatch:
|
2023-10-26 00:39:57 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
# Show full panics.
|
|
|
|
RUST_BACKTRACE: "full"
|
|
|
|
# Increase thread stack size to 8 megabytes.
|
|
|
|
RUST_MIN_STACK: 8000000
|
|
|
|
|
|
|
|
jobs:
|
2024-02-12 13:39:15 +00:00
|
|
|
# Run format separately.
|
2024-01-22 22:41:20 +00:00
|
|
|
fmt:
|
2024-02-12 13:39:15 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-01-22 22:41:20 +00:00
|
|
|
|
2024-02-12 13:39:15 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [windows-latest, macos-latest, ubuntu-latest]
|
2023-10-26 00:39:57 +00:00
|
|
|
|
|
|
|
steps:
|
2024-02-12 13:39:15 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Format
|
|
|
|
run: cargo fmt --all --check
|
|
|
|
|
|
|
|
# All other CI.
|
|
|
|
ci:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [windows-latest, macos-latest, ubuntu-latest]
|
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
shell: msys2 {0}
|
|
|
|
- os: macos-latest
|
|
|
|
shell: bash
|
|
|
|
- os: ubuntu-latest
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: ${{ matrix.shell }}
|
2023-12-03 00:29:12 +00:00
|
|
|
|
2024-01-22 22:30:19 +00:00
|
|
|
steps:
|
2024-02-12 13:39:15 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
target
|
|
|
|
~/.cargo
|
|
|
|
~/.rustup
|
|
|
|
key: ${{ matrix.os }}
|
|
|
|
|
|
|
|
# Packages other than `Boost` used by `Monero` are listed here.
|
|
|
|
# https://github.com/monero-project/monero/blob/c444a7e002036e834bfb4c68f04a121ce1af5825/.github/workflows/build.yml#L71
|
|
|
|
|
|
|
|
- name: Install dependencies (Linux)
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: sudo apt install -y libboost-dev
|
|
|
|
|
|
|
|
- name: Install dependencies (macOS)
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install boost
|
|
|
|
|
|
|
|
- name: Install dependencies (Windows)
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
path-type: inherit
|
|
|
|
update: true
|
|
|
|
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-boost msys2-runtime-devel git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
|
|
|
|
|
|
|
|
- name: Switch target (Windows)
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: rustup toolchain install stable-x86_64-pc-windows-gnu -c clippy && rustup set default-host x86_64-pc-windows-gnu && rustup default stable-x86_64-pc-windows-gnu
|
|
|
|
|
|
|
|
- name: Clippy (fail on warnings)
|
|
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: cargo test --all-features --workspace --all-targets
|
|
|
|
|
|
|
|
# TODO: upload binaries with `actions/upload-artifact@v3`
|
|
|
|
- name: Build
|
|
|
|
run: cargo build --all-features --all-targets --workspace
|