engage_earn_api/ci/pipeline.yml

218 lines
4.1 KiB
YAML

# Remember to update the pipeline after changing this file with
# `fly set-pipeline`
resource_types:
- name: docker-compose
type: docker-image
source:
repository: troykinsella/concourse-docker-compose-resource
tag: latest
resources:
- name: repo
type: git
source: {uri: "http://git.mdev.local/mitchell/school_app_api.git"}
- name: docker-image
type: registry-image
icon: docker
source:
repository: registry.mdev.local/school_app_api
insecure: true
tag: latest
- name: deploy
type: docker-compose
source:
port: 2375
host: mdev.local
jobs:
- name: test
plan:
- get: repo
- get: rust
trigger: true
- task: test
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rust
params:
CARGO_HOME: "./.cargo-config/"
RUSTUP_HOME: "./.rustup-config"
caches:
- path: "./repo/target"
- path: "./repo/.cargo-config"
- path: "./repo/.rustup-config"
inputs:
- name: repo
run:
path: sh
args:
- -exc
- |
rustup default stable
cargo test
dir: repo
- task: lint
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rust
params:
CARGO_HOME: "./.cargo-config/"
RUSTUP_HOME: "./.rustup-config"
caches:
- path: "./repo/target"
- path: "./repo/.cargo-config"
- path: "./repo/.rustup-config"
inputs:
- name: repo
run:
path: sh
args:
- -exc
- |
rustup default stable
rustup component add clippy
cargo clippy
dir: repo
- task: audit
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rust
params:
CARGO_HOME: "./.cargo-config/"
RUSTUP_HOME: "./.rustup-config"
caches:
- path: "./repo/target"
- path: "./repo/.cargo-config"
- path: "./repo/.rustup-config"
inputs:
- name: repo
run:
path: sh
args:
- -exc
- |
rustup default stable
cargo install cargo-audit
cargo audit
dir: repo
- try:
task: check-fmt
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rust
params:
CARGO_HOME: "./.cargo-config/"
RUSTUP_HOME: "./.rustup-config"
caches:
- path: "./repo/target"
- path: "./repo/.cargo-config"
- path: "./repo/.rustup-config"
inputs:
- name: repo
run:
path: sh
args:
- -exc
- |
rustup default stable
rustup component add rustfmt
cargo fmt --check
dir: repo
- name: build
plan:
- get: repo
trigger: true
passed: [test]
- task: build-linux
config:
platform: linux
image_resource:
type: registry-image
source:
repository: rust
params:
CARGO_HOME: "./.cargo-config/"
RUSTUP_HOME: "./.rustup-config"
caches:
- path: "./repo/target"
- path: "./repo/.cargo-config"
- path: "./repo/.rustup-config"
inputs:
- name: repo
run:
path: sh
args:
- -exc
- |
rustup default stable
cargo build --release
dir: repo
- task: build-docker
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: concourse/oci-build-task
inputs:
- name: repo
path: .
outputs:
- name: image
run:
path: build
- put: docker-image
params:
image: image/image.tar
- name: deploy
serial: true
plan:
- get: repo
trigger: true
passed: [test, build]
- put: deploy
params:
command: down
path: repo
- put: deploy
params:
command: up
path: repo
pull: true