Skip to content

Commit

Permalink
Fix #203 - Update parsers to DSL 1.0.0 (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardozanini authored Jan 22, 2025
1 parent b9ff81b commit ff500a0
Show file tree
Hide file tree
Showing 216 changed files with 7,655 additions and 22,749 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/Go-SDK-Check-k8s-integration.yaml

This file was deleted.

77 changes: 61 additions & 16 deletions .github/workflows/Go-SDK-PR-Check.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2020 The Serverless Workflow Specification Authors
# Copyright 2025 The Serverless Workflow Specification Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -13,6 +13,7 @@
# limitations under the License.

name: Go SDK PR Checks

on:
pull_request:
paths-ignore:
Expand All @@ -23,24 +24,28 @@ on:
branches:
- main


permissions:
contents: read

env:
GO_VERSION: 1.22

jobs:
basic_checks:
name: Basic Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go ${{ env.GO_VERSION }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Cache dependencies

- name: Cache Go Modules
uses: actions/cache@v4
with:
path: |
Expand All @@ -49,33 +54,73 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache tools
- name: Cache Tools
uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tools-${{ hashFiles('**/tools.sum') }}
restore-keys: |
${{ runner.os }}-go-tools-
- name: Check Headers
run: |
make addheaders
changed_files=$(git status -s | grep -v 'go.mod\|go.sum\|tools.mod\|tools.sum' || :)
[[ -z "$changed_files" ]] || (printf "Some files are missing the headers: \n$changed_files\n Did you run 'make lint' before sending the PR" && exit 1)
- name: Check DeepCopy Generation
run: |
export GOPATH=$(go env GOPATH)
make deepcopy
if [[ -n "$changed_files" ]]; then
echo "❌ Some files are missing headers:\n$changed_files"
exit 1
fi
- name: Check Formatting
run: |
make fmt
changed_files=$(git status -s | grep -v 'go.mod\|go.sum\|tools.mod\|tools.sum' || :)
[[ -z "$changed_files" ]] || (printf "Some files are not formatted properly: \n$changed_files\n Did you run 'make test' before sending the PR?" && exit 1)
- name: Check lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 - Please ALWAYS use SHA to avoid GH sec issues
if [[ -n "$changed_files" ]]; then
echo "❌ Some files are not formatted correctly:\n$changed_files"
exit 1
fi
- name: Run Linter
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.1.1 - Please ALWAYS use SHA to avoid GH sec issues
with:
version: latest
- name: Install cover
run: go get -modfile=tools.mod golang.org/x/tools/cmd/cover

- name: Install Cover Tool
run: go install golang.org/x/tools/cmd/cover@latest

- name: Run Unit Tests
run: go test ./... -coverprofile=test_coverage.out -covermode=atomic

- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: Test Coverage Report
path: test_coverage.out

integration_tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: basic_checks
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
id: go

- name: Run Integration Tests
run: |
go test ./... -coverprofile test_coverage.out -covermode=atomic
chmod +x ./hack/integration-test.sh
./hack/integration-test.sh
continue-on-error: true

- name: Upload JUnit Report
if: always()
uses: actions/upload-artifact@v3
with:
name: Integration Test JUnit Report
path: ./integration-test-junit.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin
*.out
.vscode

integration-test-junit.xml
42 changes: 6 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,14 @@ lint:
.PHONY: test
coverage="false"

test: deepcopy buildergen
test:
@echo "πŸ§ͺ Running tests..."
@go test ./...
@echo "βœ… Tests completed!"

deepcopy: $(DEEPCOPY_GEN) ## Download deepcopy-gen locally if necessary.
@echo "πŸ“¦ Running deepcopy-gen..."
@./hack/deepcopy-gen.sh deepcopy > /dev/null
@make lint
@echo "βœ… Deepcopy generation and linting completed!"

buildergen: $(BUILDER_GEN) ## Download builder-gen locally if necessary.
@echo "πŸ“¦ Running builder-gen..."
@./hack/builder-gen.sh buildergen > /dev/null
@make lint
@echo "βœ… Builder generation and linting completed!"

.PHONY: kube-integration
kube-integration: controller-gen
@echo "πŸ“¦ Generating Kubernetes objects..."
@$(CONTROLLER_GEN) object:headerFile="./hack/boilerplate.txt" paths="./kubernetes/api/..."
@echo "πŸ“¦ Generating Kubernetes CRDs..."
@$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./kubernetes/..." output:crd:artifacts:config=config/crd/bases
@make lint
@echo "βœ… Kubernetes integration completed!"


####################################
# install controller-gen tool
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

CONTROLLER_TOOLS_VERSION ?= v0.16.3
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
.PHONY: integration-test

integration-test:
@echo "πŸ”„ Running integration tests..."
@./hack/integration-test.sh
@echo "βœ… Integration tests completed!"
Loading

0 comments on commit ff500a0

Please sign in to comment.