diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 298b26f..e6258c6 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -23,21 +23,126 @@ resources: source: port: 2375 host: mdev.local +- name: rust + type: registry-image + source: + repository: rust jobs: - name: test plan: - get: repo + - get: rust trigger: true - task: test - file: repo/ci/test.yml + config: + platform: linux + image: 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 - file: repo/ci/lint.yml + 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 - file: repo/ci/audit.yml + 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 - file: repo/ci/check-fmt.yml + 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: @@ -45,26 +150,69 @@ jobs: trigger: true passed: [test] - task: build-linux - file: repo/ci/build-linux.yml + 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 - file: repo/ci/build-docker.yml + 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: - DOCKER_HOST: "tcp://mdev.local" - command: restart - # compose_file: repo/docker-compose.yml + command: down + path: repo + - put: deploy + params: + command: up path: repo pull: true - # path: home/mitchell/prod/school_app_api - # path: code