[YUNIKORN-2135] Add integration test code coverage #895
Workflow file for this run
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
name: Pre-commit checks | |
on: | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: .go_version | |
- name: Check license | |
run: make license-check | |
- name: Go lint | |
run: make lint | |
- name: Run Version Check | |
run: make pseudo | |
- name: Run ShellCheck | |
run: make check_scripts | |
- name: Unit tests | |
run: make test | |
- name: Code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/coverage.txt | |
flags: unittests | |
e2e-tests: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
k8s: [v1.28.0, v1.27.3, v1.26.6, v1.25.11, v1.24.15] | |
plugin: ['', '--plugin'] | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: .go_version | |
- name: Set hugepage | |
run: | | |
echo "vm.nr_hugepages = 1024" | sudo tee -a /etc/sysctl.conf | |
sudo sysctl -p | |
sudo sysctl -a | grep vm.nr_hugepages | |
- run: ./scripts/run-e2e-tests.sh -a "test" -n "yk8s" -v "kindest/node:${KIND_NODE_IMAGE}" ${KIND_EXTRA_ARGS} | |
env: | |
KIND_NODE_IMAGE: ${{ matrix.k8s }} | |
KIND_EXTRA_ARGS: ${{ matrix.plugin }} | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: go-cover-dir-merged | |
path: go-cover-dir-merged/ | |
if-no-files-found: 'ignore' | |
e2e-tests-code-coverage: | |
needs: e2e-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: .go_version | |
- name: Download code-coverage-report artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: downloaded_artifacts | |
- run: | | |
if [ -d downloaded_artifacts/go-cover-dir-merged ]; | |
then | |
if [ "$(ls -A downloaded_artifacts/go-cover-dir-merged)" ]; | |
then | |
go tool covdata textfmt -i=downloaded_artifacts/go-cover-dir-merged -o yunikorn-k8shim.txt -pkg=github.com/apache/yunikorn-k8shim/... | |
go tool covdata textfmt -i=downloaded_artifacts/go-cover-dir-merged -o yunikorn-core.txt -pkg=github.com/apache/yunikorn-core/... | |
else | |
echo "No files found in downloaded_artifacts/go-cover-dir-merged folder. Skip the rest of the steps." | |
exit 0 | |
fi | |
else | |
echo "No downloaded_artifacts/go-cover-dir-merged folder found. Skip the rest of the steps." | |
exit 0 | |
fi | |
- name: Code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: yunikorn-k8shim.txt | |
flags: e2e |