forked from Plume/Plume
use circleci instead of travis (#511)
Upgrade rust-toolchain Upgrade Tantivy Warning: tantivy now use a different file format, search index may need to be deleted and recreated to work as intended try to run compile twice in a row because sometime oomk is evilfix-mobile-margin
parent
2d12524cd1
commit
26fc2cde5d
@ -0,0 +1,196 @@
|
||||
version: 2.1
|
||||
|
||||
aliases:
|
||||
- &defaults
|
||||
docker:
|
||||
- image: plumeorg/plume-buildenv:v0.0.3
|
||||
working_directory: ~/projects/Plume
|
||||
- &postgresql
|
||||
docker:
|
||||
- image: plumeorg/plume-buildenv:v0.0.3
|
||||
- image: circleci/postgres:9.6-alpine
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: plume
|
||||
working_directory: ~/projects/Plume
|
||||
|
||||
- &attach_workspace
|
||||
attach_workspace:
|
||||
at: ~/projects/Plume/
|
||||
- &persist_to_workspace
|
||||
persist_to_workspace:
|
||||
root: ~/projects/Plume/
|
||||
paths:
|
||||
- ./
|
||||
|
||||
- &env_postgresql
|
||||
environment:
|
||||
MIGRATION_DIR: migrations/postgres
|
||||
FEATURES: postgres
|
||||
DATABASE_URL: postgres://postgres@localhost/plume
|
||||
RUST_TEST_THREADS: 1
|
||||
- &env_sqlite
|
||||
environment:
|
||||
MIGRATION_DIR: migrations/sqlite
|
||||
FEATURES: sqlite
|
||||
DATABASE_URL: plume.sqlite3
|
||||
RUST_TEST_THREADS: 1
|
||||
|
||||
- &restore_cache
|
||||
restore_cache:
|
||||
keys:
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}
|
||||
- v1-plume-notest
|
||||
- &save_cache
|
||||
save_cache:
|
||||
key: v1-plume-notest-{{ checksum "Cargo.lock" }}
|
||||
paths:
|
||||
- ~/.cargo/
|
||||
- ./target
|
||||
|
||||
- &restore_cache_web
|
||||
restore_cache:
|
||||
keys:
|
||||
- v1-plume-web-{{ checksum "Cargo.lock" }}
|
||||
- v1-plume-web
|
||||
- &save_cache_web
|
||||
save_cache:
|
||||
key: v1-plume-web-{{ checksum "Cargo.lock" }}
|
||||
paths:
|
||||
- ~/.cargo/
|
||||
- ./target
|
||||
|
||||
- &restore_cache_cli
|
||||
restore_cache:
|
||||
keys:
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}-{{ checksum "/FEATURES" }}-cli
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}-{{ checksum "/FEATURES" }}
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}
|
||||
- v1-plume-notest
|
||||
- &save_cache_cli
|
||||
save_cache:
|
||||
key: v1-plume-notest-{{ checksum "Cargo.lock" }}-{{ checksum "/FEATURES" }}-cli
|
||||
paths:
|
||||
- ~/.cargo/
|
||||
- target
|
||||
|
||||
- &restore_cache_plume_dead_code
|
||||
restore_cache:
|
||||
keys:
|
||||
- v1-plume-test-{{ checksum "/FEATURES" }}-{{ checksum "Cargo.lock" }}-plume
|
||||
- v1-plume-test-{{ checksum "/FEATURES" }}-{{ checksum "Cargo.lock" }}
|
||||
- v1-plume-test-{{ checksum "/FEATURES" }}
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}-{{ checksum "/FEATURES" }}
|
||||
- v1-plume-notest-{{ checksum "Cargo.lock" }}
|
||||
- v1-plume-notest
|
||||
- &save_cache_plume_dead_code
|
||||
save_cache:
|
||||
key: v1-plume-test-{{ checksum "/FEATURES" }}-{{ checksum "Cargo.lock" }}-plume
|
||||
paths:
|
||||
- ~/.cargo/
|
||||
- target
|
||||
|
||||
- &test_cli
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- run:
|
||||
name: Set cache key
|
||||
command: echo "$FEATURES" > /FEATURES
|
||||
- *restore_cache_cli
|
||||
- run:
|
||||
name: clippy
|
||||
command: cargo clippy --no-default-features --features="${FEATURES}" --release -p plume-cli -- -D warnings
|
||||
- *save_cache_cli
|
||||
- &test_plume
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- run:
|
||||
name: Set cache key
|
||||
command: echo "$FEATURES" > /FEATURES
|
||||
- run:
|
||||
name: Set compiler flags
|
||||
# rustflags = ["-Clink-dead-code", "-Clink-args=-Xlinker --no-keep-memory -Xlinker --reduce-memory-overheads"]
|
||||
command: echo "W3RhcmdldC54ODZfNjQtdW5rbm93bi1saW51eC1nbnVdCnJ1c3RmbGFncyA9IFsiLUNsaW5rLWRlYWQtY29kZSIsICItQ2xpbmstYXJncz0tWGxpbmtlciAtLW5vLWtlZXAtbWVtb3J5IC1YbGlua2VyIC0tcmVkdWNlLW1lbW9yeS1vdmVyaGVhZHMiXQoK" | base64 -d >> ~/.cargo/config
|
||||
- *restore_cache_plume_dead_code
|
||||
- run:
|
||||
name: clippy
|
||||
command: cargo clippy --no-default-features --features="${FEATURES}" --release -- -D warnings
|
||||
- run:
|
||||
name: compile test
|
||||
command: cargo test --no-default-features --features="${FEATURES}" --all --exclude plume-front --no-run || cargo test --no-default-features --features="${FEATURES}" --all --exclude plume-front --no-run
|
||||
- run:
|
||||
name: run test and upload coverage
|
||||
command: ./script/compute_coverage.sh
|
||||
- *save_cache_plume_dead_code
|
||||
|
||||
jobs:
|
||||
download_deps:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- *restore_cache
|
||||
- run: cargo fetch
|
||||
- *save_cache
|
||||
- *persist_to_workspace
|
||||
|
||||
cargo_fmt:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
build_web:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- *restore_cache_web
|
||||
- run: cargo clippy -p plume-front -- -D warnings
|
||||
- run: cargo web deploy -p plume-front
|
||||
- *save_cache_web
|
||||
- *persist_to_workspace
|
||||
|
||||
test_cli_postgresql:
|
||||
<<: *postgresql
|
||||
<<: *env_postgresql
|
||||
<<: *test_cli
|
||||
|
||||
test_cli_sqlite:
|
||||
<<: *defaults
|
||||
<<: *env_sqlite
|
||||
<<: *test_cli
|
||||
|
||||
test_plume_postgresql:
|
||||
<<: *postgresql
|
||||
<<: *env_postgresql
|
||||
<<: *test_plume
|
||||
|
||||
test_plume_sqlite:
|
||||
<<: *defaults
|
||||
<<: *env_sqlite
|
||||
<<: *test_plume
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build_and_test:
|
||||
jobs:
|
||||
- download_deps
|
||||
- cargo_fmt:
|
||||
requires:
|
||||
- download_deps
|
||||
- build_web:
|
||||
requires:
|
||||
- download_deps
|
||||
- test_cli_postgresql:
|
||||
requires:
|
||||
- download_deps
|
||||
- test_cli_sqlite:
|
||||
requires:
|
||||
- download_deps
|
||||
- test_plume_postgresql:
|
||||
requires:
|
||||
- download_deps
|
||||
- test_plume_sqlite:
|
||||
requires:
|
||||
- download_deps
|
@ -0,0 +1,19 @@
|
||||
FROM debian:stretch-20190326
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
#install native/circleci/build dependancies
|
||||
RUN apt update &&\
|
||||
apt install -y git ssh tar gzip ca-certificates &&\
|
||||
apt install -y binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev
|
||||
|
||||
#install and configure rust
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-03-23 -y &&\
|
||||
rustup component add rustfmt clippy &&\
|
||||
rustup component add rust-std --target wasm32-unknown-unknown &&\
|
||||
cargo install cargo-web &&\
|
||||
rm -fr ~/.cargo/registry
|
||||
|
||||
#install coverage tools
|
||||
RUN curl -L https://github.com/SimonKagstrom/kcov/archive/master.tar.gz | tar xz &&\
|
||||
mkdir -p kcov-master/build && cd kcov-master/build && cmake .. && make &&\
|
||||
make install && cd ../.. && rm -rf kcov-master
|
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
[ "$1" = "" ] && echo "you must provide one argument, the build version" && exit 1
|
||||
docker build -t plumeorg/plume-buildenv:$1 .
|
||||
docker push plumeorg/plume-buildenv:$1
|
@ -1,79 +0,0 @@
|
||||
language: rust
|
||||
rust:
|
||||
- nightly-2018-12-06
|
||||
cache:
|
||||
cargo: true
|
||||
directories:
|
||||
- kcov-master
|
||||
sudo: true
|
||||
dist: trusty
|
||||
services: postgres
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcurl4-openssl-dev
|
||||
- libelf-dev
|
||||
- libdw-dev
|
||||
- cmake
|
||||
- gcc
|
||||
- binutils-dev
|
||||
- zlib1g-dev
|
||||
- libiberty-dev
|
||||
stages:
|
||||
- build
|
||||
- test and coverage
|
||||
jobs:
|
||||
include:
|
||||
- stage: build
|
||||
name: "Build front"
|
||||
script: (cargo web -h || cargo install cargo-web) && cd plume-front && cargo clippy -- -D warnings && cargo web check
|
||||
before_script: rustup component add clippy
|
||||
|
||||
- stage: build
|
||||
name: "Build with postgresql"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/postgres FEATURES=postgres DATABASE_URL=postgres://postgres@localhost/plume
|
||||
script: cargo clippy --no-default-features --features="${FEATURES}" --release -- -D warnings
|
||||
before_script: rustup component add clippy
|
||||
|
||||
- stage: build
|
||||
name: "Build CLI with postgresql"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/postgres FEATURES=postgres DATABASE_URL=postgres://postgres@localhost/plume
|
||||
script: cd plume-cli && cargo clippy --no-default-features --features="${FEATURES}" --release -- -D warnings
|
||||
before_script: rustup component add clippy
|
||||
- stage: build
|
||||
name: "Build with sqlite"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/sqlite FEATURES=sqlite DATABASE_URL=plume.sqlite3
|
||||
script: cargo clippy --no-default-features --features="${FEATURES}" --release -- -D warnings
|
||||
before_script: rustup component add clippy
|
||||
|
||||
- stage: build
|
||||
name: "Build CLI with sqlite"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/sqlite FEATURES=sqlite DATABASE_URL=plume.sqlite3
|
||||
script: cd plume-cli && cargo clippy --no-default-features --features="${FEATURES}" --release -- -D warnings
|
||||
before_script: rustup component add clippy
|
||||
|
||||
- stage: test and coverage
|
||||
name: "Test with potgresql backend"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/postgres FEATURES=postgres DATABASE_URL=postgres://postgres@localhost/plume_tests
|
||||
- RUSTFLAGS='-C link-dead-code' RUST_TEST_THREADS=1
|
||||
before_script: psql -c 'create database plume_tests;' -U postgres
|
||||
script:
|
||||
- |
|
||||
cargo test --features "${FEATURES}" --no-default-features --all --exclude plume-front &&
|
||||
./script/compute_coverage.sh
|
||||
|
||||
- stage: test and coverage
|
||||
name: "Test with Sqlite backend"
|
||||
env:
|
||||
- MIGRATION_DIR=migrations/sqlite FEATURES=sqlite DATABASE_URL=plume.sqlite3
|
||||
- RUSTFLAGS='-C link-dead-code' RUST_TEST_THREADS=1
|
||||
script:
|
||||
- |
|
||||
cargo test --features "${FEATURES}" --no-default-features --all --exclude plume-front &&
|
||||
./script/compute_coverage.sh
|
@ -1 +1 @@
|
||||
nightly-2018-12-06
|
||||
nightly-2019-03-23
|
||||
|
Loading…
Reference in New Issue