Install script enhancement #69
Workflow file for this run
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: Golang Unit and Integration Tests | |
on: | |
push: | |
branches: | |
- "master" | |
paths: | |
- "**.go" | |
pull_request: | |
branches: | |
- "master" | |
paths: | |
- "**.go" | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: "Log level" | |
required: true | |
default: "warning" | |
jobs: | |
golangci: | |
strategy: | |
matrix: | |
go: [1.21] | |
os: [ubuntu-22.04] | |
name: golangci-lint | |
if: github.repository == 'meshery/helm-kanvas-snapshot' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: false | |
- uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59 | |
args: --config=.golangci.yml --timeout=10m | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-22.04 | |
needs: golangci | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Run coverage | |
run: go test --short ./... -race -coverprofile=coverage.txt -covermode=atomic | |
- name: Upload coverage to Codecov | |
if: github.repository == 'meshery/helm-kanvas-snapshot' | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.txt | |
flags: unittests | |
integration-tests: | |
name: Integration tests | |
runs-on: ubuntu-22.04 | |
needs: golangci | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Create k8s Kind Cluster | |
uses: helm/kind-action@v1.10.0 | |
with: | |
cluster_name: "kind-cluster" | |
- name: Run coverage | |
run: | |
# TODO: add tests for snapshot | |
echo "Running kanvas snapshot test completed." | |
- name: Upload coverage to Codecov | |
if: github.repository == 'meshery/helm-kanvas-snapshot' | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.txt | |
flags: gointegrationtests |