-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Cleanup build and test scripts
- Loading branch information
1 parent
e49b99b
commit a1c7d53
Showing
9 changed files
with
134 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.10.6-alpine3.8 | ||
FROM golang:1.14-alpine | ||
|
||
COPY goroot/ /go/ | ||
# this is used to lint and build tarball | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM golang:1.10.6-alpine3.8 | ||
FROM golang:1.14-alpine | ||
RUN apk --update add git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM golang:1.14-alpine | ||
|
||
COPY goroot/ /go/ | ||
|
||
# we will mount the current directory here | ||
VOLUME [ "/go/src/github.com/signalsciences/sigsci-module-golang" ] | ||
WORKDIR /go/src/github.com/signalsciences/sigsci-module-golang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3" | ||
|
||
services: | ||
# this defines our webserver uses our sigsci-module | ||
# we only define it so it is attached to our fake network | ||
# it will be run a few times with different options manually | ||
# | ||
# The volumes spec is a bit weird.. this script is run in scripts/test but | ||
# needs stuff in ../../examples. Consider moving. | ||
web: | ||
volumes: | ||
- ../..:/go/src/github.com/signalsciences/sigsci-module-golang | ||
command: [ "go", "run", "/go/src/github.com/signalsciences/sigsci-module-golang/examples/mtest/main.go" ] | ||
environment: | ||
- DEBUG=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
version: "3" | ||
networks: | ||
mtest: | ||
|
||
services: | ||
# this defines our webserver uses our sigsci-module | ||
# we only define it so it is attached to our fake network | ||
# it will be run a few times with different options manually | ||
# | ||
# | ||
web: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
expose: | ||
- "8085" | ||
networks: | ||
- mtest | ||
depends_on: | ||
- agent | ||
|
||
# agent | ||
agent: | ||
image: 803688608479.dkr.ecr.us-west-2.amazonaws.com/local-dev/sigsci-agent:latest | ||
command: [ "-debug-log-web-inputs", "2", "-rpc-address", "9090", "-debug-rpc-test-harness", "-debug-standalone", "3" ] | ||
expose: | ||
- "9090" | ||
- "12345" | ||
networks: | ||
- mtest | ||
|
||
# punching bag | ||
punchingbag: | ||
image: 803688608479.dkr.ecr.us-west-2.amazonaws.com/local-dev/module-testing:latest | ||
networks: | ||
- mtest | ||
expose: | ||
- "8086" | ||
command: [ "/bin/punchingbag", "-addr", ":8086" ] | ||
|
||
# mtest | ||
# | ||
mtest: | ||
image: 803688608479.dkr.ecr.us-west-2.amazonaws.com/local-dev/module-testing:latest | ||
networks: | ||
- mtest | ||
depends_on: | ||
- web | ||
- agent | ||
- punchingbag | ||
environment: | ||
- DISABLE_HTTP_OPTIONS=1 | ||
- DISABLE_NOCOOKIE=1 | ||
- MTEST_BASEURL=web:8085 | ||
- MTEST_AGENT=agent:12345 | ||
- "ALT_RESPONSE_CODES=300 301 302 403 404 500" | ||
- "MTEST_RUN_TEST_BLOCK_VIA_REDIRECT=true" | ||
command: [ "/bin/wait-for", "web:8085", "--", "/bin/mtest", "-test.v" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DOCKERCOMPOSE="docker-compose" | ||
|
||
# run at end no matter what | ||
cleanup() { | ||
echo "shutting down" | ||
# capture log output | ||
$DOCKERCOMPOSE logs --no-color agent >& agent.log | ||
$DOCKERCOMPOSE logs --no-color web >& web.log | ||
$DOCKERCOMPOSE logs --no-color mtest >& mtest.log | ||
$DOCKERCOMPOSE logs --no-color punchingbag >& punchingbag.log | ||
|
||
# delete everything | ||
$DOCKERCOMPOSE down | ||
|
||
# show output of module testing | ||
cat mtest.log | ||
} | ||
trap cleanup 0 1 2 3 6 | ||
|
||
set -x | ||
|
||
# attempt to clean up any leftover junk | ||
$DOCKERCOMPOSE down | ||
|
||
$DOCKERCOMPOSE pull --ignore-pull-failures | ||
|
||
# start everything, run tests | ||
# | ||
# --no-color --> safe for ci | ||
# --build --> alway build test server/module container | ||
# --abort-on-container-exit --> without this, the other servers keep the process running | ||
# --exit-code-from mtest --> make exit code be the result of module test | ||
# | ||
# > /dev/null --> output of all servers is mixed together and ugly | ||
# we get the individual logs at end | ||
# | ||
if [ -d "goroot" ]; then | ||
rm -rf goroot | ||
fi | ||
docker run -v ${PWD}/goroot:/go/ --rm golang:1.14-alpine /bin/sh -c 'apk --update add git && go get github.com/signalsciences/tlstext && go get github.com/tinylib/msgp && go get github.com/alecthomas/gometalinter' | ||
$DOCKERCOMPOSE up --no-color --build --abort-on-container-exit --exit-code-from mtest > /dev/null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package sigsci | ||
|
||
const version = "1.7.1" | ||
const version = "1.8.0" |