Repository navigation
Expand file tree
/
Copy pathconfig.yml
More file actions
124 lines (121 loc) · 3.53 KB
/
Copy pathconfig.yml
File metadata and controls
124 lines (121 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
version: 2.1
executors:
default:
docker:
- image: 'rust:1.34-stretch'
environment:
MAKE_LIBSASS_JOBS: '4'
BUILD_JOBS: '4'
docker:
docker:
- image: 'docker:18.09'
jobs:
lint:
executor: 'default'
steps:
- 'checkout'
- run: 'rustup component add rustfmt'
- run: 'cargo fmt -- --check'
build:
executor: 'default'
parameters:
release:
type: 'boolean'
default: false
steps:
- 'checkout'
- restore_cache:
key: 'v1-cargo-lock-{{ checksum "Cargo.lock"}}<<# parameters.release >>-release<</ parameters.release>>'
- run: 'cargo build --jobs ${BUILD_JOBS} <<# parameters.release >>--release --locked<</ parameters.release>>'
- save_cache:
key: 'v1-cargo-lock-{{ checksum "Cargo.lock"}}<<# parameters.release >>-release<</ parameters.release>>'
paths:
- '/usr/local/cargo/registry'
- 'target/'
test:
executor: 'default'
parameters:
release:
type: 'boolean'
default: false
steps:
- 'checkout'
- restore_cache:
key: 'v1-cargo-lock-{{ checksum "Cargo.lock"}}<<# parameters.release >>-release<</ parameters.release>>'
- run: 'cargo test <<# parameters.release >>--release --locked<</ parameters.release>>'
build_and_push_docker_image:
executor: 'docker'
environment:
DOCKER_USER: 'mozamimy'
steps:
- 'checkout'
- setup_remote_docker:
docker_layer_caching: true
- run: 'docker build --tag mozamimy/salmon:latest --tag mozamimy/salmon:${CIRCLE_TAG:1} --tag mozamimy/salmon:${CIRCLE_SHA1} .'
- run: 'docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}'
- run: 'docker push mozamimy/salmon:latest'
- run: 'docker push mozamimy/salmon:${CIRCLE_TAG:1}'
- run: 'docker push mozamimy/salmon:${CIRCLE_SHA1}'
publish_crate:
executor: 'default'
steps:
- 'checkout'
- restore_cache:
key: 'v1-cargo-lock-{{ checksum "Cargo.lock"}}-release'
- run: 'cargo login ${CRATES_IO_API_TOKEN}'
- run: 'cargo package --jobs ${BUILD_JOBS} --locked'
# Cannot publish this crate because using forked sass-rs now.
# https://github.com/mozamimy/sass-rs/tree/make-libsass-env
# We are waiting to merge https://github.com/compass-rs/sass-rs/pull/43.
# - run: 'cargo publish --jobs ${BUILD_JOBS} --locked'
workflows:
version: 2
# This workflow is invoked in all branches.
run_test:
jobs:
- 'lint'
- 'build'
- test:
requires:
- 'lint'
- 'build'
# This workflow is invoked when a vX.Y.Z tag is pushed.
release:
jobs:
- lint:
filters:
branches:
ignore: '/.*/'
tags:
only: '/^v\d+\.\d+\.\d+/'
- build:
release: true
filters:
branches:
ignore: '/.*/'
tags:
only: '/^v\d+\.\d+\.\d+/'
- test:
release: true
requires:
- 'lint'
- 'build'
filters:
tags:
only: '/^v\d+\.\d+\.\d+/'
- build_and_push_docker_image:
requires:
- 'test'
filters:
branches:
ignore: '/.*/'
tags:
only: '/^v\d+\.\d+\.\d+/'
- publish_crate:
requires:
- 'test'
filters:
branches:
ignore: '/.*/'
tags:
only: '/^v\d+\.\d+\.\d+/'