Skip to content

Commit

Permalink
CI: Github Actions (#127)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Sloka <[email protected]>
  • Loading branch information
stevesloka authored Mar 11, 2020
1 parent 1147f66 commit 0dd5b8b
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 17 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 }}
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

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 0dd5b8b

Please sign in to comment.