leo/.circleci/config.yml

175 lines
4.8 KiB
YAML
Raw Normal View History

2021-02-25 07:03:50 +03:00
version: 2.1
commands:
setup_environment:
2021-02-25 07:20:02 +03:00
description: "Setup environment"
2021-02-25 07:03:50 +03:00
parameters:
cache_key:
type: string
default: leo-stable-linux-cache
2021-02-25 07:03:50 +03:00
steps:
- run: set -e
- setup_remote_docker
- run:
name: Prepare environment and install dependencies
command: |
export SCCACHE_CACHE_SIZE=200M
export WORK_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache"
export SCCACHE_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache"
mkdir -p "$CIRCLE_WORKING_DIRECTORY/.bin"
wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
tar -C "$CIRCLE_WORKING_DIRECTORY/.bin" -xvf sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
mv $CIRCLE_WORKING_DIRECTORY/.bin/sccache-0.2.13-x86_64-unknown-linux-musl/sccache $CIRCLE_WORKING_DIRECTORY/.bin/sccache
export PATH="$PATH:$CIRCLE_WORKING_DIRECTORY/.bin"
export RUSTC_WRAPPER="sccache"
rm -rf "$CIRCLE_WORKING_DIRECTORY/.cargo/registry"
sudo apt-get update && sudo apt-get install -y clang llvm-dev llvm pkg-config xz-utils make libssl-dev libssl-dev
- restore_cache:
keys:
- << parameters.cache_key >>
2023-03-27 18:55:45 +03:00
2021-02-25 07:03:50 +03:00
clear_environment:
description: "Clear environment"
parameters:
cache_key:
type: string
default: leo-stable-linux-cache
2021-02-25 07:03:50 +03:00
steps:
- run: (sccache -s||true)
- run: set +e
- save_cache:
key: << parameters.cache_key >>
paths:
- .cache/sccache
- .cargo
2023-03-27 18:55:45 +03:00
install_rust_nightly:
description: "Install Rust nightly toolchain"
steps:
- run: rustup toolchain install nightly-x86_64-unknown-linux-gnu
2021-02-25 07:03:50 +03:00
jobs:
check-style:
docker:
- image: cimg/rust:1.71
resource_class: xlarge
steps:
- checkout
2023-03-27 18:55:45 +03:00
- install_rust_nightly
- setup_environment:
cache_key: leo-fmt-cache
- run:
name: Check style
no_output_timeout: 35m
command: cargo +nightly fmt --all -- --check
- clear_environment:
cache_key: leo-fmt-cache
2021-02-25 07:11:23 +03:00
clippy:
2021-03-16 06:34:37 +03:00
docker:
- image: cimg/rust:1.71
2021-03-16 06:34:37 +03:00
resource_class: xlarge
steps:
- checkout
- setup_environment:
cache_key: leo-clippy-cache
2021-03-16 06:34:37 +03:00
- run:
name: Clippy
no_output_timeout: 35m
2022-07-07 01:02:29 +03:00
command: |
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace --all-targets --all-features -- -D warnings
2021-03-16 06:34:37 +03:00
- clear_environment:
cache_key: leo-clippy-cache
2021-03-16 06:34:37 +03:00
2021-03-16 06:44:37 +03:00
leo-executable:
2021-02-25 07:03:50 +03:00
docker:
- image: cimg/rust:1.71
2021-04-01 09:20:10 +03:00
resource_class: xlarge
2021-02-25 07:03:50 +03:00
steps:
- checkout
- setup_environment:
2021-03-16 06:44:37 +03:00
cache_key: leo-executable-cache
2021-02-25 07:03:50 +03:00
- run:
2021-03-16 06:41:04 +03:00
name: Build and install Leo
2021-02-25 07:03:50 +03:00
no_output_timeout: 30m
2021-04-01 09:20:10 +03:00
command: cargo install --path . --root . --locked
2021-02-25 07:03:50 +03:00
- persist_to_workspace:
2021-02-25 07:55:29 +03:00
root: ~/
2022-08-08 21:24:01 +03:00
paths:
- project/
2021-02-25 07:03:50 +03:00
- clear_environment:
2021-03-16 06:44:37 +03:00
cache_key: leo-executable-cache
2021-02-25 09:22:29 +03:00
2022-08-05 21:06:17 +03:00
leo-new:
docker:
- image: cimg/rust:1.71
2022-08-05 21:06:17 +03:00
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo new
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-new.sh
2021-02-25 08:59:06 +03:00
2022-08-05 21:06:17 +03:00
leo-clean:
docker:
- image: cimg/rust:1.71
2022-08-05 21:06:17 +03:00
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo clean
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-clean.sh
2021-02-25 20:34:06 +03:00
leo-example:
docker:
- image: cimg/rust:1.71
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo example
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-example.sh
test-examples:
2022-08-08 21:15:11 +03:00
docker:
- image: cimg/rust:1.71
2022-08-08 21:15:11 +03:00
resource_class: xlarge
steps:
- attach_workspace:
2022-08-08 21:24:01 +03:00
at: /home/circleci/project/
2022-08-08 21:15:11 +03:00
- run:
name: test examples example
2022-08-08 21:15:11 +03:00
command: |
export LEO=/home/circleci/project/project/bin/leo
2023-02-17 00:04:14 +03:00
export EXAMPLES=/home/circleci/project/project/examples
./project/.circleci/test-examples.sh
2022-08-08 21:15:11 +03:00
2021-02-25 07:03:50 +03:00
workflows:
version: 2
main-workflow:
jobs:
- check-style
- clippy
2021-03-16 06:44:37 +03:00
- leo-executable
2022-08-05 21:06:17 +03:00
- leo-new:
requires:
- leo-executable
- leo-clean:
requires:
- leo-executable
- leo-example:
requires:
- leo-executable
- test-examples:
2022-08-08 21:21:08 +03:00
requires:
2023-02-16 18:40:29 +03:00
- leo-executable