1language: rust
2dist: focal
3sudo: false
4notifications:
5  webhooks:
6    if: fork = false
7    urls:
8      - https://webhooks.gitter.im/e/816755464e93a0defff0
9    on_success: change
10    on_failure: always
11    on_start: never
12os:
13  - linux
14rust:
15  - 1.34.2
16  - stable
17  - beta
18  - nightly
19env:
20  global:
21    - secure: "WI/r7hbDhenb7zPXht8J0mhcx5aUgY22cCrwYmNksMmgIK9hYfPjZ68XzaQ7+Ity8b12TlHM8lGRN9bIsyAZEiRIkxkZAArY9bXAOExJaAT+yOyxhEs/QdrGB6iRhC6FTxPwgUH82j0nFL1UI7HqBnOy3g3tv23jq1AlD9N3t0k="
22  matrix:
23    - DEFAULT_FEATURES='yes'
24    - FEATURES=''
25    - FEATURES='gif'
26    - FEATURES='jpeg'
27    - FEATURES='png'
28    - FEATURES='pnm'
29    - FEATURES='tga'
30    - FEATURES='dds'
31    - FEATURES='tiff'
32    - FEATURES='webp'
33    - FEATURES='hdr'
34    - FEATURES='farbfeld'
35matrix:
36  allow_failures:
37    - name: "Clippy"
38    - name: "Public private dependencies"
39    - name: "Fuzz corpus"
40    - rust: nightly
41  include:
42    - os: linux
43      rust: stable
44      env: FEATURES='ravif'
45      before_install:
46        - sudo apt-get update &&
47          sudo apt-get -y install nasm;
48      script:
49        - cargo test -v --no-default-features --features "$FEATURES" &&
50          cargo doc -v --no-default-features --features "$FEATURES";
51    - os: osx
52      rust: 1.34.2
53    - os: windows
54      rust: 1.34.2
55    - os: osx
56      rust: stable
57    - os: windows
58      rust: stable
59    - os: osx
60      rust: nightly
61    - os: windows
62      rust: nightly
63    - os: linux
64      rust: nightly
65      name: "Internal benchmarks"
66      env: BENCHMARKS='yes'
67    - os: linux
68      rust: stable
69      name: "Clippy"
70      script:
71        - rustup component add clippy
72        - cargo clippy
73    - os: linux
74      rust: stable
75      name: "Fuzz targets (afl)"
76      script:
77        - cargo install afl
78        - cd fuzz-afl
79        - cargo check --bin reproduce_webp
80        - cargo check --bin reproduce_pnm
81        - cargo afl check --bin fuzz_webp
82        - cargo afl check --bin fuzz_pnm
83    - os: linux
84      rust: nightly
85      name: "Fuzz targets (cargo-fuzz)"
86      script:
87        - cargo install cargo-fuzz
88        - cargo fuzz build
89    - os: linux
90      rust: nightly
91      name: "Fuzz corpus"
92      script:
93        - cargo install cargo-fuzz
94        - cargo fuzz build
95        - for format in $(cargo fuzz list); do
96            cargo fuzz run "$format" -- -runs=0;
97          done
98    - os: linux
99      rust: nightly
100      name: "Public private dependencies"
101      script:
102        - mv ./Cargo.toml.public-private-dependencies ./Cargo.toml
103        - echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0
104        - mv src/lib.rs.0 src/lib.rs
105        - cargo check
106script:
107  - if [ -n "${FEATURES+exists}" ]; then
108      cargo build -v --no-default-features --features "$FEATURES" &&
109      if [[ "$(cargo --version)" != "cargo 1.34"* ]]; then
110        cargo test -v --no-default-features --features "$FEATURES" &&
111        cargo doc -v --no-default-features --features "$FEATURES";
112      fi
113    fi
114  - if [ -n "${DEFAULT_FEATURES+exists}" ]; then
115      if [[ "$(cargo --version)" != "cargo 1.34"* ]]; then
116        cargo test -v;
117      fi
118    fi
119  - if [ -n "${BENCHMARKS+exists}" ]; then
120      cargo build -v --benches --features=benchmarks;
121    fi
122