Skip to content

Commit

Permalink
Merge pull request #33 from Aijeyomah/update-snapshot-payload
Browse files Browse the repository at this point in the history
update payload to generate snapshot
  • Loading branch information
leecalcote authored Oct 9, 2024
2 parents 6e7df7a + d73b79b commit c27fdea
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 127 deletions.
63 changes: 63 additions & 0 deletions .github/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
project_name: kanvas-snapshot
version: 2
before:
hooks:
- go mod tidy

builds:
- main: cmd/kanvas-snapshot/main.go

env:
- CGO_ENABLED=0

ldflags:
- -s -w
- -X main.providerToken={{.Env.PROVIDER_TOKEN}}
- -X main.MesheryCloudApiBaseUrl="https://meshery.layer5.io"
- -X main.MesheryApiBaseUrl="https://playground.meshery.io"

goos:
- darwin
- linux
- windows

goarch:
- 386
- amd64
- arm
- arm64

ignore:
- goos: windows
goarch: arm
- goos: windows
goarch: arm64

archives:
- id: stable
name_template: >-
{{ .ProjectName }}_{{.Version}}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format: tar.gz
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'checksums.txt'

snapshot:
version_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
name_template: "Helm Kanvas Snapshot {{.Tag}}"
15 changes: 4 additions & 11 deletions .github/workflows/build-and-release-snapshot-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_CHANNEL: "stable"
MESHERY_CLOUD_API_COOKIE: ${{ secrets.MESHERY_CLOUD_API_COOKIE }}
MESHERY_API_COOKIE: ${{ secrets.MESHERY_API_COOKIE }}
OWNER: ${{ secrets.OWNER }}
REPO: ${{ secrets.REPO }}
WORKFLOW: ${{ secrets.WORKFLOW }}
BRANCH: ${{ secrets.BRANCH }}
MESHERY_CLOUD_API_BASE_URL: ${{ secrets.MESHERY_CLOUD_API_BASE_URL }}
MESHERY_API_BASE_URL: ${{ secrets.MESHERY_API_BASE_URL }}
SYSTEM_ID: ${{ secrets.SYSTEM_ID }}
PROVIDER_TOKEN: ${{ secrets.PROVIDER_TOKEN }}

with:
version: '~> v2'
args: release --clean --skip-validate
version: 2
args: release --clean --skip validate -f .github/.goreleaser.yml
92 changes: 92 additions & 0 deletions .github/workflows/go-testing-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: goreleaser WITHOUT tag
uses: goreleaser/goreleaser-action@v5
uses: goreleaser/goreleaser-action@v6
if: success() && startsWith(github.ref, 'refs/tags/') == false
env:
RELEASE_CHANNEL: "edge"
with:
version: latest
args: release --snapshot --skip-publish --clean
version: 2
args: release --snapshot --skip publish --clean -f .github/.goreleaser.yml
46 changes: 0 additions & 46 deletions .github/workflows/meshmap.yml

This file was deleted.

15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ include build/Makefile.core.mk
.PHONY: all
all: dep-check build
## Lint check
# golangci: error dep-check
# golangci-lint run --exclude-use-default
golangci: error dep-check
golangci-lint run --exclude-use-default

## Analyze error codes
error: dep-check
Expand Down Expand Up @@ -58,16 +58,9 @@ BINNAME_WINDOWS ?= kanvas-snapshot-windows-$(ARCH).exe


LDFLAGS := "\
-X 'main.GithubToken=$(GITHUB_TOKEN)' \
-X 'main.MesheryCloudApiCookie=$(MESHERY_CLOUD_API_COOKIES)' \
-X 'main.MesheryApiCookie=$(MESHERY_API_COOKIES)' \
-X 'main.Owner=$(OWNER)' \
-X 'main.Repo=$(REPO)' \
-X 'main.Workflow=$(WORKFLOW)' \
-X 'main.Branch=$(BRANCH)' \
-X 'main.providerToken=$(PROVIDER_TOKEN)' \
-X 'main.MesheryCloudApiBaseUrl=$(MESHERY_CLOUD_API_BASE_URL)' \
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)' \
-X 'main.SystemID=$(SYSTEM_ID)'"
-X 'main.MesheryApiBaseUrl=$(MESHERY_API_BASE_URL)'"

.PHONY: build
build:
Expand Down
11 changes: 2 additions & 9 deletions build/Makefile.core.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
GOVERSION = 1.23
GITHUB_TOKEN=""
MESHERY_API_COOKIE=""
MESHERY_CLOUD_API_COOKIE=""
OWNER="Aijeyomah"
REPO="Ng-depl"
WORKFLOW="meshmap.yml"
BRANCH="new-mesh"
PROVIDER_TOKEN="dev_token"
MESHERY_CLOUD_API_BASE_URL="http://localhost:9876"
MESHERY_API_BASE_URL="http://localhost:9081"
SYSTEM_ID="3ae41e77-5626-42d3-aa04-ee871ad3035c"
MESHERY_API_BASE_URL="http://localhost:3000"
Loading

0 comments on commit c27fdea

Please sign in to comment.