Use starship-test docker image for running integration tests (#70)

* Publish docker image used in testing
* Update integration_test to pull the image and build, using the image as its cache
* Publish the built image after successful test runs on master
This commit is contained in:
Matan Kushner 2019-05-29 13:27:18 +02:00 committed by GitHub
parent 5b1c2107db
commit 617b278a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 8 deletions

View file

@ -17,9 +17,7 @@ jobs:
displayName: Check starship with nightly
# Run the integration tests in a Docker container
- job: test_docker
displayName: Test starship Docker
pool:
vmImage: ubuntu-16.04
steps:
- script: ./integration_test
- template: ci/azure-test-docker.yml
parameters:
name: test_docker
displayName: Test starship Docker

16
ci/azure-test-docker.yml Normal file
View file

@ -0,0 +1,16 @@
jobs:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
pool:
vmImage: ubuntu-16.04
steps:
- script: ./integration_test
displayName: Run integration test within Docker
- script: |
docker login -u $(dockerUsername) -p $(dockerPassword)
docker push starshipcommand/starship-test
# Only push new image if on master and build is passing
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Push image to dockerhub

View file

@ -6,8 +6,14 @@ if ! (docker --version); then
exit 1
fi
printf 'Pulling latest docker image'
docker pull starshipcommand/starship-test
printf 'Building test docker image:\n'
docker build -f tests/Dockerfile --tag starship-test .
docker build -f tests/Dockerfile \
--tag starshipcommand/starship-test \
--cache-from starshipcommand/starship-test \
.
printf 'Running test suite:\n'
docker run --rm -t -v $(pwd):/starship starship-test
docker run --rm -t -v $(pwd):/starship starshipcommand/starship-test