Skip to content

Commit

Permalink
Merge pull request #126 from 030/125-choco
Browse files Browse the repository at this point in the history
[#125] Fix broken darwin and windows publication.
  • Loading branch information
030 authored Jun 25, 2020
2 parents dc9274a + 5fcae39 commit d41b964
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ script:
- export DELIVERABLE="n3dr-${TRAVIS_OS_NAME}"
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ]; then go test -short -cover -v -coverprofile=coverage.txt -covermode=atomic ./...; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install zip -y; fi
- ./build.sh
- if [ $TRAVIS_OS_NAME == linux ]; then ./integration-tests.sh $NEXUS_VERSION $NEXUS_API_VERSION ./${DELIVERABLE}; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sonar-scanner -Dsonar.projectKey=030_n3dr -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.exclusions=cmd/**,**/*_test.go -Dsonar.go.coverage.reportPaths="coverage.txt"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then bash <(curl -s https://codecov.io/bash); fi
Expand Down
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e
TRAVIS_TAG="${TRAVIS_TAG:-local}"
SHA512_CMD="${SHA512_CMD:-sha512sum}"
DELIVERABLE="${DELIVERABLE:-n3dr}"

echo "TRAVIS_TAG: '$TRAVIS_TAG' DELIVERABLE: '$DELIVERABLE'"
go build -ldflags "-X n3dr/cmd.Version=${TRAVIS_TAG}" -o "${DELIVERABLE}"
$SHA512_CMD "${DELIVERABLE}" > "${DELIVERABLE}.sha512.txt"
chmod +x "${DELIVERABLE}"
8 changes: 1 addition & 7 deletions integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
NEXUS_VERSION="${1:-3.21.1}"
NEXUS_API_VERSION="${2:-v1}"
TOOL="${3:-./n3dr}"
TRAVIS_TAG="${TRAVIS_TAG:-local}"
SHA512_CMD="${SHA512_CMD:-sha512sum}"
DELIVERABLE="${DELIVERABLE:-n3dr}"

validate(){
if [ -z "${TOOL}" ]; then
Expand All @@ -21,10 +18,7 @@ should be run."
}

build(){
echo "TRAVIS_TAG: '$TRAVIS_TAG' DELIVERABLE: '$DELIVERABLE'"
go build -ldflags "-X n3dr/cmd.Version=${TRAVIS_TAG}" -o "${DELIVERABLE}"
$SHA512_CMD "${TOOL}" > "${DELIVERABLE}.sha512.txt"
chmod +x "${DELIVERABLE}"
source ./build.sh
}

nexus(){
Expand Down

0 comments on commit d41b964

Please sign in to comment.