mirror of
https://github.com/serai-dex/serai.git
synced 2024-10-31 17:37:38 +00:00
42d62c38b9
* Remove the Monero CMake and make * Download the Monero daemon instead of building it * Cache the Monero daemon Prevents hammering the Monero servers, should reduce CI time. * Correct YAML * Add back sodium-dev * Create an independent job for downloading the Monero daemon Improves parallelism while decreasing the amount of work re-done if build fails. Also increases modularity. * Correct Monero job definition * Correct skipping the Monero download on cache hit
196 lines
5 KiB
YAML
196 lines
5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
pull_request:
|
|
|
|
jobs:
|
|
monero-daemon:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Monero cache
|
|
id: cache-monerod
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: monerod
|
|
key: monerod-${{ runner.os }}-${{ runner.arch }}-v0.17.3.2
|
|
|
|
- name: Download the Monero Daemon
|
|
if: steps.cache-monerod.outputs.cache-hit != 'true'
|
|
# Calculates OS/ARCH to demonstrate it, yet then locks to linux-x64 due
|
|
# to the contained folder not following the same naming scheme and
|
|
# requiring further expansion not worth doing right now
|
|
run: |
|
|
RUNNER_OS=${{ runner.os }}
|
|
RUNNER_ARCH=${{ runner.arch }}
|
|
OS_ARCH=${RUNNER_OS,,}-${RUNNER_ARCH,,}
|
|
OS_ARCH=linux-x64
|
|
|
|
wget https://downloads.getmonero.org/cli/monero-$OS_ARCH-v0.17.3.2.tar.bz2
|
|
tar -xvf monero-$OS_ARCH-v0.17.3.2.tar.bz2
|
|
mv monero-x86_64-linux-gnu-v0.17.3.2/monerod monerod
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Install solc
|
|
run: |
|
|
pip3 install solc-select
|
|
solc-select install 0.8.9
|
|
solc-select use 0.8.9
|
|
|
|
- name: Install Monero Dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install build-essential libboost-all-dev libsodium-dev
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
default: true
|
|
|
|
- name: Install WASM toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
target: wasm32-unknown-unknown
|
|
|
|
- name: Cargo/Rust cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
./target
|
|
key: ${{ runner.os }}-cargo-rust
|
|
|
|
- name: Build
|
|
run: ARCH=default cargo build --all-features
|
|
|
|
# Mirror the build job for Clippy
|
|
clippy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Install solc
|
|
run: |
|
|
pip3 install solc-select
|
|
solc-select install 0.8.9
|
|
solc-select use 0.8.9
|
|
|
|
- name: Install Monero Dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install build-essential libboost-all-dev libsodium-dev
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
# Clippy requires nightly for some reason
|
|
toolchain: nightly
|
|
profile: minimal
|
|
default: true
|
|
components: clippy
|
|
|
|
- name: Install WASM toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
target: wasm32-unknown-unknown
|
|
|
|
# Define a separate cache for nightly Rust
|
|
- name: Cargo/Rust nightly cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
./target
|
|
key: ${{ runner.os }}-cargo-rust-nightly
|
|
|
|
- name: Run Clippy
|
|
run: cargo clippy --all-features -- -D warnings -A clippy::type_complexity -A dead_code
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: [monero-daemon, build]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Install solc
|
|
run: |
|
|
pip3 install solc-select
|
|
solc-select install 0.8.9
|
|
solc-select use 0.8.9
|
|
|
|
- name: Install Foundry
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
with:
|
|
version: nightly
|
|
|
|
- name: Install Monero Dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install build-essential libboost-all-dev libsodium-dev
|
|
|
|
- name: Monero cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: monerod
|
|
key: monerod-${{ runner.os }}-${{ runner.arch }}-v0.17.3.2
|
|
|
|
- name: Monero Regtest Daemon
|
|
run: ./monerod --regtest --offline --fixed-difficulty=1 --detach
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
default: true
|
|
|
|
- name: Install WASM toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
target: wasm32-unknown-unknown
|
|
|
|
- name: Cargo/Rust cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
./target
|
|
key: ${{ runner.os }}-cargo-rust
|
|
|
|
- name: Run tests
|
|
run: cargo test --all-features
|
|
|
|
fmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install rustfmt
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
profile: minimal
|
|
components: rustfmt
|
|
|
|
- name: Run rustfmt
|
|
run: cargo +nightly fmt -- --check
|