From 287df424992011968637587d958c7e05076593cb Mon Sep 17 00:00:00 2001 From: Luke K Date: Wed, 8 Jul 2020 09:41:46 +0000 Subject: [PATCH] workflows --- .github/workflows/build.yaml | 20 +++++++++++++++++++ .github/workflows/pull_requests.yaml | 15 ++++++++++++++ .github/workflows/releases.yaml | 30 ++++++++++++++++++++++++++++ Makefile | 1 + README.md | 16 ++++++--------- 5 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/pull_requests.yaml create mode 100644 .github/workflows/releases.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..44ad8ee10 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +# Build and test every push to the main and +# develop branches. +name: Build + +on: + push: + branches: + - main + - develop + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + - name: Test + run: make test + - name: Build + run: make build diff --git a/.github/workflows/pull_requests.yaml b/.github/workflows/pull_requests.yaml new file mode 100644 index 000000000..ace7efabc --- /dev/null +++ b/.github/workflows/pull_requests.yaml @@ -0,0 +1,15 @@ +# Build and test all pull requests +name: Pull Requests + +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + - name: Test + run: make test + - name: Build + run: make build diff --git a/.github/workflows/releases.yaml b/.github/workflows/releases.yaml new file mode 100644 index 000000000..a00fe0e08 --- /dev/null +++ b/.github/workflows/releases.yaml @@ -0,0 +1,30 @@ +# Deploy artifacts for any pushes with a version tag (releases). +name: Releases + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + - name: Test + run: make test + - name: Build + run: make build + - name: Image + run: make image + - name: Push Image + env: + USER: ${{ secrets.QUAY_USERNAME }} + PASS: ${{ secrets.QUAY_PASSWORD }} + run: docker login -u "$USER" -p "$PASS" quay.io && make push + + # TODO: make release + # - build cross-platform binaries + # - create a release with assets diff --git a/Makefile b/Makefile index b794e5ba8..06a8d0459 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ VTAG := $(shell git tag --points-at HEAD) VERS := $(shell [ -z $(VTAG) ] && echo 'tip' || echo $(VTAG) ) all: $(BIN) +build: all $(BIN): $(CODE) go build -ldflags "-X main.brch=$(BRCH) -X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)" ./cmd/$(BIN) diff --git a/README.md b/README.md index 36cb48acc..848978e90 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,22 @@ # faas +![Main Build Status](https://github.com/boson-project/faas/workflows/Build/badge.svg?branch=main) + +![Development Build Status](https://github.com/boson-project/faas/workflows/Build/badge.svg?branch=develop) + Function as a Service CLI ## Setup and Configuration With Go 1.13+ installed, build and install the binary to your path: ``` -go install +go install ./cmd/faas ``` -Install dependent binaries: +Install Docker -* `appsody` https://appsody.dev/docs/installing/installing-appsody -* `kn` https://github.com/knative/client/releases -* `kubectl` https://kubernetes.io/docs/tasks/tools/install-kubectl/ * `docker` https://docs.docker.com/get-docker/ -Configure Boson appsody stack repository: -``` -appsody repo add boson https://github.com/boson-project/stacks/releases/latest/download/boson-index.yaml -``` - Configure Image repository: Both the image repository and user/org namespace need to be defined either by