Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out collection framework into its own module #102

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions .github/workflows/pre_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,33 @@ jobs:
version: v1.52.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
working-directory: collector-framework

# Optional: golangci-lint command line arguments.
args: --timeout=5m0s

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true


- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.52.2

# Optional: working directory, useful for monorepos
working-directory: tgm-collector

# Optional: golangci-lint command line arguments.
args: --timeout=5m0s
Expand Down Expand Up @@ -59,11 +85,18 @@ jobs:
uses: actions/checkout@v3

- name: Set up ginkgo
working-directory: collector-framework
run: make install-tools

- name: Run package tests
- name: Run collector-framework package tests
working-directory: collector-framework
run: ginkgo pkg/...

- name: Run tgm-collector package tests
working-directory: tgm-collector
run: ginkgo pkg/...


yamllint:
name: Lint YAML files
runs-on: ubuntu-latest
Expand Down
27 changes: 16 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ repos:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
types:
- python

- repo: local
hooks:
- id: license-header
Expand All @@ -23,13 +16,25 @@ repos:
pass_filenames: false

- id: golangci-lint
name: golangci-lint must pass
name: golangci-lint (tgm-collector) must pass
language: system
entry: bash -c 'cd tgm-collector && make lint'
pass_filenames: false

- id: go-mod-tidy
name: run go mod tidy (tgm-collector)
language: system
entry: bash -c 'cd tgm-collector && go mod tidy'
pass_filenames: false

- id: golangci-lint
name: golangci-lint (collector-framework) must pass
language: system
entry: make lint
entry: bash -c 'cd collector-framework && make lint'
pass_filenames: false

- id: go-mod-tidy
name: run go mod tidy
name: run go mod tidy (collector-framework)
language: system
entry: go mod tidy
entry: bash -c 'cd collector-framework && go mod tidy'
pass_filenames: false
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions collector-framework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Collector framework

This is a framework for making it easier for people to build collectors.
It provides a basic framework just create your collector, register it,
then trigger the runner from a entry point of your choice.

See `tgm-collectors` for an example.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ package collectors
import (
"fmt"

"github.com/redhat-partner-solutions/vse-sync-collection-tools/pkg/callbacks"
"github.com/redhat-partner-solutions/vse-sync-collection-tools/collector-framework/pkg/callbacks"
)
const (
AnnouncementCollectorName = "MyCustomerAnouncer"
Expand Down
4 changes: 1 addition & 3 deletions go.mod → collector-framework/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/redhat-partner-solutions/vse-sync-collection-tools
module github.com/redhat-partner-solutions/vse-sync-collection-tools/collector-framework

go 1.18

Expand Down Expand Up @@ -37,15 +37,13 @@ require (
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openshift/api v0.0.0-20230120195050-6ba31fa438f2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
Expand Down
Loading
Loading