Skip to content

Fix tests

Fix tests #197

Workflow file for this run

on: [push]
name: CI
jobs:
test:
name: "test"
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
strategy:
matrix:
go-version: [1.21.x]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
- name: Execute tests
run: |
go mod download
go mod verify
make test
k8s:
name: "k8s"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}/${{ github.repository }}
- name: Start minikube
id: minikube
uses: medyagh/setup-minikube@latest
- name: Build image
run: |
eval $(minikube -p minikube docker-env) && \
make docker-build && \
echo "docker_image=$(docker images --format '{{.Repository}}:{{.Tag}}' | head -n 1)" >> "$GITHUB_ENV"
working-directory: ${{ github.workspace }}/${{ github.repository }}
- name: Create pod
run: |
echo "Running ${{ env.docker_image }}" && \
kubectl run calls-offloader --image="${{ env.docker_image }}" \
--env="LOGGER_CONSOLELEVEL=debug" --env="LOGGER_ENABLEFILE=false" --env="JOBS_APITYPE=kubernetes"
working-directory: ${{ github.workspace }}/${{ github.repository }}
- name: Show logs
run: sleep 4s && kubectl logs calls-offloader
- name: Check pod is running
run: test $(kubectl get pods calls-offloader -o jsonpath='{.status.phase}') = "Running"