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

Fixed codecov ci setup #839

Merged
merged 1 commit into from
Sep 11, 2023
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
6 changes: 6 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: 80%
threshold: 5%
76 changes: 76 additions & 0 deletions .github/workflows/coverage_reporting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: Codecov

on: # yamllint disable-line rule:truthy
pull_request: # yamllint disable-line rule:empty-values

jobs:
testing:
name: coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: build and install receptor
run: |
make build-all
sudo cp ./receptor /usr/local/bin/receptor

- name: Download kind binary
run: curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 && chmod +x ./kind

- name: Create k8s cluster
run: ./kind create cluster

- name: Interact with the cluster
run: kubectl get nodes

- name: Run receptor tests with coverage
run: make coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: get k8s logs
if: ${{ failure() }}
run: .github/workflows/artifact-k8s-logs.sh

- name: remove sockets before archiving logs
if: ${{ failure() }}
run: find /tmp/receptor-testing -name controlsock -delete

- name: Artifact receptor data
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: test-logs
path: /tmp/receptor-testing

- name: Archive receptor binary
uses: actions/upload-artifact@v3
with:
name: receptor
path: /usr/local/bin/receptor
11 changes: 2 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,8 @@ jobs:
- name: Interact with the cluster
run: kubectl get nodes

- name: Run receptor tests with coverage
run: make coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Run receptor tests
run: make test

- name: get k8s logs
if: ${{ failure() }}
Expand Down
Loading