mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
set up CI (#45)
* begin to setup ci * attempt to fix build * fix paths in build script * fix * satisfy clippy * update fmt check to use nightly * use nightly for build * fmt * fix fmt install * update test script * try to fix fmt * merge w develop * maybe fix build script * install wasm toolchain * install solc-select, use stable rust to build * Correct clippy warnings Currently intended to be done with: cargo clippy --features "recommended merlin batch serialize experimental ed25519 ristretto p256 secp256k1 multisig" -- -A clippy::type_complexity -A dead_code * Remove try-runtime I tried to get this to work for an hour. I have no idea why it doesn't, yet it doesn't. * Rewrite workflow Splits tasks into a more modular structure. Also uses actions-rs/toolchain. * Add a cache * Immediately try building ETH/Monero while this is fixed Adds solc-select use. * Revert selective advance building of ETH/XMR ETH builds now, so it hopefully should work now. Also moves from on push to on push to develop. * Install Monero runtime dependencies Specify missing Rust toolchain setting. * Correct multi-line commands * Fix multi-line commands again Cache Ethereum artifacts. * Add Foundry * Move Clippy under build * Minimal rustup Adds wasm Clippy. Puts Clippy before build. * Use nightly clippy * Remove old clippy call from under build * Have the Monero build script support ARCH specification Requirement for CI. * Add WASM toolchain to tests * Remove Ethereum cache which did not work as needed * Remove extraneous quotes which broke builds on Arch Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
199
.github/workflows/tests.yml
vendored
Normal file
199
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
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 cmake pkg-config libboost-all-dev \
|
||||
libssl-dev libzmq3-dev libpgm-dev libunbound-dev \
|
||||
libsodium-dev ccache
|
||||
|
||||
- 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
|
||||
|
||||
# Cache everything, not only for performance, yet to export these to the
|
||||
# following jobs
|
||||
- name: Monero cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
./coins/monero/c/.build
|
||||
./coins/monero/c/monero/build
|
||||
# Hash src, as theoretically, a different version of Monero warranting
|
||||
# a rebuild would've changed *something* under src
|
||||
key: ${{ runner.os }}-${{ hashFiles('./coins/monero/c/monero/src') }}
|
||||
|
||||
- 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 cmake pkg-config libboost-all-dev \
|
||||
libssl-dev libzmq3-dev libpgm-dev libunbound-dev \
|
||||
libsodium-dev ccache
|
||||
|
||||
- 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
|
||||
|
||||
# Grab the Monero cache since it'll be unaffected by Rust versioning
|
||||
- name: Monero cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
./coins/monero/c/.build
|
||||
./coins/monero/c/monero/build
|
||||
key: ${{ runner.os }}-${{ hashFiles('./coins/monero/c/monero/src') }}
|
||||
|
||||
# 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: 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 libboost-all-dev libssl-dev libzmq3-dev libpgm-dev \
|
||||
libunbound-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: Monero cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
./coins/monero/c/.build
|
||||
./coins/monero/c/monero/build
|
||||
key: ${{ runner.os }}-${{ hashFiles('./coins/monero/c/monero/src') }}
|
||||
|
||||
- name: Cargo/Rust cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
./target
|
||||
key: ${{ runner.os }}-cargo-rust
|
||||
|
||||
- name: Monero Regtest Daemon
|
||||
run: ./coins/monero/c/monero/build/release/bin/monerod --regtest --offline --fixed-difficulty=1 --detach
|
||||
|
||||
- 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
|
||||
Reference in New Issue
Block a user