Add VerdictReset variable to ResultData struct to fix verdict metrics never reseting to 0 #120 #173
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: Build | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
jobs: | |
pre-checks: | |
runs-on: ubuntu-latest | |
steps: | |
# Install golang | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.0 | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: gofmt check | |
run: | | |
if [ "$(gofmt -s -l . | wc -l)" -ne 0 ] | |
then | |
echo "The following files were found to be not go formatted:" | |
gofmt -s -l . | |
exit 1 | |
fi | |
- name: golangci-lint | |
uses: reviewdog/action-golangci-lint@v1 | |
- name: unused-package check | |
run: | | |
make unused-package-check | |
trivy: | |
needs: pre-checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Build an image from Dockerfile | |
run: | | |
docker build -f Dockerfile -t docker.io/litmuschaos/chaos-exporter:${{ github.sha }} . --build-arg TARGETPLATFORM=linux/amd64 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'docker.io/litmuschaos/chaos-exporter:${{ github.sha }}' | |
format: 'table' | |
exit-code: '1' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
image-build: | |
runs-on: ubuntu-latest | |
needs: pre-checks | |
steps: | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
version: latest | |
- name: Build Docker Image | |
env: | |
DOCKER_REPO: litmuschaos | |
DOCKER_IMAGE: chaos-exporter | |
DOCKER_TAG: ci | |
run: | | |
make build | |
tests: | |
runs-on: ubuntu-latest | |
needs: pre-checks | |
steps: | |
# Install golang | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.0 | |
# Checkout to the latest commit | |
# On specific directory/path | |
- name: Checkout | |
uses: actions/checkout@v2 | |
#Install and configure a k3S cluster | |
- name: Installing Prerequisites (K3S Cluster) | |
env: | |
KUBECONFIG: /etc/rancher/k3s/k3s.yaml | |
run: | | |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.11+k3s1 sh -s - --docker --write-kubeconfig-mode 664 | |
kubectl wait node --all --for condition=ready --timeout=90s | |
mkdir -p $HOME/.kube | |
cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config | |
kubectl get nodes | |
- name: Dependency checks | |
run: | | |
make deps | |
- name: Running Go BDD Test | |
run: | | |
go mod tidy | |
make test | |
security-scan: | |
runs-on: ubuntu-latest | |
needs: pre-checks | |
steps: | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'docker.io/litmuschaos/chaos-exporter:ci' | |
format: 'table' | |
exit-code: '0' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' |