Skip to content

Commit

Permalink
Use starship-test docker image for running integration tests (starshi…
Browse files Browse the repository at this point in the history
…p#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
  • Loading branch information
matchai authored May 29, 2019
1 parent 5b1c210 commit 617b278
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
10 changes: 4 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 16 additions & 0 deletions ci/azure-test-docker.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 617b278

Please sign in to comment.