Skip to content

Commit

Permalink
add github actions for building pull requests, creating :master tags …
Browse files Browse the repository at this point in the history
…for merges as well as manage building images for releases (envoyproxy#57)

Signed-off-by: Steve Sloka <slokas@vmware.com>
  • Loading branch information
stevesloka committed Mar 11, 2020
1 parent 1147f66 commit c398753
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and push :master image

on:
push:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check format
run: make check_format
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: deps
run: sudo apt-get update -y && sudo apt-get install stunnel4 redis -y

- name: build and push docker image
run: |
redis-server --port 6380 &
redis-server --port 6381 --requirepass password123 &
redis-server --port 6382 --requirepass password123 &
redis-server --port 6384 --requirepass password123 &
redis-server --port 6385 --requirepass password123 &
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
make bootstrap bootstrap_redis_tls docker_push
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
VERSION: master
29 changes: 29 additions & 0 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI Build and Test for PR

on:
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check format
run: make check_format
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: deps
run: sudo apt-get update -y && sudo apt-get install stunnel4 redis -y

- name: build and test
run: |
redis-server --port 6380 &
redis-server --port 6381 --requirepass password123 &
redis-server --port 6382 --requirepass password123 &
redis-server --port 6384 --requirepass password123 &
redis-server --port 6385 --requirepass password123 &
make bootstrap bootstrap_redis_tls tests_unit tests
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and push :release image

on:
push:
tags:
- 'v*'

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check format
run: make check_format
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: deps
run: sudo apt-get update -y && sudo apt-get install stunnel4 redis -y

- name: build and push docker image
run: |
redis-server --port 6380 &
redis-server --port 6381 --requirepass password123 &
redis-server --port 6382 --requirepass password123 &
redis-server --port 6384 --requirepass password123 &
redis-server --port 6385 --requirepass password123 &
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
make bootstrap bootstrap_redis_tls docker_push
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export GO111MODULE=on
PROJECT = ratelimit
REGISTRY ?= envoyproxy
IMAGE := $(REGISTRY)/$(PROJECT)
MODULE = github.com/envoyproxy/ratelimit

GIT_REF = $(shell git describe --tags || git rev-parse --short=8 --verify HEAD)
VERSION ?= $(GIT_REF)
SHELL := /bin/bash

.PHONY: bootstrap
Expand Down Expand Up @@ -67,6 +71,11 @@ tests_unit: compile
tests: compile
go test -race -tags=integration $(MODULE)/...

.PHONY: docker
docker: tests
docker build . -t envoyproxy/ratelimit:`git rev-parse HEAD`
.PHONY: docker_image
docker_image: tests
docker build . -t $(IMAGE):$(VERSION)

.PHONY: docker_push
docker_push: docker_image
docker push $(IMAGE):$(VERSION)

0 comments on commit c398753

Please sign in to comment.