Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Makefile #129

Merged
merged 6 commits into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.coverprofile
*.test
*~
/out
14 changes: 1 addition & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,4 @@ jobs:
- GO111MODULE=on
go_import_path: github.com/buildpack/lifecycle
script: |
test -z "$(bin/format | tee >(cat >&2))"
go test -v -parallel=1 -p=1 -count=1 ./...
- stage: build and push rc images
if: branch = master AND type = push
env:
- secure: "ya3FQMvAyu0fWQFO7tTAP9CepONq9cH4Xt3beIdxlUI4kcdwTBDASzMX9QEn5dIPHp2rRy5DuPIB67SqsCQcVA2v2Wmj3d/GVbcTIX8iNpI5T2kFNgoHWH3pLUuigcS22rEImphiLeI+xGDwpG0t3PbTdyx5zc+jASndMxQxmWH9sIJqa6h0i7hqPuaWttBfmnEWR/CWxDI64I49y8C8xOJdN/k+o5R3XK5Qvh70hYH5UIxWF2LwvD3PgcBF+/995ufQmLBMo6XPGWnEdu85UTIj1rAsmh+Ld3b47GKYDXk/jVBcLRTj1jhz/6irDu4/ZpZcb1a9Ocjbcn5LMNzFfi3kPqizZ0buN8w0hS2vfx5mQ1xg9pCzOSw164wyN+4McCEI1fwKujPkbPtiSOkF4GUPBx6w3ezRFZO6a50jQQNVDP24nVD5Q+N8cUcGIFfcaNmyv8noxAsB2shAgEHycYId6ufGoJhdTt40tDGilSvqTGhQKiSWxg9k0VJpsmlXRxfEfaaTkpQowKPtzUsTjfeH14mI2EsZ8AJsv8V9mdWvkJE0tg8DPsCZ8sDbB9gK0VHExRBkcgmlU6+c3/qvitojSEBAD8CSUS8dRCwoTn8PKB1k9BndO9rhLkSlu9SKl8XFbgGYW5hW+gQYsIUz5iswA3EL0FyjGNjavzTtAqw="
- secure: "McMI5lalBxrsns6ZlekhwqQM0y8h2db3M49KppGVgCD3ShsKubQ14RLRT8tqs60f+UBVzEaMarqNXcSLcCiegH+gMbJazYGVog3vVt8m1AbQEQiSecuQ3GRW00jrjPOU82wJPmj3Xw/L4Pi9PKN+Fmol802gbZMQ69OhLAjiNic0jW+HJ4ZFxrD2ns4BmdMeBURGamZeyMsG3ISzgGfl+LoanV92N7de2bRl3tG88qquyrlVjOK5G+wmp+AK+LdeDly94kSrq1/Pgvpq5xIjK+5bdtn5cIEWaMPtfeKMU+UQjIWVWWU4BQ6ZdktKz6BumP1VGyP9JfNdH269e6UG/KM75QQEDAsv9Daq/oy2WEKMjs4LGv9OOsdzwPRrxOt+EWHwVOOXOXfhYMw5v250naqXAsZmO4PsUqmz8JsTuIVRttZX761d4f/JuPNpeE7GgxTc9D4VxziIl6ksDHrpRRQW4Hc4fznhBsUF7lyomCrwAWYSsZP4YBTYdykgKf0nNmf+iskzoIZfPuvzvWIim0K+ax5vp9B9ocd1mwQd5zPoAoYZRGhipw7d2hbkf8h8dakKdY8y/nBzomfXW1+4LFuuKSyELZg0z0rGu4t/jW6gHuILGCvPqBtCNIRTQSvLwk7Gzt/lKqZOv9P6Luh/UCI+mq+/lWyBy9zYUP0Swpc="
script:
- images/bin/build -v "rc"
- echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
- docker push "packs/base:rc"
- docker push "packs/build:rc"
- docker push "packs/run:rc"
make test
31 changes: 0 additions & 31 deletions Dockerfile

This file was deleted.

33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Go parameters
GOCMD=go
GOENV=GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0
GOBUILD=$(GOCMD) build -mod=vendor
GOTEST=$(GOCMD) test -mod=vendor
LIFECYCLE_VERSION?=dev
ARCHIVE_NAME=lifecycle-$(LIFECYCLE_VERSION)+linux.x86-64

all: test build package
build:
mkdir -p ./out/$(ARCHIVE_NAME)
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/detector -a ./cmd/detector
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/restorer -a ./cmd/restorer
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/analyzer -a ./cmd/analyzer
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/builder -a ./cmd/builder
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/exporter -a ./cmd/exporter
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/cacher -a ./cmd/cacher
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/launcher -a ./cmd/launcher

format:
test -z $$($(GOCMD) fmt ./...)

vet:
$(GOCMD) vet $$($(GOCMD) list ./... | grep -v /testdata/)

test: format vet
$(GOTEST) -v ./...

clean:
rm -rf ./out

package:
tar czf ./out/$(ARCHIVE_NAME).tgz -C out $(ARCHIVE_NAME)
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,47 @@ A reference implementation of [Buildpack API v3](https://github.com/buildpack/sp

Cache implementations (`retriever` and `cacher`) are intended to be interchangable and platform-specific.
A platform may choose not to deduplicate cache layers.

## Development
To test, build, and package binaries into an archive, simply run:

```bash
$ make all
```
This will create an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`.

By default, `LIFECYCLE_VERSION` is `dev`. It can be changed by prepending `LIFECYCLE_VERSION=<some version>` to the
`make` command. For example:

```bash
$ LIFECYCLE_VERSION=1.2.3 make all
```

Steps can also be run individually as shown below.

### Test

Formats, vets, and tests the code.

```bash
$ make test
```

### Build

Builds binaries to `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64/` for the given (or default) `LIFECYCLE_VERSION`.

```bash
$ make build
```

> To clean the `out/` directory, run `make clean`.

### Package

Creates an archive at `out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64.tgz`, using the contents of the
`out/lifecycle-<LIFECYCLE_VERSION>+linux.x86-64/` directory, for the given (or default) `LIFECYCLE_VERSION`.

```bash
$ make package
```
56 changes: 0 additions & 56 deletions images/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions images/bin/build

This file was deleted.

20 changes: 0 additions & 20 deletions images/build/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions images/run/Dockerfile

This file was deleted.