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

Beautify GitHub CI tests output #230

Merged
merged 10 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
80 changes: 68 additions & 12 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
uses: actions/checkout@v3
if: github.event.pull_request.head.sha == ''
lint:
concurrency:
group: lint-golangci-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
needs:
- start-runner
- smart-checkout
Expand All @@ -62,6 +65,9 @@ jobs:
with:
version: v1.52.2
code-format-check:
concurrency:
group: lint-autoformat-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
needs:
- start-runner
- smart-checkout
Expand All @@ -82,13 +88,59 @@ jobs:
run: bash ./.github/scripts/format-all-go-code.sh "$PWD"
- name: Check repository diff
run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
run-tests:
run-unit-tests:
concurrency:
group: run-unit-tests-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
needs:
- start-runner
- smart-checkout
- lint
- code-format-check
runs-on: ${{ needs.start-runner.outputs.runner-label }}
outputs:
result: ${{ steps.run-unit-tests.outputs.result }}
steps:
- name: set-env-vars
run: |
echo "HOME=/actions-runner" >> $GITHUB_ENV
- name: setup-go
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
- name: setup-medium-test-class-binaries
run: |
# This installs kube-apiserver and etcd binaries for `medium`
# class tests. Refer to the writing tests docs for more info.
make envtest
KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path)
echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV
- name: run-unit-tests
run: |
set -euo pipefail
go test -json -v -timeout 900s -p 1 ./internal/... -ginkgo.v 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v2
if: always()
with:
name: unit-tests-log
path: /tmp/gotest.log
if-no-files-found: error
run-e2e-tests:
concurrency:
group: run-e2e-tests-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
needs:
- start-runner
- smart-checkout
- lint
- code-format-check
- run-unit-tests
runs-on: ${{ needs.start-runner.outputs.runner-label }}
outputs:
result: ${{ steps.run-tests.outputs.result }}
result: ${{ steps.run-e2e-tests.outputs.result }}
steps:
- name: set-env-vars
run: |
Expand All @@ -97,6 +149,8 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
- name: install-dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -128,13 +182,6 @@ jobs:
kind version
kubectl version --client=true
helm version
- name: setup-medium-test-class-binaries
run: |
# This installs kube-apiserver and etcd binaries for `medium`
# class tests. Refer to the writing tests docs for more info.
make envtest
KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path)
echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV
- name: setup-k8s-cluster
run: |
kind delete cluster
Expand All @@ -161,18 +208,27 @@ jobs:
# TODO would be cool to parse YDB image from manifests to avoid duplicating information
docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
- name: run-tests
- name: run-e2e-tests
run: |
go test -v -timeout 3600s -p 1 ./... -args -ginkgo.v
set -euo pipefail
go test -json -v -timeout 3600s -p 1 ./e2e/... -ginkgo.v 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v2
if: always()
with:
name: e2e-tests-log
path: /tmp/gotest.log
if-no-files-found: error
- name: teardown-k8s-cluster
run: |
kind delete cluster
stop-runner:
needs:
- start-runner
- run-tests
- lint
- code-format-check
- run-unit-tests
- run-e2e-tests
runs-on: ubuntu-latest
if: always()
steps:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ unit-test: manifests generate fmt vet envtest ## Run unit tests

.PHONY: e2e-test
e2e-test: manifests generate fmt vet docker-build kind-init kind-load ## Run e2e tests
go test -v -timeout 3600s -p 1 ./e2e/... -args -ginkgo.v
go test -v -timeout 3600s -p 1 ./e2e/... -ginkgo.v

.PHONY: test
test: unit-test e2e-test ## Run all tests
Expand Down
Loading