Based docker build on alpine:edge image and included tests for the build
in the Dockerfile. Updated README.md to include developer and testing instructions. Removed old files and scripts for building and testing. Signed-off-by: Joris Melchior <jmelchior@pivotal.io>
This commit is contained in:
committed by
Joris Melchior
parent
b7312f65dc
commit
6c24c8ccc4
26
Dockerfile
26
Dockerfile
@@ -1,5 +1,23 @@
|
||||
FROM concourse/buildroot:base
|
||||
FROM golang:alpine as builder
|
||||
COPY . /go/src/github.com/concourse/github-release-resource
|
||||
ENV CGO_ENABLED 0
|
||||
ENV GOPATH /go/src/github.com/concourse/github-release-resource/Godeps/_workspace:${GOPATH}
|
||||
ENV PATH /go/src/github.com/concourse/github-release-resource/Godeps/_workspace/bin:${PATH}
|
||||
RUN go build -o /assets/out github.com/concourse/github-release-resource/cmd/out
|
||||
RUN go build -o /assets/in github.com/concourse/github-release-resource/cmd/in
|
||||
RUN go build -o /assets/check github.com/concourse/github-release-resource/cmd/check
|
||||
RUN set -e; for pkg in $(go list ./...); do \
|
||||
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
|
||||
done
|
||||
|
||||
ADD assets/check /opt/resource/check
|
||||
ADD assets/in /opt/resource/in
|
||||
ADD assets/out /opt/resource/out
|
||||
FROM alpine:edge AS resource
|
||||
RUN apk add --update bash tzdata
|
||||
COPY --from=builder /assets /opt/resource
|
||||
|
||||
FROM resource AS tests
|
||||
COPY --from=builder /tests /tests
|
||||
RUN set -e; for test in /tests/*.test; do \
|
||||
$test; \
|
||||
done
|
||||
|
||||
FROM resource
|
||||
|
28
README.md
28
README.md
@@ -124,3 +124,31 @@ prepended with this string. This is useful for adding v in front of version numb
|
||||
|
||||
* `globs`: *Optional.* A list of globs for files that will be uploaded alongside
|
||||
the created release.
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* golang is *required* - version 1.9.x is tested; earlier versions may also
|
||||
work.
|
||||
* docker is *required* - version 17.06.x is tested; earlier versions may also
|
||||
work.
|
||||
* godep is used for dependency management of the golang packages.
|
||||
|
||||
### Running the tests
|
||||
|
||||
The tests have been embedded with the `Dockerfile`; ensuring that the testing
|
||||
environment is consistent across any `docker` enabled platform. When the docker
|
||||
image builds, the test are run inside the docker container, on failure they
|
||||
will stop the build.
|
||||
|
||||
Run the tests with the following command:
|
||||
|
||||
```sh
|
||||
docker build -t github-release-resource .
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
Please make all pull requests to the `master` branch and ensure tests pass
|
||||
locally.
|
||||
|
16
build.yml
16
build.yml
@@ -1,16 +0,0 @@
|
||||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: docker-image
|
||||
source: {repository: concourse/static-golang}
|
||||
|
||||
inputs:
|
||||
- name: github-release-resource
|
||||
path: gopath/src/github.com/concourse/github-release-resource
|
||||
|
||||
outputs:
|
||||
- name: built-resource
|
||||
|
||||
run:
|
||||
path: gopath/src/github.com/concourse/github-release-resource/scripts/ci
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -u -x
|
||||
|
||||
mkdir -p assets
|
||||
go build -o assets/check ./cmd/check
|
||||
go build -o assets/in ./cmd/in
|
||||
go build -o assets/out ./cmd/out
|
19
scripts/ci
19
scripts/ci
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: set ft=sh
|
||||
|
||||
set -eu
|
||||
|
||||
export GOPATH=$PWD/gopath
|
||||
export PATH=$GOPATH/bin:$PATH
|
||||
|
||||
BUILD_DIR=$PWD/built-resource
|
||||
|
||||
cd $GOPATH/src/github.com/concourse/github-release-resource
|
||||
|
||||
go install github.com/concourse/github-release-resource/vendor/github.com/onsi/ginkgo/ginkgo
|
||||
|
||||
CGO_ENABLED=1 ginkgo -race -r -p "$@"
|
||||
|
||||
./scripts/build
|
||||
|
||||
cp -a assets Dockerfile $BUILD_DIR
|
18
scripts/test
18
scripts/test
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
not_installed() {
|
||||
! command -v $1 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
github_release_resource_dir=$(cd $(dirname $0)/.. && pwd)
|
||||
|
||||
if not_installed ginkgo; then
|
||||
echo "# ginkgo is not installed! run the following command:"
|
||||
echo " go install github.com/onsi/ginkgo/ginkgo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $github_release_resource_dir
|
||||
ginkgo -r -p
|
Reference in New Issue
Block a user