Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix builds for new toolchain #122

Merged
merged 3 commits into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 53 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
---
version: 2
defaults: &defaults
version: 2.1

executors:
docker:
- image: saschagrunert/build-rust
defaults-postgres: &defaults-postgres
docker:
- image: saschagrunert/build-rust
- image: circleci/postgres:10.4-alpine
environment:
POSTGRES_USER: username
POSTGRES_DB: database
docker:
- image: &image saschagrunert/build-rust
docker-with-postgres:
docker:
- image: *image
- image: &postgresimage circleci/postgres:10.4-alpine
environment: &defaultEnv
POSTGRES_USER: username
POSTGRES_DB: database
machine:
machine:
docker_layer_caching: true
image: ubuntu-1604:201903-01
environment: *defaultEnv

prepare-postgres: &prepare-postgres
run:
name: Prepare database
Expand All @@ -19,6 +27,7 @@ prepare-postgres: &prepare-postgres
done
diesel migration run \
--database-url postgres://username:@localhost/database

workflows:
version: 2
pipeline:
Expand Down Expand Up @@ -48,7 +57,7 @@ workflows:
- master
jobs:
build:
<<: *defaults
executor: docker
steps:
- checkout
- run:
Expand All @@ -69,7 +78,7 @@ jobs:
- /root/.cargo/registry
- target
doc:
<<: *defaults
executor: docker
steps:
- checkout
- restore_cache:
Expand All @@ -88,7 +97,7 @@ jobs:
paths:
- target/doc
doc-publish:
<<: *defaults
executor: docker
steps:
- add_ssh_keys:
fingerprints:
Expand All @@ -112,14 +121,14 @@ jobs:
git diff-index --quiet HEAD || git commit -m 'Update documentation'
git push -f origin gh-pages
rustfmt:
<<: *defaults
executor: docker
steps:
- checkout
- run:
name: Rust-Format
command: make lint-rustfmt
clippy:
<<: *defaults
executor: docker
steps:
- checkout
- restore_cache:
Expand All @@ -134,18 +143,34 @@ jobs:
- /root/.cargo/registry
- target
test:
<<: *defaults-postgres
executor: machine
steps:
- checkout
- <<: *prepare-postgres
- run:
name: Run tests
command: make coverage
name: Start postgres
environment:
IMAGE: *postgresimage
command: |
docker pull $IMAGE
docker run -d --network=host -e POSTGRES_USER -e POSTGRES_DB $IMAGE
- run:
name: Upload coverage report
command: bash <(curl -s https://codecov.io/bash)
name: Run tests
environment:
IMAGE: *image
command: |
docker pull $IMAGE
docker run -t --security-opt seccomp=unconfined -v $(pwd):/build \
-w /build --network=host -e CODECOV_TOKEN $IMAGE \
bash -c "\
while true; do \
if pg_isready -qh localhost; then break; fi \
done && \
diesel migration run \
--database-url postgres://username:@localhost/database && \
make coverage && \
bash <(curl -s https://codecov.io/bash)"
bench:
<<: *defaults-postgres
executor: docker-with-postgres
steps:
- checkout
- <<: *prepare-postgres
Expand All @@ -154,14 +179,16 @@ jobs:
- bench-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Run benchmarks
command: make bench
command: |
rustup default nightly
make bench
- save_cache:
key: bench-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- /root/.cargo/registry
- target
docker:
machine: true
executor: machine
steps:
- checkout
- restore_cache:
Expand All @@ -184,7 +211,7 @@ jobs:
paths:
- webapp.tar
docker-test:
machine: true
executor: machine
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -217,7 +244,7 @@ jobs:
- ~/.cargo
- target
deploy:
machine: true
executor: machine
steps:
- checkout
- attach_workspace:
Expand Down
Loading