-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Updated CI/CD to use GitHub actions instead of Travis (#282)
* ci: Removing .travis.yml from CI build * ci: Renamed flex.yaml to push_pr.yml and updated job names to match. * ci: Ignoring pushes to docs or examples * ci: Added snyk scan to build process * ci: Cleaning up make target build-ci * ci: Adding code coverage using Coveralls * ci: Adding release workflow * ci: Enabling docker login * ci: Updated CI to use Docker to run tests Co-authored-by: noly <noeliaddf@gmail.com>
- Loading branch information
1 parent
0748889
commit a8d7d37
Showing
18 changed files
with
394 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
bin | ||
docs | ||
.git | ||
vendor |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
--- | ||
name: Release 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ envvars | |
flexConfigs/ | ||
results | ||
pkg/ | ||
lcov.info |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.