Skip to content

Commit 8cee427

Browse files
committed
Fix CI
1 parent c43375b commit 8cee427

File tree

2 files changed

+44
-34
lines changed

2 files changed

+44
-34
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,20 @@ jobs:
3131
steps:
3232
- name: Checkout Repository
3333
uses: actions/checkout@v2
34-
- name: Fetch Cached Artifacts
34+
- name: Setup Golang Environment
35+
uses: actions/setup-go@v2
36+
with:
37+
go-version: '${{ env.GOLANG_VERSION }}'
38+
- name: Build Binary
39+
run: >
40+
make build
41+
env:
42+
GOFLAGS: '-mod=vendor -gcflags=-trimpath=${{ github.workspace }} -asmflags=-trimpath=${{ github.workspace }}'
43+
- name: Store Artifacts in Cache
3544
uses: actions/cache@v2.1.4
3645
with:
3746
path: ${{ github.workspace }}/nginx-asg-sync
3847
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.1.4
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 }}
5948

6049
unit-tests:
6150
name: Unit Tests
@@ -98,13 +87,14 @@ jobs:
9887
with:
9988
file: build/Dockerfile
10089
context: '.'
101-
target: rpm_based
90+
target: local
10291
load: true
10392
cache-from: type=local,src=/tmp/.buildx-cache
10493
cache-to: type=local,dest=/tmp/.buildx-cache
10594
tags: amazon-builder:${{ github.sha }}
10695
build-args: |
10796
CONTAINER_VERSION=amazonlinux:1
97+
OS_TYPE=rpm_based
10898
- name: Run Amazon 1
10999
uses: addnab/docker-run-action@v2
110100
with:
@@ -116,13 +106,14 @@ jobs:
116106
with:
117107
file: build/Dockerfile
118108
context: '.'
119-
target: rpm_based
109+
target: local
120110
load: true
121111
cache-from: type=local,src=/tmp/.buildx-cache
122112
cache-to: type=local,dest=/tmp/.buildx-cache
123113
tags: amazon2-builder:${{ github.sha }}
124114
build-args: |
125115
CONTAINER_VERSION=amazonlinux:2
116+
OS_TYPE=rpm_based
126117
- name: Run Amazon 2
127118
uses: addnab/docker-run-action@v2
128119
with:
@@ -134,32 +125,52 @@ jobs:
134125
with:
135126
file: build/Dockerfile
136127
context: '.'
137-
target: rpm_based
128+
target: local
138129
load: true
139130
cache-from: type=local,src=/tmp/.buildx-cache
140131
cache-to: type=local,dest=/tmp/.buildx-cache
141132
tags: centos7-builder:${{ github.sha }}
142133
build-args: |
143134
CONTAINER_VERSION=centos:7
135+
OS_TYPE=rpm_based
144136
- name: Run Centos 7
145137
uses: addnab/docker-run-action@v2
146138
with:
147139
image: centos7-builder:${{ github.sha }}
148140
run: /build.sh
149141
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
142+
- name: Build Image Centos 8
143+
uses: docker/build-push-action@v2
144+
with:
145+
file: build/Dockerfile
146+
context: '.'
147+
target: local
148+
load: true
149+
cache-from: type=local,src=/tmp/.buildx-cache
150+
cache-to: type=local,dest=/tmp/.buildx-cache
151+
tags: centos7-builder:${{ github.sha }}
152+
build-args: |
153+
CONTAINER_VERSION=centos:8
154+
OS_TYPE=rpm_based
155+
- name: Run Centos 8
156+
uses: addnab/docker-run-action@v2
157+
with:
158+
image: centos8-builder:${{ github.sha }}
159+
run: /build.sh
160+
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
150161
- name: Build Image Ubuntu Xenial
151162
uses: docker/build-push-action@v2
152163
with:
153164
file: build/Dockerfile
154165
context: '.'
155-
target: deb_based
166+
target: local
156167
load: true
157168
cache-from: type=local,src=/tmp/.buildx-cache
158169
cache-to: type=local,dest=/tmp/.buildx-cache
159170
tags: ubuntu-xenial-builder:${{ github.sha }}
160171
build-args: |
161172
CONTAINER_VERSION=ubuntu:xenial
162-
OS_VERSION=xenial
173+
OS_TYPE=deb_based
163174
- name: Run Ubuntu Xenial
164175
uses: addnab/docker-run-action@v2
165176
with:
@@ -171,14 +182,14 @@ jobs:
171182
with:
172183
file: build/Dockerfile
173184
context: '.'
174-
target: deb_based
185+
target: local
175186
load: true
176187
cache-from: type=local,src=/tmp/.buildx-cache
177188
cache-to: type=local,dest=/tmp/.buildx-cache
178189
tags: ubuntu-bionic-builder:${{ github.sha }}
179190
build-args: |
180191
CONTAINER_VERSION=ubuntu:bionic
181-
OS_VERSION=bionic
192+
OS_TYPE=deb_based
182193
- name: Run Ubuntu Bionic
183194
uses: addnab/docker-run-action@v2
184195
with:
@@ -190,14 +201,14 @@ jobs:
190201
with:
191202
file: build/Dockerfile
192203
context: '.'
193-
target: deb_based
204+
target: local
194205
load: true
195206
cache-from: type=local,src=/tmp/.buildx-cache
196207
cache-to: type=local,dest=/tmp/.buildx-cache
197208
tags: ubuntu-focal-builder:${{ github.sha }}
198209
build-args: |
199210
CONTAINER_VERSION=ubuntu:focal
200-
OS_VERSION=focal
211+
OS_TYPE=deb_based
201212
- name: Run Ubuntu Focal
202213
uses: addnab/docker-run-action@v2
203214
with:
@@ -209,14 +220,14 @@ jobs:
209220
with:
210221
file: build/Dockerfile
211222
context: '.'
212-
target: deb_based
223+
target: local
213224
load: true
214225
cache-from: type=local,src=/tmp/.buildx-cache
215226
cache-to: type=local,dest=/tmp/.buildx-cache
216227
tags: ubuntu-groovy-builder:${{ github.sha }}
217228
build-args: |
218229
CONTAINER_VERSION=ubuntu:groovy
219-
OS_VERSION=groovy
230+
OS_TYPE=deb_based
220231
- name: Run Ubuntu Groovy
221232
uses: addnab/docker-run-action@v2
222233
with:

build/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
ARG CONTAINER_VERSION=ubuntu:groovy
2-
ARG GOLANG_CONTAINER=golang:1.15-alpine
32
ARG OS_TYPE=deb_based
43
ARG PACKAGE_VERSION=0.4-1
54

6-
FROM $GOLANG_CONTAINER AS builder
5+
FROM golang:1.15-alpine AS builder
76
WORKDIR /go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync
87
COPY . /go/src/github.com/nginxinc/nginx-asg-sync/
98

0 commit comments

Comments
 (0)