forked from argoproj/argo-rollouts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: code coverage for e2e (argoproj#3740)
* first pass at coverage for e2e Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * change folder names Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * only upload latest e2e results Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * change name of step Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * fix matrix name Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * rename files Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * add directory Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * use correct upload name Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * move event file Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * bad move of event_file Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * fix uncomment Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * only run on testing workflow Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * remove events from go workflow Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * use new download metho Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * remove specific file Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * change workflow name Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> * remove double upload Signed-off-by: Zach Aller <zachaller@users.noreply.github.com> --------- Signed-off-by: Zach Aller <zachaller@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
198 additions
and
153 deletions.
There are no files selected for viewing
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
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
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,182 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'release-*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
- 'release-*' | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | ||
required: false | ||
default: false | ||
env: | ||
# Golang version to use across CI steps | ||
GOLANG_VERSION: '1.22' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
event_file: | ||
name: 'Event File' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Event File | ||
path: ${{ github.event_path }} | ||
test-unit: | ||
name: Run unit tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v5.0.2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore go build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | ||
|
||
- name: Download all Go modules | ||
run: | | ||
go mod download | ||
- name: Test | ||
run: make test-unit | ||
|
||
- name: Upload Unit Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Unit Test Results | ||
path: | | ||
junit.xml | ||
- name: Generate code coverage artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-output-unit | ||
path: coverage-output-unit/coverage.out | ||
|
||
test-e2e: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kubernetes: | ||
- version: 1.26 | ||
latest: false | ||
- version: 1.27 | ||
latest: false | ||
- version: 1.28 | ||
latest: false | ||
- version: 1.29 | ||
latest: true | ||
name: Run end-to-end tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v5.0.2 | ||
with: | ||
go-version: '1.22' | ||
- uses: actions/checkout@v4 | ||
- name: Setup k3s | ||
env: | ||
INSTALL_K3S_CHANNEL: v${{ matrix.kubernetes.version }} | ||
run: | | ||
curl -sfL https://get.k3s.io | sh - | ||
sudo mkdir ~/.kube | ||
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config | ||
sudo chmod 755 ~/.kube/config | ||
kubectl version | ||
kubectl create ns argo-rollouts | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Download cache | ||
run: go mod download | ||
- name: Install CRDs | ||
run: | | ||
kubectl apply -k manifests/crds | ||
kubectl apply -f test/e2e/crds | ||
- name: Start controller | ||
run: make start-e2e 2>&1 | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" > /tmp/e2e-controller.log & | ||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@v3 | ||
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}} | ||
- name: Run e2e tests | ||
run: make test-e2e | ||
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true') }} | ||
- name: Output Rerun Overview | ||
run: | | ||
[[ -f rerunreport.txt ]] && cat rerunreport.txt || echo "No rerun report found" | ||
- name: Upload E2E Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: E2E Test Results (k8s ${{ matrix.kubernetes.version }}) | ||
path: | | ||
junit.xml | ||
- name: Upload e2e-controller logs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: e2e-controller-k8s-${{ matrix.kubernetes.version }}.log | ||
path: /tmp/e2e-controller.log | ||
if: ${{ always() }} | ||
- name: Upload code coverage artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-output-e2e | ||
path: coverage-output-e2e | ||
if: ${{ matrix.kubernetes.latest }} | ||
|
||
coverage-process: | ||
name: Process Coverage Files | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test-unit | ||
- test-e2e | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v5.0.2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
id: go | ||
- name: Get e2e code coverage | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: coverage-output-e2e | ||
path: coverage-output-e2e | ||
- name: Get unit test code coverage | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: coverage-output-unit | ||
path: coverage-output-unit | ||
- name: combine-go-coverage | ||
run: | | ||
go tool covdata percent -i=coverage-output-unit/,coverage-output-e2e/ -o full-coverage.out | ||
- name: Upload code coverage information to codecov.io | ||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | ||
with: | ||
file: full-coverage.out | ||
fail_ci_if_error: false | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
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 |
---|---|---|
|
@@ -17,3 +17,5 @@ plugin-bin/ | |
# static | ||
server/static/* | ||
!server/static/.gitkeep | ||
coverage-output-e2e/ | ||
coverage-output-unit/ |
Oops, something went wrong.