Skip to content
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

ci: Updated CI/CD to use GitHub actions instead of Travis #282

Merged
merged 11 commits into from
Feb 24, 2021
Merged
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
docs
.git
vendor
57 changes: 0 additions & 57 deletions .github/workflows/flex.yaml

This file was deleted.

121 changes: 121 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
name: Prerelease pipeline

on:
release:
types:
- prereleased
tags:
- 'v*'

env:
GO_VERSION: '1.15'
TAG: ${{ github.event.release.tag_name }}
IS_RELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed for goreleaser

jobs:

test-nix:
strategy:
matrix:
os: [ ubuntu-20.04 ]
name: Run unit tests in ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Run unit tests
run: make ci/test
- name: Convert coverage.out to lcov.info
run: make ci/convert-coverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: lcov.info
flag-name: run-linux
parallel: true

test-integration-nix:
name: Run integration tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Run integration tests
run: make test-integration

snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Scan code for vulnerabilities
env:
SNYK_TOKEN: ${{ secrets.COREINT_SNYK_TOKEN }}
run: make ci/snyk-test

test-windows:
strategy:
matrix:
go: [ '1.15' ]
os: [ windows-2019 ]
name: Run unit and integration tests in ${{matrix.os}} with go ${{matrix.go}}
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
- name: install go
uses: actions/setup-go@v2
with:
go-version: ${{matrix.go}}
- name: run unit tests
# we don't have 'make' on windows.
run: |
go test ./...
- name: run integration tests
# we don't have 'make' on windows.
run: |
go test --tags=integration ./...

prerelease:
name: Build and release binaries
runs-on: ubuntu-20.04
needs: [ test-nix, test-windows, snyk, test-integration-nix ]
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Pre release
run: make ci/pre-release
- name: Notify failure via Slack
if: ${{ failure() }}
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }}
slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }}
slack-text: "❌ `${{ env.REPO_FULL_NAME }}`: prerelease pipeline failed."

finish:
name: Finish
needs: [ prerelease ]
runs-on: ubuntu-20.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
117 changes: 117 additions & 0 deletions .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
name: Push/PR pipeline

on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- README.md
- 'docs/**'
- 'examples/**'

env:
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
ORIGINAL_REPO_NAME: "newrelic/nri-flex"
GO_VERSION: '1.15'

jobs:

test-nix:
strategy:
matrix:
os: [ ubuntu-20.04 ]
name: Run unit tests in ${{matrix.os}}
runs-on: ${{matrix.os}}
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Run unit tests
run: make ci/test
- name: Convert coverage.out to lcov.info
run: make ci/convert-coverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: lcov.info
flag-name: run-linux
parallel: true

test-integration-nix:
name: Run integration tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Run integration tests
run: make test-integration

snyk:
name: Run security checks via snyk
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Scan code for vulnerabilities
env:
SNYK_TOKEN: ${{ secrets.COREINT_SNYK_TOKEN }}
run: make ci/snyk-test

test-windows:
strategy:
matrix:
go: [ '1.16' ]
os: [ windows-2019 ]
name: Run unit and integration tests in ${{matrix.os}} with go ${{matrix.go}}
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
- name: install go
uses: actions/setup-go@v2
with:
go-version: ${{matrix.go}}
- name: run unit tests
# we don't have 'make' on windows.
run: |
go test ./...
- name: run integration tests
# we don't have 'make' on windows.
run: |
go test --tags=integration ./...

test-build:
name: Test binary compilation for all platforms:arch
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.OHAI_DOCKER_HUB_ID }}
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }}
- name: Build all platforms:arch
run: make ci/pre-release

finish:
name: Finish
needs: [ test-nix, test-windows ]
runs-on: ubuntu-20.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ envvars
flexConfigs/
results
pkg/
lcov.info
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

Loading