Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ code compiles with and without any features it may have, and ensures
that your code works with an older Rust version. You can also
mix-and-match these checks if you wish.

The repository provides two main templates:
The repository provides three main templates:

- `default.yml`, which is a highly opinionated default CI that you can
use for most "normal" Rust projects.
- `nightly-only.yml`, which is a highly opinionated default CI that you
can use for Rust projects that only support nightly versions of Rust.
- `install-rust.yml`, a minimal template that just installs Rust and
has you write out the commands you want CI to run (see
`default.yml` for inspiration). You can specify a Rust version,
Expand Down Expand Up @@ -253,7 +255,7 @@ with
Then you can tweak it to your heart's desire!

There are some smaller configuration parameters available for `default.yml`
too:
too. Most of these also apply to `nightly-only.yml`.

### Testing on multiple platforms

Expand Down Expand Up @@ -285,6 +287,20 @@ you would give that version number as the `minrust` parameter to
`default.yml`. If you wish to disable the MSRV check, set `minrust`
to `false`.

#### Minimum supported nightly

If you are using the `nightly-only.yml` template, the equivalent of MSRV
checking is to check that you support some particular "oldest" nightly.
You can check this by specifying a date for the `min` parameter:

```yaml
jobs:
- template: nightly-only.yml@templates
parameters:
minrust: <false | YYYY-MM-DD> = false
```


### Environment variables

```yaml
Expand Down
117 changes: 117 additions & 0 deletions nightly-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
parameters:
min: false
setup: []
services: {}
env: {}
cross: true
dir: "."

jobs:
- job: style
displayName: Style linting
pool:
vmImage: ubuntu-18.04
continueOnError: true
steps:
# latest nightly may not have rustfmt/clippy
# we can't check for both:
# https://github.com/rust-lang/rustup-components-history/issues/9
# but we at least check for one.
# rustfmt _seems_ to break most often:
- bash: |
echo '##vso[task.setvariable variable=nightly]nightly-'$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustfmt)
displayName: "Determine latest style nightly"
- template: install-rust.yml
parameters:
rust: $(nightly)
components:
- rustfmt
- clippy
# Run any user-specific setup steps
- ${{ parameters.setup }}
- script: cargo fmt --all -- --check
workingDirectory: ${{ parameters.dir }}
displayName: cargo fmt --check
- script: cargo clippy --all
workingDirectory: ${{ parameters.dir }}
displayName: cargo clippy -- -D warnings
- job: main
displayName: Compile and test
dependsOn: []
${{ if eq('true', parameters.cross) }}:
strategy:
matrix:
Linux:
vmImage: ubuntu-18.04
rust: nightly
MacOS:
vmImage: macOS-10.15
rust: nightly
Windows:
vmImage: windows-2019
rust: nightly
${{ if ne('true', parameters.cross) }}:
strategy:
matrix:
Linux:
vmImage: ubuntu-18.04
rust: nightly
pool:
vmImage: $(vmImage)
services:
${{ insert }}: ${{ parameters.services }}
steps:
- template: install-rust.yml
parameters:
rust: $(rust)
# Run any user-specific setup steps
- ${{ parameters.setup }}
- script: cargo check
workingDirectory: ${{ parameters.dir }}
displayName: cargo check
- script: cargo check --no-default-features
workingDirectory: ${{ parameters.dir }}
displayName: cargo check --no-default-features
- script: cargo check --all-features
workingDirectory: ${{ parameters.dir }}
displayName: cargo check --all-features
- script: cargo test --all-features
workingDirectory: ${{ parameters.dir }}
displayName: cargo test
env:
${{ insert }}: ${{ parameters.env }}
- script: cargo doc --no-deps
workingDirectory: ${{ parameters.dir }}
displayName: cargo doc
- ${{ if ne('false', parameters.min) }}:
- job: msrv
displayName: "${{ format('Minimum supported Rust nightly: {0}', parameters.min) }}"
dependsOn: []
# This represents the minimum Rust version supported.
# Tests are not run as tests may require newer versions of nightly.
pool:
vmImage: ubuntu-18.04
steps:
- template: install-rust.yml
parameters:
rust: "${{ format('nightly-{0}', parameters.min) }}"
# Run any user-specific setup steps
- ${{ parameters.setup }}
- script: cargo check
workingDirectory: ${{ parameters.dir }}
displayName: cargo check
- script: cargo check --no-default-features
workingDirectory: ${{ parameters.dir }}
displayName: cargo check --no-default-features
- script: cargo check --all-features
workingDirectory: ${{ parameters.dir }}
displayName: cargo check --all-features
- ${{ if ne('', parameters.codecov_token) }}:
- template: coverage.yml
parameters:
token: ${{ parameters.codecov_token }}
setup: ${{ parameters.setup }}
services: ${{ parameters.services }}
env: ${{ parameters.env }}
dir: ${{ parameters.dir }}
nightly: true