diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 70ce2c233..5cda67266 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/ci/azure-test-docker.yml b/ci/azure-test-docker.yml new file mode 100644 index 000000000..4b7b09e9e --- /dev/null +++ b/ci/azure-test-docker.yml @@ -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 diff --git a/integration_test b/integration_test index c54bbcbc7..164f2d1e0 100755 --- a/integration_test +++ b/integration_test @@ -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