Skip to content

Remove Travis and move to GitHub workflows #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 9, 2021
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
29 changes: 29 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
reviewers:
- "nginxinc/kic"
- "ciarams87"
- "sundaram1995"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: daily
reviewers:
- "nginxinc/kic"
- package-ecosystem: "docker"
directory: "/build"
schedule:
interval: daily
reviewers:
- "nginxinc/kic"
- package-ecosystem: "pip"
directory: "/tests"
schedule:
interval: daily
reviewers:
- "nginxinc/kic"
- "vepatel"
225 changes: 225 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Continuous Integration

on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
paths-ignore:
- '**.md'
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

env:
DOCKER_BUILDKIT: 1
GOLANG_VERSION: 1.15

jobs:

binary:
name: Build Binary
runs-on: ubuntu-18.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Fetch Cached Artifacts
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/nginx-asg-sync
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }}
- name: Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Image
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: builder
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: nginx/nginx-asg-sync:${{ github.sha }}

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

build:
name: Build Image
runs-on: ubuntu-18.04
needs: [binary, unit-tests]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Fetch Cached Artifacts
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/nginx-asg-sync
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }}
- name: Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Image Amazon 1
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: rpm_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: amazon-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=amazonlinux:1
- name: Run Amazon 1
uses: addnab/docker-run-action@v1
with:
image: amazon-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Amazon 2
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: rpm_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: amazon2-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=amazonlinux:2
- name: Run Amazon 2
uses: addnab/docker-run-action@v1
with:
image: amazon2-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Centos 7
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: rpm_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: centos7-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=centos:7
- name: Run Centos 7
uses: addnab/docker-run-action@v1
with:
image: centos7-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Ubuntu Xenial
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: deb_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ubuntu-xenial-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=ubuntu:xenial
OS_VERSION=xenial
- name: Run Ubuntu Xenial
uses: addnab/docker-run-action@v1
with:
image: ubuntu-xenial-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Ubuntu Bionic
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: deb_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ubuntu-bionic-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=ubuntu:bionic
OS_VERSION=bionic
- name: Run Ubuntu Bionic
uses: addnab/docker-run-action@v1
with:
image: ubuntu-bionic-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Ubuntu Focal
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: deb_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ubuntu-focal-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=ubuntu:focal
OS_VERSION=focal
- name: Run Ubuntu Focal
uses: addnab/docker-run-action@v1
with:
image: ubuntu-focal-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
- name: Build Image Ubuntu Groovy
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
target: deb_based
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ubuntu-groovy-builder:${{ github.sha }}
build-args: |
CONTAINER_VERSION=ubuntu:groovy
OS_VERSION=groovy
- name: Run Ubuntu Groovy
uses: addnab/docker-run-action@v1
with:
image: ubuntu-groovy-builder:${{ github.sha }}
run: /build.sh
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
89 changes: 89 additions & 0 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Fossa

on:
push:
branches:
- master
paths-ignore:
- '**.md'

defaults:
run:
shell: bash

env:
FOSSA_VER: 1.1.3
FOSSA_URL: https://github.com/fossas/fossa-cli/releases/download
GOLANG_VERSION: 1.15

jobs:

scan:
name: Fossa
runs-on: ubuntu-18.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Golang Environment
uses: actions/setup-go@v2
with:
go-version: '${{ env.GOLANG_VERSION }}'
- name: Configure Fossa CLI
run: |
wget ${{ env.FOSSA_URL }}/v${{ env.FOSSA_VER }}/fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
tar xzf fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
./fossa init
- name: Run License Scan
env:
FOSSA_API_KEY: ${{ secrets.FOSSA_TOKEN }}
GO111MODULE: on
GOPATH: /home/runner/go
run: ./fossa analyze -t ${GITHUB_REPOSITORY#*/} -b ${GITHUB_REF##*/}

notify:
name: Notify
runs-on: ubuntu-18.04
needs: scan
if: always()
steps:
- name: Workflow Status
id: check
uses: martialonline/workflow-status@v2
- name: Output Variables
id: commit
run: |
echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY} | cut -d '/' -f 2)"
- name: Send Notification
uses: 8398a7/action-slack@v3
if: steps.check.outputs.status == 'failure'
with:
status: custom
custom_payload: |
{
username: 'Fossa Scan',
icon_emoji: ':fossa:',
mention: 'channel',
attachments: [{
title: '${{ steps.commit.outputs.repo }} ${{ github.workflow }} license scan has failed',
color: 'danger',
fields: [{
title: 'Commit Hash',
value: '${{ steps.commit.outputs.sha }}',
short: true
},
{
title: 'Author',
value: '${{ github.actor }}',
short: true
},
{
title: 'Job URL',
value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
short: false
}]
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.