mirror of
https://github.com/rancher/k3k.git
synced 2026-05-06 01:16:52 +00:00
* Scale up/down tests for virtual and shared mode Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * defer cleanup and more fixes Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * add labels to e2e tests and divide the workload Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * add labels to e2e tests and divide the workload Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * add validate job to e2e test Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fix label filters for e2e tests Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fix makefile Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * use constants for e2e tests labels Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fix typo Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> * fix labels Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com> --------- Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
131 lines
2.7 KiB
YAML
131 lines
2.7 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v8
|
|
with:
|
|
args: --timeout=5m
|
|
version: v2.3.0
|
|
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Validate
|
|
run: make validate
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
needs: validate
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run unit tests
|
|
run: make test-unit
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./cover.out
|
|
flags: unit
|
|
|
|
tests-cli:
|
|
runs-on: ubuntu-latest
|
|
needs: validate
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install Ginkgo
|
|
run: go install github.com/onsi/ginkgo/v2/ginkgo
|
|
|
|
- name: Setup environment
|
|
run: |
|
|
mkdir ${{ github.workspace }}/covdata
|
|
|
|
echo "COVERAGE=true" >> $GITHUB_ENV
|
|
echo "GOCOVERDIR=${{ github.workspace }}/covdata" >> $GITHUB_ENV
|
|
echo "K3S_HOST_VERSION=v1.32.1+k3s1 >> $GITHUB_ENV"
|
|
|
|
- name: Build and package
|
|
run: |
|
|
make build
|
|
make package
|
|
|
|
# add k3kcli to $PATH
|
|
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
|
|
|
|
- name: Check k3kcli
|
|
run: k3kcli -v
|
|
|
|
- name: Run cli tests
|
|
env:
|
|
K3K_DOCKER_INSTALL: "true"
|
|
K3S_HOST_VERSION: "${{ env.K3S_HOST_VERSION }}"
|
|
run: make test-cli
|
|
|
|
- name: Convert coverage data
|
|
run: go tool covdata textfmt -i=${{ github.workspace }}/covdata -o ${{ github.workspace }}/covdata/cover.out
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ${{ github.workspace }}/covdata/cover.out
|
|
flags: cli
|
|
|
|
- name: Archive k3s logs
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: cli-k3s-logs
|
|
path: /tmp/k3s.log
|
|
|
|
- name: Archive k3k logs
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: cli-k3k-logs
|
|
path: /tmp/k3k.log
|