Skip to content

Commit 4c549d0

Browse files
committed
Remove Travis and move to GitHub workflows
1 parent f0d2ab9 commit 4c549d0

File tree

3 files changed

+314
-15
lines changed

3 files changed

+314
-15
lines changed

.github/workflows/ci.yml

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
branches:
11+
- master
12+
types:
13+
- opened
14+
- reopened
15+
- synchronize
16+
paths-ignore:
17+
- '**.md'
18+
create:
19+
tags:
20+
- 'v[0-9]+.[0-9]+.[0-9]+*'
21+
22+
env:
23+
DOCKER_BUILDKIT: 1
24+
GOLANG_VERSION: 1.15
25+
26+
jobs:
27+
28+
binary:
29+
name: Build Binary
30+
runs-on: ubuntu-18.04
31+
steps:
32+
- name: Checkout Repository
33+
uses: actions/checkout@v2
34+
- name: Fetch Cached Artifacts
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ github.workspace }}/nginx-asg-sync
38+
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }}
39+
- name: Docker Buildx
40+
uses: docker/setup-buildx-action@v1
41+
with:
42+
driver-opts: network=host
43+
- name: Cache Docker layers
44+
uses: actions/cache@v2
45+
with:
46+
path: /tmp/.buildx-cache
47+
key: ${{ runner.os }}-buildx-${{ github.sha }}
48+
restore-keys: |
49+
${{ runner.os }}-buildx-
50+
- name: Build Image
51+
uses: docker/build-push-action@v2
52+
with:
53+
file: build/Dockerfile
54+
context: '.'
55+
target: builder
56+
cache-from: type=local,src=/tmp/.buildx-cache
57+
cache-to: type=local,dest=/tmp/.buildx-cache
58+
tags: nginx/nginx-asg-sync:${{ github.sha }}
59+
60+
unit-tests:
61+
name: Unit Tests
62+
runs-on: ubuntu-18.04
63+
steps:
64+
- name: Checkout Repository
65+
uses: actions/checkout@v2
66+
- name: Setup Golang Environment
67+
uses: actions/setup-go@v2
68+
with:
69+
go-version: '${{ env.GOLANG_VERSION }}'
70+
- name: Run Tests
71+
run: make test
72+
73+
build:
74+
name: Build Image
75+
runs-on: ubuntu-18.04
76+
needs: [binary, unit-tests]
77+
steps:
78+
- name: Checkout Repository
79+
uses: actions/checkout@v2
80+
- name: Fetch Cached Artifacts
81+
uses: actions/cache@v2
82+
with:
83+
path: ${{ github.workspace }}/nginx-asg-sync
84+
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }}
85+
- name: Docker Buildx
86+
uses: docker/setup-buildx-action@v1
87+
with:
88+
driver-opts: network=host
89+
- name: Cache Docker layers
90+
uses: actions/cache@v2
91+
with:
92+
path: /tmp/.buildx-cache
93+
key: ${{ runner.os }}-buildx-${{ github.sha }}
94+
restore-keys: |
95+
${{ runner.os }}-buildx-
96+
- name: Build Image Amazon 1
97+
uses: docker/build-push-action@v2
98+
with:
99+
file: build/Dockerfile
100+
context: '.'
101+
target: rpm_based
102+
load: true
103+
cache-from: type=local,src=/tmp/.buildx-cache
104+
cache-to: type=local,dest=/tmp/.buildx-cache
105+
tags: amazon-builder:${{ github.sha }}
106+
build-args: |
107+
CONTAINER_VERSION=amazonlinux:1
108+
- name: Run Amazon 1
109+
uses: addnab/docker-run-action@v1
110+
with:
111+
image: amazon-builder:${{ github.sha }}
112+
run: /build.sh
113+
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
114+
- name: Build Image Amazon 2
115+
uses: docker/build-push-action@v2
116+
with:
117+
file: build/Dockerfile
118+
context: '.'
119+
target: rpm_based
120+
load: true
121+
cache-from: type=local,src=/tmp/.buildx-cache
122+
cache-to: type=local,dest=/tmp/.buildx-cache
123+
tags: amazon2-builder:${{ github.sha }}
124+
build-args: |
125+
CONTAINER_VERSION=amazonlinux:2
126+
- name: Run Amazon 2
127+
uses: addnab/docker-run-action@v1
128+
with:
129+
image: amazon2-builder:${{ github.sha }}
130+
run: /build.sh
131+
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
132+
- name: Build Image Centos 7
133+
uses: docker/build-push-action@v2
134+
with:
135+
file: build/Dockerfile
136+
context: '.'
137+
target: rpm_based
138+
load: true
139+
cache-from: type=local,src=/tmp/.buildx-cache
140+
cache-to: type=local,dest=/tmp/.buildx-cache
141+
tags: centos7-builder:${{ github.sha }}
142+
build-args: |
143+
CONTAINER_VERSION=centos:7
144+
- name: Run Centos 7
145+
uses: addnab/docker-run-action@v1
146+
with:
147+
image: centos7-builder:${{ github.sha }}
148+
run: /build.sh
149+
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
150+
- name: Build Image Ubuntu Xenial
151+
uses: docker/build-push-action@v2
152+
with:
153+
file: build/Dockerfile
154+
context: '.'
155+
target: deb_based
156+
load: true
157+
cache-from: type=local,src=/tmp/.buildx-cache
158+
cache-to: type=local,dest=/tmp/.buildx-cache
159+
tags: ubuntu-xenial-builder:${{ github.sha }}
160+
build-args: |
161+
CONTAINER_VERSION=ubuntu:xenial
162+
OS_VERSION=xenial
163+
- name: Run Ubuntu Xenial
164+
uses: addnab/docker-run-action@v1
165+
with:
166+
image: ubuntu-xenial-builder:${{ github.sha }}
167+
run: /build.sh
168+
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
169+
- name: Build Image Ubuntu Bionic
170+
uses: docker/build-push-action@v2
171+
with:
172+
file: build/Dockerfile
173+
context: '.'
174+
target: deb_based
175+
load: true
176+
cache-from: type=local,src=/tmp/.buildx-cache
177+
cache-to: type=local,dest=/tmp/.buildx-cache
178+
tags: ubuntu-bionic-builder:${{ github.sha }}
179+
build-args: |
180+
CONTAINER_VERSION=ubuntu:bionic
181+
OS_VERSION=bionic
182+
- name: Run Ubuntu Bionic
183+
uses: addnab/docker-run-action@v1
184+
with:
185+
image: ubuntu-bionic-builder:${{ github.sha }}
186+
run: /build.sh
187+
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
188+
- name: Build Image Ubuntu Focal
189+
uses: docker/build-push-action@v2
190+
with:
191+
file: build/Dockerfile
192+
context: '.'
193+
target: deb_based
194+
load: true
195+
cache-from: type=local,src=/tmp/.buildx-cache
196+
cache-to: type=local,dest=/tmp/.buildx-cache
197+
tags: ubuntu-focal-builder:${{ github.sha }}
198+
build-args: |
199+
CONTAINER_VERSION=ubuntu:focal
200+
OS_VERSION=focal
201+
- name: Run Ubuntu Focal
202+
uses: addnab/docker-run-action@v1
203+
with:
204+
image: ubuntu-focal-builder:${{ github.sha }}
205+
run: /build.sh
206+
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
207+
- name: Build Image Ubuntu Groovy
208+
uses: docker/build-push-action@v2
209+
with:
210+
file: build/Dockerfile
211+
context: '.'
212+
target: deb_based
213+
load: true
214+
cache-from: type=local,src=/tmp/.buildx-cache
215+
cache-to: type=local,dest=/tmp/.buildx-cache
216+
tags: ubuntu-groovy-builder:${{ github.sha }}
217+
build-args: |
218+
CONTAINER_VERSION=ubuntu:groovy
219+
OS_VERSION=groovy
220+
- name: Run Ubuntu Groovy
221+
uses: addnab/docker-run-action@v1
222+
with:
223+
image: ubuntu-groovy-builder:${{ github.sha }}
224+
run: /build.sh
225+
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output

.github/workflows/fossa.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Fossa
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**.md'
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
env:
15+
FOSSA_VER: 1.1.3
16+
FOSSA_URL: https://github.com/fossas/fossa-cli/releases/download
17+
GOLANG_VERSION: 1.15
18+
19+
jobs:
20+
21+
scan:
22+
name: Fossa
23+
runs-on: ubuntu-18.04
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v2
27+
- name: Setup Golang Environment
28+
uses: actions/setup-go@v2
29+
with:
30+
go-version: '${{ env.GOLANG_VERSION }}'
31+
- name: Configure Fossa CLI
32+
run: |
33+
wget ${{ env.FOSSA_URL }}/v${{ env.FOSSA_VER }}/fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
34+
tar xzf fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
35+
./fossa init
36+
- name: Run License Scan
37+
env:
38+
FOSSA_API_KEY: ${{ secrets.FOSSA_TOKEN }}
39+
GO111MODULE: on
40+
GOPATH: /home/runner/go
41+
run: ./fossa analyze -t ${GITHUB_REPOSITORY#*/} -b ${GITHUB_REF##*/}
42+
43+
notify:
44+
name: Notify
45+
runs-on: ubuntu-18.04
46+
needs: scan
47+
if: always()
48+
steps:
49+
- name: Workflow Status
50+
id: check
51+
uses: martialonline/workflow-status@v2
52+
- name: Output Variables
53+
id: commit
54+
run: |
55+
echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
56+
echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY} | cut -d '/' -f 2)"
57+
- name: Send Notification
58+
uses: 8398a7/action-slack@v3
59+
if: steps.check.outputs.status == 'failure'
60+
with:
61+
status: custom
62+
custom_payload: |
63+
{
64+
username: 'Fossa Scan',
65+
icon_emoji: ':fossa:',
66+
mention: 'channel',
67+
attachments: [{
68+
title: '${{ steps.commit.outputs.repo }} ${{ github.workflow }} license scan has failed',
69+
color: 'danger',
70+
fields: [{
71+
title: 'Commit Hash',
72+
value: '${{ steps.commit.outputs.sha }}',
73+
short: true
74+
},
75+
{
76+
title: 'Author',
77+
value: '${{ github.actor }}',
78+
short: true
79+
},
80+
{
81+
title: 'Job URL',
82+
value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
83+
short: false
84+
}]
85+
}]
86+
}
87+
env:
88+
GITHUB_TOKEN: ${{ github.token }}
89+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)