diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | ci/azure-test-docker.yml | 3 | ||||
-rwxr-xr-x | integration_test | 4 | ||||
-rw-r--r-- | tests/Dockerfile | 33 |
5 files changed, 26 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore index 4315faee5..958be4e10 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,7 @@ Cargo.lock .vscode/ # Intellij IDE configuration -.idea/
\ No newline at end of file +.idea/ + +# Cobertura coverage report +cobertura.xml @@ -4,7 +4,8 @@ <p align="center">The cross-shell prompt for astronauts.</p> <p align="center"> <a href="https://dev.azure.com/starship-control/starship/_build"><img src="https://badgen.net/azure-pipelines/starship-control/starship/Starship%20Test%20Suite" alt="Azure Pipelines Build Status"></a> - <a href="#contributors"><img src="https://badgen.net/badge/all%20contributors/6/orange" alt="All Contributors"></a> + <a href="https://codecov.io/gh/starship/starship"><img src="https://badgen.net/codecov/c/github/starship/starship" alt="Codecov Coverage"></a> + <a href="#contributors"><img src="https://badgen.net/badge/all%20contributors/7/orange" alt="All Contributors"></a> <a href="https://discord.gg/8Jzqu3T"><img src="https://badgen.net/badge/chat/on%20discord/7289da" alt="Chat on Discord"></a> </p> </p> diff --git a/ci/azure-test-docker.yml b/ci/azure-test-docker.yml index 4b7b09e9e..93b8cfcbf 100644 --- a/ci/azure-test-docker.yml +++ b/ci/azure-test-docker.yml @@ -8,6 +8,9 @@ jobs: - script: ./integration_test displayName: Run integration test within Docker + - script: bash <(curl -s https://codecov.io/bash) -t $(CODECOV_TOKEN) + displayName: Report coverage to Codecov + - script: | docker login -u $(dockerUsername) -p $(dockerPassword) docker push starshipcommand/starship-test diff --git a/integration_test b/integration_test index 164f2d1e0..81c7ba3b2 100755 --- a/integration_test +++ b/integration_test @@ -16,4 +16,6 @@ docker build -f tests/Dockerfile \ . printf 'Running test suite:\n' -docker run --rm -t -v $(pwd):/starship starshipcommand/starship-test +# `seccomp=unconfined` is needed to allow tarpaulin to disable ASLR +# Details found here: https://github.com/xd009642/tarpaulin/issues/146 +docker run --rm --security-opt seccomp=unconfined -v $(pwd):/starship starshipcommand/starship-test diff --git a/tests/Dockerfile b/tests/Dockerfile index ef00a407d..532b42dc5 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,38 +1,32 @@ -FROM rust:latest +FROM rust + +# Install Tarpaulin (code coverage tool) +# https://github.com/xd009642/tarpaulin +COPY --from=xd009642/tarpaulin /usr/local/cargo/bin/cargo-tarpaulin /usr/local/cargo/bin/cargo-tarpaulin # Install Node.js ENV NODE_VERSION 12.0.0 -RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \ - && . $HOME/.nvm/nvm.sh \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION \ - && nvm use default ENV PATH /root/.nvm/versions/node/v$NODE_VERSION/bin:$PATH +RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash # Check that Node.js was correctly installed RUN node --version # Install Go ENV GO_VERSION 1.10.0 ENV GOENV_ROOT /root/.goenv -ENV GO_ROOT /root/go -# RUN git clone https://github.com/wfarr/goenv.git $GOENV_ROOT -RUN git clone https://github.com/syndbg/goenv.git $GOENV_ROOT ENV PATH $GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH -RUN eval "$(goenv init -)" -RUN mkdir -p $GO_ROOT -ENV GOPATH $GO_ROOT -ENV PATH $GO_ROOT/bin:$PATH -RUN goenv install $GO_VERSION -RUN goenv global $GO_VERSION +RUN git clone https://github.com/syndbg/goenv.git $GOENV_ROOT \ + && eval "$(goenv init -)" \ + && goenv install $GO_VERSION \ + && goenv global $GO_VERSION # Check that Go was correctly installed - RUN go version + # Install Python ENV PYTHON_VERSION 3.6.8 ENV PYENV_ROOT /root/.pyenv -ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH RUN curl https://pyenv.run | bash \ - && pyenv update \ && pyenv install $PYTHON_VERSION \ && pyenv global $PYTHON_VERSION # Check that Python was correctly installed @@ -60,4 +54,5 @@ RUN rm -rf /starship RUN mkdir starship WORKDIR /starship -CMD ["cargo", "test", "--", "--ignored"] +# Instrument coverage tooling and run the full test suite +CMD ["cargo", "tarpaulin", "--ignored", "--out", "Xml"] |