Skip to content

Commit 88301f3

Browse files
Simplify build
1 parent 150b4bf commit 88301f3

File tree

5 files changed

+48
-77
lines changed

5 files changed

+48
-77
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ on:
55

66
jobs:
77
build:
8-
name: Build
98
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
go: [ '1.14' ]
12+
name: Build ${{ matrix.go }}
1013
steps:
1114
- uses: aws-actions/configure-aws-credentials@v1
1215
with:

Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
build: ## build and lint locally
42
./scripts/build.sh
53

@@ -8,15 +6,7 @@ build: ## build and lint locally
86
test: ## build and run integration test
97
./scripts/test.sh
108

11-
init: ## install gometalinter and msgp locally
12-
go get -u github.com/alecthomas/gometalinter
13-
gometalinter --install --debug
14-
go get -u github.com/tinylib/msgp/msgp
15-
go get .
16-
17-
189
clean: ## cleanup
19-
find . -name 'goroot' -type d | xargs rm -rf
2010
rm -rf artifacts
2111
find . -name '*.log' | xargs rm -f
2212
go clean ./...

make.sh

Lines changed: 35 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
11
#!/bin/sh
2-
32
set -ex
43

5-
# build / lint agent in a container
6-
find . -name "goroot" -type d | xargs rm -rf
7-
mkdir goroot
8-
9-
docker build -f Dockerfile.git -t golang-git:1.14-alpine .
10-
docker run --user $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}/goroot:/go/ --rm golang-git:1.14-alpine /bin/sh -c 'go get github.com/signalsciences/tlstext && go get github.com/tinylib/msgp && go get github.com/alecthomas/gometalinter'
11-
./scripts/build-docker.sh
12-
13-
# run module tests
14-
./scripts/test.sh
15-
16-
BASE=$PWD
17-
## setup our package properties by distro
18-
PKG_NAME="sigsci-module-golang"
19-
DEST_BUCKET="package-build-artifacts"
20-
DEST_KEY="${PKG_NAME}/${GITHUB_RUN_NUMBER}"
21-
VERSION=$(cat ./VERSION)
22-
23-
cd ${BASE}
24-
echo "DONE"
25-
26-
# Main package
27-
aws s3api put-object \
28-
--bucket "${DEST_BUCKET}" \
29-
--cache-control="max-age=300" \
30-
--content-type="application/octet-stream" \
31-
--body "./artifacts/${PKG_NAME}.tar.gz" \
32-
--key "${DEST_KEY}/${PKG_NAME}_${VERSION}.tar.gz" \
33-
--grant-full-control id="${PROD_ID}"
34-
35-
# Metadata files
36-
aws s3api put-object \
37-
--bucket "${DEST_BUCKET}" \
38-
--cache-control="max-age=300" \
39-
--content-type="text/plain; charset=UTF-8" \
40-
--body "VERSION" \
41-
--key "${DEST_KEY}/VERSION" \
42-
--grant-full-control id="${PROD_ID}"
43-
44-
aws s3api put-object \
45-
--bucket "${DEST_BUCKET}" \
46-
--cache-control="max-age=300" \
47-
--content-type="text/plain; charset=UTF-8" \
48-
--body "CHANGELOG.md" \
49-
--key "${DEST_KEY}/CHANGELOG.md" \
50-
--grant-full-control id="${PROD_ID}"
4+
./scripts/build.sh
5+
6+
if [ -n "${PROD_ID}" ]; then
7+
## setup our package properties by distro
8+
PKG_NAME="sigsci-module-golang"
9+
DEST_BUCKET="package-build-artifacts"
10+
DEST_KEY="${PKG_NAME}/${GITHUB_RUN_NUMBER}"
11+
VERSION=$(cat ./VERSION)
12+
13+
# Main package
14+
aws s3api put-object \
15+
--bucket "${DEST_BUCKET}" \
16+
--cache-control="max-age=300" \
17+
--content-type="application/octet-stream" \
18+
--body "./artifacts/${PKG_NAME}.tar.gz" \
19+
--key "${DEST_KEY}/${PKG_NAME}_${VERSION}.tar.gz" \
20+
--grant-full-control id="${PROD_ID}"
21+
22+
# Metadata files
23+
aws s3api put-object \
24+
--bucket "${DEST_BUCKET}" \
25+
--cache-control="max-age=300" \
26+
--content-type="text/plain; charset=UTF-8" \
27+
--body "VERSION" \
28+
--key "${DEST_KEY}/VERSION" \
29+
--grant-full-control id="${PROD_ID}"
30+
31+
aws s3api put-object \
32+
--bucket "${DEST_BUCKET}" \
33+
--cache-control="max-age=300" \
34+
--content-type="text/plain; charset=UTF-8" \
35+
--body "CHANGELOG.md" \
36+
--key "${DEST_KEY}/CHANGELOG.md" \
37+
--grant-full-control id="${PROD_ID}"
38+
fi

scripts/build-docker.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/build.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
#!/bin/sh
22
set -ex
33

4-
echo "package sigsci" > version.go
5-
echo "" >> version.go
6-
echo "const version = \"$(cat VERSION)\"" >> version.go
7-
find . -name "goroot" -type d | xargs rm -rf
8-
go generate ./...
9-
10-
# make sure files made in docker are readable by all
11-
chmod a+r *.go
4+
which go
5+
go version
6+
eval $(go env | grep GOROOT)
7+
export GOROOT
8+
export CGO_ENABLED=0
129

1310
go build .
1411
go test .
1512

16-
# --enable=gosimple \
17-
# --enable=unused \
18-
13+
### Run the linter
14+
if [ -z "$(which gometalinter)" ]; then
15+
go get github.com/alecthomas/gometalinter
16+
fi
1917
gometalinter \
2018
--vendor \
2119
--deadline=60s \

0 commit comments

Comments
 (0)