From f815fe07ba566f326f7e5466381bf0b49fbefa16 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 26 Jun 2020 00:49:05 +0200 Subject: [PATCH 1/4] [#125] Fix broken darwin and windows publication. --- .travis.yml | 1 + build.sh | 5 +++++ integration-tests.sh | 5 +---- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 build.sh diff --git a/.travis.yml b/.travis.yml index 3c55dc88..9ced535a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..2a898769 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e +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}" diff --git a/integration-tests.sh b/integration-tests.sh index b3199a6b..ed7a7d59 100755 --- a/integration-tests.sh +++ b/integration-tests.sh @@ -21,10 +21,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(){ From 42d1b9bbdae2f251764c91263d35fc4d5211f2a6 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 26 Jun 2020 00:55:29 +0200 Subject: [PATCH 2/4] [#125] Permission denied build.sh. --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From ed2eed92cde9a5fbe6c8de8da4fc320fda258d46 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 26 Jun 2020 01:10:48 +0200 Subject: [PATCH 3/4] [#125] Build parameters omitted. --- build.sh | 5 +++++ integration-tests.sh | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 2a898769..689bcb72 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,9 @@ #!/bin/bash -e +TOOL="${1:-./n3dr}" +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 "${TOOL}" > "${DELIVERABLE}.sha512.txt" diff --git a/integration-tests.sh b/integration-tests.sh index ed7a7d59..ef8fd234 100755 --- a/integration-tests.sh +++ b/integration-tests.sh @@ -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 @@ -21,7 +18,7 @@ should be run." } build(){ - source ./build.sh + source ./build.sh "${TOOL}" } nexus(){ From 5fcae39a3291d07ffb4425eaf220fbdac275a696 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 26 Jun 2020 01:26:25 +0200 Subject: [PATCH 4/4] [#125] Deliverable var should be used in build.sh. --- build.sh | 3 +-- integration-tests.sh | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 689bcb72..86c5df9f 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,9 @@ #!/bin/bash -e -TOOL="${1:-./n3dr}" 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 "${TOOL}" > "${DELIVERABLE}.sha512.txt" +$SHA512_CMD "${DELIVERABLE}" > "${DELIVERABLE}.sha512.txt" chmod +x "${DELIVERABLE}" diff --git a/integration-tests.sh b/integration-tests.sh index ef8fd234..c94895de 100755 --- a/integration-tests.sh +++ b/integration-tests.sh @@ -18,7 +18,7 @@ should be run." } build(){ - source ./build.sh "${TOOL}" + source ./build.sh } nexus(){