aboutsummaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: 958b923928202821ea62578686da346a0bddba38 (plain) (blame)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
restore_registry: &RESTORE_REGISTRY
  restore_cache:
    key: registry
save_registry: &SAVE_REGISTRY
  save_cache:
    key: registry-{{ .BuildNum }}
    paths:
    - /usr/local/cargo/registry/index
openssl_key: &OPENSSL_KEY
  key: lib-{{ checksum "~/lib_key" }}-{{ checksum "test/build_openssl.sh" }}
restore_openssl: &RESTORE_OPENSSL
  restore_cache:
    <<: *OPENSSL_KEY
save_openssl: &SAVE_OPENSSL
  save_cache:
    <<: *OPENSSL_KEY
    paths:
    - /openssl
deps_key: &DEPS_KEY
  key: deps-1.20.0-{{ checksum "Cargo.lock" }}-{{ checksum "~/lib_key" }}-2
restore_deps: &RESTORE_DEPS
  restore_cache:
    <<: *DEPS_KEY
save_deps: &SAVE_DEPS
  save_cache:
    <<: *DEPS_KEY
    paths:
    - target
    - /usr/local/cargo/registry/cache

job: &JOB
  working_directory: ~/build
  docker:
  - image: rust:1.20.0
  steps:
  - checkout
  - run: apt-get update
  - run: apt-get remove -y libssl-dev
  - run: ./test/add_target.sh
  - *RESTORE_REGISTRY
  - run: cargo generate-lockfile
  - *SAVE_REGISTRY
  - run: echo "${LIBRARY}-${VERSION}-${TARGET}" > ~/lib_key
  - *RESTORE_OPENSSL
  - run: ./test/build_openssl.sh
  - *SAVE_OPENSSL
  - *RESTORE_DEPS
  - run: cargo run --manifest-path=systest/Cargo.toml --target $TARGET
  - run: |
      ulimit -c unlimited
      export PATH=$OPENSSL_DIR/bin:$PATH
      if [ "${NO_RUN}" = "1" ]; then
        TEST_ARGS=--no-run
      fi
      cargo test \
        --manifest-path=openssl/Cargo.toml \
        --target $TARGET \
        --all-features \
        $TEST_ARGS
  - run:
      command: |
        mkdir -p /tmp/core_dumps
        find . -name "core.*" -exec cp \{\} /tmp/core_dumps \;
        cp target/$TARGET/debug/openssl-* /tmp/core_dumps
      when: on_fail
  - store_artifacts:
      path: /tmp/core_dumps
  - *SAVE_DEPS

macos_job: &MACOS_JOB
  macos:
    xcode: "9.0"
  environment:
    RUSTUP_HOME: /usr/local/rustup
    CARGO_HOME: /usr/local/cargo
  steps:
  - checkout
  - run: sudo mkdir /opt
  - run: sudo chown -R $USER /usr/local /opt
  - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.20.0
  - run: sudo ln -s $CARGO_HOME/bin/* /usr/local/bin
  - *RESTORE_REGISTRY
  - run: cargo generate-lockfile
  - *SAVE_REGISTRY
  - run: echo "homebrew-x86_64-apple-darwin" > ~/lib_key
  - *RESTORE_DEPS
  - run: cargo run --manifest-path=systest/Cargo.toml
  - run: |
      PATH=/usr/local/opt/openssl/bin:$PATH
      cargo test --manifest-path=openssl/Cargo.toml --all-features
  - *SAVE_DEPS

openssl_110: &OPENSSL_110
  LIBRARY: openssl
  VERSION: 1.1.0g
openssl_102: &OPENSSL_102
  LIBRARY: openssl
  VERSION: 1.0.2n
openssl_101: &OPENSSL_101
  LIBRARY: openssl
  VERSION: 1.0.1u
libressl_250: &LIBRESSL_250
  LIBRARY: libressl
  VERSION: 2.5.0
libressl_263: &LIBRESSL_263
  LIBRARY: libressl
  VERSION: 2.6.3

x86_64: &X86_64
  TARGET: x86_64-unknown-linux-gnu
i686: &I686
  TARGET: i686-unknown-linux-gnu
armhf: &ARMHF
  TARGET: arm-unknown-linux-gnueabihf
  NO_RUN: 1
  CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
  CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_AR: arm-linux-gnueabihf-ar
  CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER: qemu-arm-static
darwin: &DARWIN
  TARGET: x86_64-apple-darwin

base: &BASE
  RUST_BACKTRACE: 1
  OPENSSL_DIR: /openssl

version: 2
jobs:
  x86_64-openssl-1.1.0:
    <<: *JOB
    environment:
      <<: [*OPENSSL_110, *X86_64, *BASE]
  x86_64-openssl-1.0.2:
    <<: *JOB
    environment:
      <<: [*OPENSSL_102, *X86_64, *BASE]
  x86_64-openssl-1.0.1:
    <<: *JOB
    environment:
      <<: [*OPENSSL_101, *X86_64, *BASE]
  i686-openssl-1.1.0:
    <<: *JOB
    environment:
      <<: [*OPENSSL_110, *I686, *BASE]
  i686-openssl-1.0.2:
    <<: *JOB
    environment:
      <<: [*OPENSSL_102, *I686, *BASE]
  i686-openssl-1.0.1:
    <<: *JOB
    environment:
      <<: [*OPENSSL_101, *I686, *BASE]
  armhf-openssl-1.1.0:
    <<: *JOB
    environment:
      <<: [*OPENSSL_110, *ARMHF, *BASE]
  armhf-openssl-1.0.2:
    <<: *JOB
    environment:
      <<: [*OPENSSL_102, *ARMHF, *BASE]
  armhf-openssl-1.0.1:
    <<: *JOB
    environment:
      <<: [*OPENSSL_101, *ARMHF, *BASE]
  x86_64-libressl-2.5.0:
    <<: *JOB
    environment:
      <<: [*LIBRESSL_250, *X86_64, *BASE]
  x86_64-libressl-2.6.3:
    <<: *JOB
    environment:
      <<: [*LIBRESSL_263, *X86_64, *BASE]
  macos:
    <<: *MACOS_JOB
workflows:
  version: 2
  tests:
    jobs:
    - x86_64-openssl-1.1.0
    - x86_64-openssl-1.0.2
    - x86_64-openssl-1.0.1
    - i686-openssl-1.1.0
    - i686-openssl-1.0.2
    - i686-openssl-1.0.1
    - armhf-openssl-1.1.0
    - armhf-openssl-1.0.2
    - armhf-openssl-1.0.1
    - x86_64-libressl-2.5.0
    - x86_64-libressl-2.6.3
    - macos