Use pre-prepared Docker image in CI to speed things up

This commit is contained in:
Alex Auvolat 2021-04-08 20:06:48 +02:00
parent 7ba80b6108
commit 6e28ea6bdc
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1
3 changed files with 22 additions and 28 deletions

View file

@ -28,42 +28,31 @@ steps:
cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip'
region: garage region: garage
mount: mount:
- 'target' - '/drone/cargo'
- '/drone/cargo/registry/index' #- 'target'
- '/drone/cargo/registry/cache'
- '/drone/cargo/bin'
- '/drone/cargo/git/db'
path_style: true path_style: true
endpoint: https://garage.deuxfleurs.fr endpoint: https://garage.deuxfleurs.fr
when:
branch:
- nonexistent_skip_this_step
- name: build - name: build
image: rust:buster image: lxpz/garage_builder_amd64:1
volumes: volumes:
- name: cargo_home - name: cargo_home
path: /drone/cargo path: /drone/cargo
environment: environment:
CARGO_HOME: /drone/cargo CARGO_HOME: /drone/cargo
commands: commands:
- apt-get update
- apt-get install --yes libsodium-dev
- rustup component add rustfmt
- pwd - pwd
- cargo fmt -- --check - cargo fmt -- --check
- cargo build - cargo build
- name: cargo-test - name: cargo-test
image: rust:buster image: lxpz/garage_builder_amd64:1
volumes: volumes:
- name: cargo_home - name: cargo_home
path: /drone/cargo path: /drone/cargo
environment: environment:
CARGO_HOME: /drone/cargo CARGO_HOME: /drone/cargo
commands: commands:
- apt-get update
- apt-get install --yes libsodium-dev
- cargo test - cargo test
- name: rebuild-cache - name: rebuild-cache
@ -84,28 +73,19 @@ steps:
cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip'
region: garage region: garage
mount: mount:
- 'target' - '/drone/cargo'
- '/drone/cargo/registry/index' #- 'target'
- '/drone/cargo/registry/cache'
- '/drone/cargo/git/db'
- '/drone/cargo/bin'
path_style: true path_style: true
endpoint: https://garage.deuxfleurs.fr endpoint: https://garage.deuxfleurs.fr
when:
branch:
- nonexistent_skip_this_step
- name: smoke-test - name: smoke-test
image: rust:buster image: lxpz/garage_builder_amd64:1
volumes: volumes:
- name: cargo_home - name: cargo_home
path: /drone/cargo path: /drone/cargo
environment: environment:
CARGO_HOME: /drone/cargo CARGO_HOME: /drone/cargo
commands: commands:
- apt-get update
- apt-get install --yes libsodium-dev awscli python-pip
- pip install s3cmd
- ./script/test-smoke.sh || (cat /tmp/garage.log; false) - ./script/test-smoke.sh || (cat /tmp/garage.log; false)
--- ---
@ -143,6 +123,6 @@ steps:
--- ---
kind: signature kind: signature
hmac: f16004516ebe576dd60b561738b707e34d258dc137b12c63715fdde4c86b7d58 hmac: af2fc8228c885d0f9a3326bf6f1e21cb85aef494a57a70608487ad47161ab1d2
... ...

View file

@ -0,0 +1,6 @@
FROM rust:buster
RUN apt-get update && \
apt-get install --yes libsodium-dev awscli python-pip && \
rm -rf /var/lib/apt/lists/*
RUN rustup component add rustfmt
RUN pip install s3cmd

View file

@ -0,0 +1,8 @@
DOCKER=lxpz/garage_builder_amd64
docker:
docker build -t $(DOCKER):$(TAG) .
docker push $(DOCKER):$(TAG)
docker tag $(DOCKER):$(TAG) $(DOCKER):latest
docker push $(DOCKER):latest