2019-04-01 18:28:23 +00:00
|
|
|
version: 2.1
|
|
|
|
|
2019-05-04 13:35:21 +00:00
|
|
|
executors:
|
|
|
|
default:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
selenium:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2019-04-01 18:28:23 +00:00
|
|
|
docker:
|
2019-05-04 13:35:21 +00:00
|
|
|
- image: plumeorg/plume-buildenv:v0.0.7
|
|
|
|
- image: <<#parameters.postgres>>circleci/postgres:9.6-alpine<</parameters.postgres>><<^parameters.postgres>>alpine:latest<</parameters.postgres>>
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_DB: plume
|
|
|
|
- image: <<#parameters.selenium>>elgalu/selenium:latest<</parameters.selenium>><<^parameters.selenium>>alpine:latest<</parameters.selenium>>
|
2019-04-01 18:28:23 +00:00
|
|
|
working_directory: ~/projects/Plume
|
|
|
|
environment:
|
|
|
|
RUST_TEST_THREADS: 1
|
2019-05-04 13:35:21 +00:00
|
|
|
FEATURES: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
DATABASE_URL: <<#parameters.postgres>>postgres://postgres@localhost/plume<</parameters.postgres>><<^parameters.postgres>>plume.sqlite<</parameters.postgres>>
|
|
|
|
|
|
|
|
|
|
|
|
commands:
|
|
|
|
restore_env:
|
|
|
|
description: checkout and pull cache
|
|
|
|
parameters:
|
|
|
|
cache:
|
|
|
|
type: enum
|
|
|
|
default: none
|
|
|
|
enum: ["none", "clippy", "postgres", "sqlite", "release-postgres", "release-sqlite"]
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: git config --global --remove-section url."ssh://git@github.com"
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-{{ .Branch }}
|
|
|
|
- v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-master
|
|
|
|
|
|
|
|
cache:
|
|
|
|
description: push cache
|
|
|
|
parameters:
|
|
|
|
cache:
|
|
|
|
type: enum
|
|
|
|
enum: ["clippy", "postgres", "sqlite", "release-postgres", "release-sqlite"]
|
|
|
|
steps:
|
|
|
|
- save_cache:
|
|
|
|
key: v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-{{ .Branch }}
|
|
|
|
paths:
|
2019-04-01 18:28:23 +00:00
|
|
|
- ~/.cargo/
|
|
|
|
- ./target
|
|
|
|
|
2019-05-04 13:35:21 +00:00
|
|
|
clippy:
|
|
|
|
description: run cargo clippy
|
|
|
|
parameters:
|
|
|
|
package:
|
|
|
|
type: string
|
|
|
|
default: plume
|
|
|
|
no_feature:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2019-04-01 18:28:23 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- run: cargo clippy <<^parameters.no_feature>>--no-default-features --features="${FEATURES}"<</parameters.no_feature>> --release -p <<parameters.package>> -- -D warnings
|
2019-04-06 15:41:57 +00:00
|
|
|
|
2019-05-04 13:35:21 +00:00
|
|
|
run_with_coverage:
|
|
|
|
description: run command with environment for coverage
|
|
|
|
parameters:
|
|
|
|
cmd:
|
|
|
|
type: string
|
2019-04-06 15:41:57 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- run: |
|
|
|
|
export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads"
|
|
|
|
export CARGO_INCREMENTAL=0
|
|
|
|
<< parameters.cmd >>
|
|
|
|
|
|
|
|
upload_coverage:
|
|
|
|
description: merge coverage files and upload to codecov.io
|
|
|
|
parameters:
|
|
|
|
type:
|
|
|
|
type: string
|
2019-04-19 10:36:45 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- run: zip -0 ccov.zip `find . -name 'plume*.gc*' -o -name 'plm*.gc*'`
|
|
|
|
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir '/*' -o lcov.info
|
|
|
|
- run: bash <(curl -s https://codecov.io/bash) -f lcov.info -F <<parameters.type>>
|
2019-05-12 19:14:59 +00:00
|
|
|
- run: find . -name 'plume*.gc*' -delete -o -name 'plm*.gc*' -delete
|
2019-05-04 13:35:21 +00:00
|
|
|
- run: rm ccov.zip lcov.info
|
|
|
|
|
|
|
|
build:
|
|
|
|
description: build a package
|
|
|
|
parameters:
|
|
|
|
package:
|
|
|
|
type: string
|
|
|
|
default: plume
|
|
|
|
release:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
steps:
|
|
|
|
- run: |
|
|
|
|
cmd="cargo build <<#parameters.release>>--release<</parameters.release>> --no-default-features --features="${FEATURES}" -p <<parameters.package>> -j"
|
|
|
|
for i in 36 4 2 1 1; do
|
|
|
|
$cmd $i && exit 0
|
|
|
|
done
|
|
|
|
exit 1
|
2019-04-19 10:36:45 +00:00
|
|
|
|
2019-04-01 18:28:23 +00:00
|
|
|
jobs:
|
2019-05-04 13:35:21 +00:00
|
|
|
cargo fmt:
|
|
|
|
executor:
|
|
|
|
name: default
|
2019-04-01 18:28:23 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- restore_env
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
postgres: << parameters.postgres >>
|
2019-04-01 18:28:23 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- restore_env:
|
|
|
|
cache: clippy
|
|
|
|
- clippy
|
|
|
|
- clippy:
|
|
|
|
package: plume-cli
|
|
|
|
- clippy:
|
|
|
|
package: plume-front
|
|
|
|
no_feature: true
|
|
|
|
- cache:
|
|
|
|
cache: clippy
|
|
|
|
|
|
|
|
unit:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
postgres: << parameters.postgres >>
|
2019-04-01 18:28:23 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- restore_env:
|
|
|
|
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
- run_with_coverage:
|
|
|
|
cmd: |
|
|
|
|
cmd="cargo test --all --exclude plume-front --exclude plume-macro --no-run --no-default-features --features=${FEATURES} -j"
|
|
|
|
for i in 36 4 2 1 1; do
|
|
|
|
$cmd $i && break
|
|
|
|
done
|
|
|
|
cargo test --all --exclude plume-front --exclude plume-macro --no-default-features --features="${FEATURES}" -j1 -- --test-threads=1
|
|
|
|
- upload_coverage:
|
|
|
|
type: unit
|
|
|
|
- cache:
|
|
|
|
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
|
|
|
|
integration:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
postgres: << parameters.postgres >>
|
|
|
|
selenium: true
|
|
|
|
steps:
|
|
|
|
- restore_env:
|
|
|
|
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
- run: cargo web deploy -p plume-front
|
|
|
|
- run_with_coverage:
|
|
|
|
cmd: |
|
|
|
|
cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j"
|
|
|
|
for i in 36 4 2 1 1; do
|
|
|
|
$cmd $i && exit 0
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
- run_with_coverage:
|
|
|
|
cmd: |
|
|
|
|
cmd="cargo install --debug --no-default-features --features="${FEATURES}" --force --path plume-cli -j"
|
|
|
|
for i in 36 4 2 1 1; do
|
|
|
|
$cmd $i && exit 0
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
- run:
|
|
|
|
name: run test
|
|
|
|
command: ./script/run_browser_test.sh
|
|
|
|
environment:
|
|
|
|
BROWSER: firefox
|
|
|
|
- upload_coverage:
|
|
|
|
type: integration
|
|
|
|
- cache:
|
|
|
|
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
|
|
|
|
release:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
postgres: << parameters.postgres >>
|
|
|
|
steps:
|
|
|
|
- restore_env:
|
|
|
|
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
- run: cargo web deploy -p plume-front --release
|
|
|
|
- build:
|
|
|
|
package: plume
|
|
|
|
release: true
|
|
|
|
- build:
|
|
|
|
package: plume-cli
|
|
|
|
release: true
|
|
|
|
- cache:
|
|
|
|
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
- run: ./script/generate_artifact.sh
|
|
|
|
- unless:
|
|
|
|
condition: << parameters.postgres >>
|
|
|
|
steps:
|
|
|
|
- run: ./script/upload_test_environment.sh
|
|
|
|
- store_artifacts:
|
|
|
|
path: plume.tar.gz
|
|
|
|
destination: plume.tar.gz
|
2019-05-10 13:38:43 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: wasm.tar.gz
|
|
|
|
destination: wasm.tar.gz
|
2019-05-04 13:35:21 +00:00
|
|
|
|
|
|
|
push translations:
|
|
|
|
executor:
|
|
|
|
name: default
|
2019-04-19 10:36:45 +00:00
|
|
|
steps:
|
2019-05-04 13:35:21 +00:00
|
|
|
- restore_env:
|
|
|
|
cache: none
|
2019-05-12 19:14:59 +00:00
|
|
|
- run: crowdin upload -b master
|
2019-04-01 18:28:23 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-05-04 13:35:21 +00:00
|
|
|
build and test:
|
2019-04-01 18:28:23 +00:00
|
|
|
jobs:
|
2019-05-04 13:35:21 +00:00
|
|
|
- cargo fmt
|
|
|
|
- clippy:
|
|
|
|
postgres: false
|
|
|
|
- clippy:
|
|
|
|
postgres: true
|
|
|
|
- unit:
|
|
|
|
postgres: false
|
|
|
|
- unit:
|
|
|
|
postgres: true
|
|
|
|
- integration:
|
|
|
|
postgres: false
|
|
|
|
- integration:
|
|
|
|
postgres: true
|
|
|
|
- release:
|
|
|
|
postgres: false
|
|
|
|
- release:
|
|
|
|
postgres: true
|
|
|
|
- push translations:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /^master/
|