Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,23 @@ on:

env:
DOCKER_BUILDKIT: 1
GOLANG_VERSION: 1.16

jobs:

binary:
name: Build Binary
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Go version from go.mod
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- name: Setup Golang Environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Build Binary
run: make binary
env:
GOFLAGS: '-gcflags=-trimpath=${{ github.workspace }} -asmflags=-trimpath=${{ github.workspace }}'
- name: Cache Artifacts
uses: actions/[email protected]
with:
Expand All @@ -47,20 +50,20 @@ jobs:

unit-tests:
name: Unit Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Golang Environment
uses: actions/setup-go@v2
with:
go-version: '${{ env.GOLANG_VERSION }}'
go-version: ${{ env.GO_VERSION }}
- name: Run Tests
run: make test

build:
name: Build Image
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs: [binary, unit-tests]
steps:
- name: Checkout Repository
Expand Down Expand Up @@ -93,7 +96,7 @@ jobs:

release-docker:
name: Release Image
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs: [build, unit-tests]
if:
github.repository == 'nginxinc/nginx-ingress-operator' &&
Expand Down Expand Up @@ -138,7 +141,7 @@ jobs:

notify:
name: Notify
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs: release-docker
if: always() && github.ref == 'refs/heads/master'
steps:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ test:
GO111MODULE=on go test ./...

binary:
CGO_ENABLED=0 GO111MODULE=on GOOS=linux go build -trimpath -installsuffix cgo -o build/_output/bin/nginx-ingress-operator github.com/nginxinc/nginx-ingress-operator/cmd/manager
$(eval GOPATH=$(shell go env GOPATH))
CGO_ENABLED=0 GO111MODULE=on GOFLAGS="-gcflags=-trimpath=${GOPATH} -asmflags=-trimpath=${GOPATH}" GOOS=linux go build -trimpath -ldflags "-s -w" -o build/_output/bin/nginx-ingress-operator github.com/nginxinc/nginx-ingress-operator/cmd/manager

build: binary
docker build -f build/Dockerfile -t $(IMAGE):$(TAG) .
Expand Down