我有这个travis.yml
,travis-ci.org抱怨它无法解析。
language: rust
rust:
- 1.31.0
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
sudo: false
before_script:
- rustup component add rustfmt
- rustup target add thumbv7em-none-eabihf # Any target that does not have a standard library will do
script:
- cargo fmt --all -- --check
- (rustup component add clippy && cargo clippy --all -- -D clippy::all) || true
- cargo build
- cargo test
- cargo build --no-default-features --features alloc --target thumbv7em-none-eabihf # Test we can build a platform that does not have std.
- cargo test --no-default-features --lib --tests # Run no_std tests
- [[ $TRAVIS_RUST_VERSION != "1.31.0" ]] && cargo build --no-default-features --features alloc
- cargo build --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled.
- cargo build --no-default-features --features unsealed_read_write # The crate should still build when the unsealed_read_write feature is enabled and std disabled.
此文件属于https://github.com/pyfisch/cbor,显然引起解析失败的行是- [[ $TRAVIS_RUST_VERSION != "1.31.0" ]] && cargo build --no-default-features --features alloc
。
Online Travis.yml validation没什么用(不推荐使用,已删除且无替换)。
需要进行哪些更改才能使Travis重新构建?
答案 0 :(得分:1)
[
字符在YAML中是特殊字符,与其他一些字符一样。
如果您的字符串以它开头,则需要将其引号。
我建议对更长的字符串使用块标量。您可以使用文字量块标量,其将被直接使用:
- |
[[ $TRAVIS_RUST_VERSION != "1.31.0" ]] && cargo build --no-default-features --features alloc
或折叠的块标量,使您可以将线分成多条线。它将与空格一起折叠:
- >
[[ $TRAVIS_RUST_VERSION != "1.31.0" ]]
&& cargo build --no-default-features --features alloc
如果您想了解有关在YAML中引用字符串的更多信息,我建议您使用my article on this。