2019-04-01 20:28:23 +02:00
|
|
|
version: 2.1
|
|
|
|
|
2019-05-04 15:35:21 +02:00
|
|
|
executors:
|
|
|
|
default:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
selenium:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2019-04-01 20:28:23 +02:00
|
|
|
docker:
|
2021-02-12 05:10:32 +01:00
|
|
|
- image: plumeorg/plume-buildenv:v0.4.0
|
2019-05-04 15:35:21 +02:00
|
|
|
- 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 20:28:23 +02:00
|
|
|
working_directory: ~/projects/Plume
|
|
|
|
environment:
|
|
|
|
RUST_TEST_THREADS: 1
|
2019-05-04 15:35:21 +02: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>>
|
2021-01-24 17:25:37 +01:00
|
|
|
ROCKET_SECRET_KEY: VN5xV1DN7XdpATadOCYcuGeR/dV0hHfgx9mx9TarLdM=
|
2021-02-12 10:11:49 +01:00
|
|
|
RUSTFLAGS: --cfg=web_sys_unstable_apis
|
2019-05-04 15:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
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 20:28:23 +02:00
|
|
|
- ~/.cargo/
|
|
|
|
- ./target
|
|
|
|
|
2019-05-04 15:35:21 +02:00
|
|
|
clippy:
|
|
|
|
description: run cargo clippy
|
|
|
|
parameters:
|
|
|
|
package:
|
|
|
|
type: string
|
|
|
|
default: plume
|
|
|
|
no_feature:
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2019-04-01 20:28:23 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- run: cargo clippy <<^parameters.no_feature>>--no-default-features --features="${FEATURES}"<</parameters.no_feature>> --release -p <<parameters.package>> -- -D warnings
|
2019-04-06 17:41:57 +02:00
|
|
|
|
2019-05-04 15:35:21 +02:00
|
|
|
run_with_coverage:
|
|
|
|
description: run command with environment for coverage
|
|
|
|
parameters:
|
|
|
|
cmd:
|
|
|
|
type: string
|
2019-04-06 17:41:57 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- run: |
|
2021-02-12 10:11:49 +01:00
|
|
|
export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads $RUSTFLAGS"
|
2019-05-04 15:35:21 +02:00
|
|
|
export CARGO_INCREMENTAL=0
|
|
|
|
<< parameters.cmd >>
|
|
|
|
|
|
|
|
upload_coverage:
|
|
|
|
description: merge coverage files and upload to codecov.io
|
|
|
|
parameters:
|
|
|
|
type:
|
|
|
|
type: string
|
2019-04-19 12:36:45 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- run: zip -0 ccov.zip `find . -name 'plume*.gc*' -o -name 'plm*.gc*'`
|
2019-12-30 14:35:27 +01:00
|
|
|
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info
|
2019-05-04 15:35:21 +02:00
|
|
|
- run: bash <(curl -s https://codecov.io/bash) -f lcov.info -F <<parameters.type>>
|
2019-05-12 21:14:59 +02:00
|
|
|
- run: find . -name 'plume*.gc*' -delete -o -name 'plm*.gc*' -delete
|
2019-05-04 15:35:21 +02: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"
|
2021-02-06 19:28:07 +01:00
|
|
|
for i in 16 4 2 1 1; do
|
2019-05-04 15:35:21 +02:00
|
|
|
$cmd $i && exit 0
|
|
|
|
done
|
|
|
|
exit 1
|
2019-04-19 12:36:45 +02:00
|
|
|
|
2019-04-01 20:28:23 +02:00
|
|
|
jobs:
|
2019-05-04 15:35:21 +02:00
|
|
|
cargo fmt:
|
|
|
|
executor:
|
|
|
|
name: default
|
2019-04-01 20:28:23 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- restore_env
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
parameters:
|
|
|
|
postgres:
|
|
|
|
type: boolean
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
postgres: << parameters.postgres >>
|
2019-04-01 20:28:23 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02: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 20:28:23 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- restore_env:
|
|
|
|
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
|
|
|
|
- run_with_coverage:
|
|
|
|
cmd: |
|
2021-02-06 19:13:38 +01:00
|
|
|
cargo build -p plume-cli --no-default-features --features=${FEATURES} -j 4
|
2021-01-24 16:46:26 +01:00
|
|
|
./target/debug/plm migration run
|
|
|
|
./target/debug/plm search init
|
2019-05-04 15:35:21 +02:00
|
|
|
cmd="cargo test --all --exclude plume-front --exclude plume-macro --no-run --no-default-features --features=${FEATURES} -j"
|
2021-02-06 19:28:07 +01:00
|
|
|
for i in 16 4 2 1 1; do
|
2019-05-04 15:35:21 +02:00
|
|
|
$cmd $i && break
|
|
|
|
done
|
2021-01-24 14:45:32 +01:00
|
|
|
cargo test --all --exclude plume-front --exclude plume-macro --no-default-features --features="${FEATURES}" -j1
|
2019-05-04 15:35:21 +02:00
|
|
|
- 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>>
|
2021-02-12 10:11:49 +01:00
|
|
|
- run: wasm-pack build --target web --release plume-front
|
2019-05-04 15:35:21 +02:00
|
|
|
- run_with_coverage:
|
|
|
|
cmd: |
|
|
|
|
cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j"
|
2021-02-06 19:28:07 +01:00
|
|
|
for i in 16 4 2 1 1; do
|
2019-05-04 15:35:21 +02:00
|
|
|
$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"
|
2021-02-06 19:28:07 +01:00
|
|
|
for i in 16 4 2 1 1; do
|
2019-05-04 15:35:21 +02:00
|
|
|
$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>>
|
2021-02-12 10:11:49 +01:00
|
|
|
- run: wasm-pack build --target web --release plume-front
|
2019-05-04 15:35:21 +02:00
|
|
|
- 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 15:38:43 +02:00
|
|
|
- store_artifacts:
|
|
|
|
path: wasm.tar.gz
|
|
|
|
destination: wasm.tar.gz
|
2019-05-04 15:35:21 +02:00
|
|
|
|
|
|
|
push translations:
|
|
|
|
executor:
|
|
|
|
name: default
|
2019-04-19 12:36:45 +02:00
|
|
|
steps:
|
2019-05-04 15:35:21 +02:00
|
|
|
- restore_env:
|
|
|
|
cache: none
|
2020-04-14 20:51:53 +02:00
|
|
|
- run: cargo build
|
2019-05-12 21:14:59 +02:00
|
|
|
- run: crowdin upload -b master
|
2019-04-01 20:28:23 +02:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2019-05-04 15:35:21 +02:00
|
|
|
build and test:
|
2019-04-01 20:28:23 +02:00
|
|
|
jobs:
|
2019-05-04 15:35:21 +02: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/
|