Skip to content

[8.8](backport #2431) Temporarily disable long running tests #10134

[8.8](backport #2431) Temporarily disable long running tests

[8.8](backport #2431) Temporarily disable long running tests #10134

Workflow file for this run

name: UnitTests
on:
pull_request:
branches:
- main
- "[0-9]+.[0-9]+"
types: [opened, synchronize, reopened]
push:
branches:
- main
env:
K8S_MANIFEST_DIR: deploy
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
unit_tests:
name: Unit Tests
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up GO (with caching)
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: .go-version
- name: Mage build bundle before unit tests
uses: magefile/mage-action@v2
with:
args: buildOpaBundle
- name: Copy bundle to required dirs
run: |
cp bundle.tar.gz evaluator/
- name: Unit-Test
run: |
GOOS=linux go test -v -race -coverpkg=./... -coverprofile=cover.out.tmp ./...
cat cover.out.tmp | grep -v "mock_.*.go" > cover.out # remove mock files from coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: coverage-file
path: cover.out
coverage:
name: Coverage report
needs: unit_tests
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Download coverage artifact
uses: actions/download-artifact@v3
with:
name: coverage-file
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=cover.out -service=github
manifest_tests:
name: Manifest Tests
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Get diff k8s manifests
uses: technote-space/get-diff-action@v6
with:
PATTERNS: ${{ env.K8S_MANIFEST_DIR }}/**
- name: Run K8s manifest tests
if: env.GIT_DIFF
uses: stefanprodan/kube-tools@v1
with:
kubectl: 1.18.4
kubeval: v0.16.1
command: |
kubeval --strict -d ${{ env.K8S_MANIFEST_DIR }} --ignore-missing-schemas --ignored-filename-patterns kustomization,kind,patch,cloudbeat,cloudformation --skip-kinds ClusterConfig
golangci:
name: golangci-lint
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up GO (with caching)
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: .go-version
- name: Check out the repo
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ (github.event.pull_request_target || github.event.pull_request).head.repo.full_name }}
ref: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }}
- name: Go linter
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=10m --whole-files
dependency-review:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Dependency Review
uses: actions/dependency-review-action@v3
terraform-linter:
name: terraform-lint
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Terraform fmt
run: terraform fmt -check -recursive