v1.0.4 #46
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: Go Tests | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
name: Run Go tests | |
runs-on: ubuntu-latest | |
env: # Set environment variables for the whole job | |
LOGZIO_API_URL: https://api.logz.io | |
LOGZIO_API_TOKEN: ${{ secrets.LOGZIO_API_TOKEN }} | |
RULES_DS: ${{ secrets.RULES_DS }} | |
RULES_CONFIGMAP_ANNOTATION: prometheus.io/kube-rules | |
ALERTMANAGER_CONFIGMAP_ANNOTATION: prometheus.io/kube-alertmanager | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Install Kind | |
run: | | |
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.11.1/kind-Linux-amd64" | |
chmod +x ./kind | |
mv ./kind /usr/local/bin/kind | |
- name: Create a Kubernetes cluster | |
run: | | |
kind create cluster | |
kubectl cluster-info | |
- name: Create namespace | |
run: | | |
kubectl create namespace alert-migrator-test | |
- name: Get dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -v ./... -coverprofile=coverage.out | |
- name: Extract coverage percentage | |
run: go tool cover -func=coverage.out | grep total | awk '{print $3}' | |