Skip to content

Commit

Permalink
Support overriding services for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhoo committed Sep 3, 2019
1 parent cd83951 commit 1833e53
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions azure/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
envs: {}
services: {}
setup: []
submodules: recursive
nightly: false
Expand All @@ -10,6 +11,14 @@ jobs:
displayName: tarpaulin
pool:
vmImage: ubuntu-16.04
# this is sad: we need to spin up the service containers even if the token
# isn't set, since we can't set a service in a particular script step.
# once the fix to
# https://developercommunity.visualstudio.com/content/problem/642219/setting-output-variable-when-multiple-stages-share.html
# lands everywhere, we can move to multiple jobs instead, and then only the
# (conditional) second job will have this service.
services:
${{ insert }}: ${{ parameters.services }}
continueOnError: ${{ parameters.nightly }}
container:
${{ if eq('true', parameters.nightly) }}:
Expand Down
3 changes: 3 additions & 0 deletions azure/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
test_ignored: false
single_threaded: false
features: '' # empty feature list is == default
services: {}

jobs:
- job: ${{ parameters.name }}
Expand All @@ -29,6 +30,8 @@ jobs:
vmImage: ubuntu-16.04
pool:
vmImage: $(vmImage)
services:
${{ insert }}: ${{ parameters.services }}
steps:
- template: _setup.yml
parameters:
Expand Down
12 changes: 10 additions & 2 deletions docs/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ parameters:
features: <string> = ''
envs:
NAME: value
services:
NAME: container
setup:
- task
```
Expand All @@ -192,6 +194,10 @@ set `test_ignored: true`. To run tests with
[`--test-threads=1`](https://doc.rust-lang.org/book/ch11-02-running-tests.html#running-tests-in-parallel-or-consecutively),
set `single_threaded: true`. To run tests with particular features
enabled, pass `features: "feat1,feat2,subcrate/feat3"`.
To spin up additional [service
containers](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/service-containers?view=azure-devops&tabs=yaml),
pass them in `services` (though note that these will generally only work
on Linux, so `cross: true` likely won't work).

### Style

Expand Down Expand Up @@ -235,8 +241,10 @@ and upload the coverage test results to
`codecov_token` that includes the codecov.io upload token (see the
[setup instructions](setup.md#code-coverage)). You can also pass the
parameter `envs: {...}` to pass [environment
variables](configuration.md#environment-variables), and `setup: [...]`
to run [additional setup
variables](configuration.md#environment-variables), `services: {...}` to
run additional [service
containers](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/service-containers?view=azure-devops&tabs=yaml),
and `setup: [...]` to run [additional setup
steps](configuration.md#additional-setup-steps).

By default, your pipeline will test against the stable Rust version
Expand Down

0 comments on commit 1833e53

Please sign in to comment.