From 3295e143a22b9a4de8388fd698773be6a89f424e Mon Sep 17 00:00:00 2001 From: Jahvon Dockery Date: Fri, 6 Oct 2023 20:55:34 -0400 Subject: [PATCH] cleanup repo docs and workflows (#17) --- .github/ISSUE_TEMPLATE/00-bug_report.yaml | 32 +---- .github/ISSUE_TEMPLATE/01-enhancement.yaml | 20 +++ .../ISSUE_TEMPLATE/01-feature_request.yaml | 45 ------- .github/pull_request_template.md | 21 +-- .github/workflows/greetings.yaml | 63 --------- .github/workflows/release.yaml | 39 +++--- internal/.golangci.yaml => .golangci.yaml | 0 .goreleaser.yaml | 127 ------------------ DEVELOPMENT.md | 12 ++ Dockerfile | 31 ----- Makefile | 12 +- README.md | 111 ++++++++------- go.mod | 2 +- go.sum | 4 + internal/config/root.go | 2 +- 15 files changed, 120 insertions(+), 401 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/01-enhancement.yaml delete mode 100644 .github/ISSUE_TEMPLATE/01-feature_request.yaml delete mode 100644 .github/workflows/greetings.yaml rename internal/.golangci.yaml => .golangci.yaml (100%) delete mode 100644 .goreleaser.yaml create mode 100644 DEVELOPMENT.md delete mode 100644 Dockerfile diff --git a/.github/ISSUE_TEMPLATE/00-bug_report.yaml b/.github/ISSUE_TEMPLATE/00-bug_report.yaml index 467d38a..ceaafce 100644 --- a/.github/ISSUE_TEMPLATE/00-bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/00-bug_report.yaml @@ -4,39 +4,13 @@ labels: [bug, triage] assignees: - jahvon body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! Please fill the form below. - - type: textarea - id: what-happened - attributes: - label: What happened? - description: Also tell us, what did you expect to happen? - validations: - required: true - type: textarea - id: reproducible + id: summary attributes: - label: How can we reproduce this? - description: Please share a public repository that reproduces the issue, or an example config file. Links to failing goreleaser runs and etc are also helpful. + label: Bug Summary + description: A clear and concise description of what the bug is. What happened, and what did you expect to happen? validations: required: true - - type: textarea - id: version - attributes: - label: flow version - description: "`flow version` output" - render: bash - validations: - required: true - - type: checkboxes - id: search - attributes: - label: Search - options: - - label: I did search for other open and closed issues before opening this. - required: true - type: textarea id: ctx attributes: diff --git a/.github/ISSUE_TEMPLATE/01-enhancement.yaml b/.github/ISSUE_TEMPLATE/01-enhancement.yaml new file mode 100644 index 0000000..7845d6f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01-enhancement.yaml @@ -0,0 +1,20 @@ +name: Enhancement +description: Document a new feature idea or other project enhancement +labels: [enhancement, triage] +assignees: + - jahvon +body: + - type: textarea + id: summary + attributes: + label: Enhancement Summary + description: A clear and concise description of what the enhancement is. What is the desired outcome of this enhancement? + validations: + required: true + - type: textarea + id: ctx + attributes: + label: Additional context + description: Anything else you would like to add + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/01-feature_request.yaml b/.github/ISSUE_TEMPLATE/01-feature_request.yaml deleted file mode 100644 index a93e773..0000000 --- a/.github/ISSUE_TEMPLATE/01-feature_request.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Feature Request -description: Request a new feature and/or enhancement to an existing feature -labels: [enhancement, triage] -assignees: - - jahvon -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this feature request! Please fill the form below. - - type: textarea - id: is-it-a-problem - attributes: - label: Is your feature request related to a problem? Please describe. - description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - validations: - required: true - - type: textarea - id: solution - attributes: - label: Describe the solution you'd like - description: A clear and concise description of what you want to happen. - validations: - required: true - - type: textarea - id: alternatives - attributes: - label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. - validations: - required: false - - type: checkboxes - id: search - attributes: - label: Search - options: - - label: I did search for other open and closed issues before opening this. - required: true - - type: textarea - id: ctx - attributes: - label: Additional context - description: Anything else you would like to add - validations: - required: false diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 710558d..5bef6ec 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,23 +1,14 @@ - +# Summary -# Description +...enter summary here... - +## Notable Changes -Fixes # +- ...enter notable changes here... +- ...enter notable changes here... -## Type of change +## Change Type - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] This change requires a documentation update - -# Checklist: - -- [ ] I have performed a self-review of my code -- [ ] I have made corresponding changes to the documentation -- [ ] My changes generate no new warnings -- [ ] I have added tests that prove my fix is effective or that my feature works diff --git a/.github/workflows/greetings.yaml b/.github/workflows/greetings.yaml deleted file mode 100644 index 5c65eb9..0000000 --- a/.github/workflows/greetings.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: Acknowledge - -on: - issues: - types: [opened] - pull_request: - branches: [main] - types: [opened] - -jobs: - greeting: - runs-on: ubuntu-latest - - steps: - - name: Comment pull request - uses: actions/github-script@v6 - if: github.event_name == 'pull_request' || github.user.login != 'jahvon' || github.user.login != 'dependabot[bot]' - with: - # Comment as whoever you want using `secrets.TAP_GITHUB_TOKEN` or GitHub bot if not set. - github-token: ${{ secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - let output = `Hello! - - Thank you for your contribution to [flow](https://github.com/jahvon/flow). - If you are fixing a bug, please reference the issue number in the description. - - I will try to review your contribution as soon as possible. - - Thanks, - Jahvon - ` - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) - - - name: Comment issue - uses: actions/github-script@v6 - if: github.event_name != 'pull_request' || github.user.login != 'jahvon' || github.user.login != 'dependabot[bot]' - with: - # Comment as whoever you want using `secrets.TAP_GITHUB_TOKEN` or GitHub bot if not set. - github-token: ${{ secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - let output = `:wave: Hello! - - Thank you for filing an issue. - If this is a bug report, please include relevant logs to help me debug the problem. - - I will work on this as soon as possible. - - Thanks, - Jahvon - ` - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e904024..9b22846 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,31 +1,26 @@ -name: Goreleaser +name: Release Binaries on: push: tags: - - "v[0-9]+.[0-9]+.[0-9]+*" + - "*" jobs: - goreleaser: + releases-matrix: + name: Release Go Binary runs-on: ubuntu-latest - env: - FURY_TOKEN: ${{ secrets.FURY_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} + strategy: + matrix: + # build and publish in parallel: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 + goos: [linux, darwin] + goarch: [amd64, arm64] + steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "^1.20.6" - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + - uses: actions/checkout@v3 + - uses: wangyoucao577/go-release-action@v1 with: - distribution: goreleaser - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "1.21" + extra_files: LICENSE README.md \ No newline at end of file diff --git a/internal/.golangci.yaml b/.golangci.yaml similarity index 100% rename from internal/.golangci.yaml rename to .golangci.yaml diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index d73577e..0000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,127 +0,0 @@ -env: - - GO111MODULE=auto - -before: - hooks: - - go mod tidy - - go generate ./... - - ./scripts/completions.sh - -builds: - - env: - - CGO_ENABLED=0 - goos: - - linux - - darwin - goarch: - - amd64 - - arm64 - goarm: - - "7" - mod_timestamp: "{{ .CommitTimestamp }}" - flags: - - -trimpath - ldflags: - - -s -w - -universal_binaries: - - replace: false - -checksum: - name_template: "checksums.txt" - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" - - "^chore:" - - "^Merge pull request" - - "^Merge branch" - -archives: - - name_template: >- - {{ .ProjectName }}_ - {{- .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - format_overrides: - - goos: windows - format: zip - files: - - README.md - - LICENSE - - completions/* - -brews: - - repository: - owner: jahvon - name: homebrew-tap - token: "{{ .Env.TAP_GITHUB_TOKEN }}" - goarm: "7" - homepage: https://github.com/jahvon/flow - description: Configurable local workflow manager. - license: Apache 2.0 - test: | - system "#{bin}/flow version" - dependencies: - - name: go - type: optional - install: |- - bin.install "flow" - bash_completion.install "completions/flow.bash" => "flow" - zsh_completion.install "completions/flow.zsh" => "_flow" - fish_completion.install "completions/flow.fish" - -nfpms: - - file_name_template: "{{ .ConventionalFileName }}" - id: packages - homepage: https://github.com/jahvon/flow - description: Configurable local workflow manager. - maintainer: Jahvon Dockery - license: Apache 2.0 - vendor: jahvon - bindir: /usr/bin - section: utils - contents: - - src: ./completions/flow.bash - dst: /usr/share/bash-completion/completions/flow - file_info: - mode: 0644 - - src: ./completions/flow.fish - dst: /usr/share/fish/vendor_completions.d/flow.fish - file_info: - mode: 0644 - - src: ./completions/flow.zsh - dst: /usr/share/zsh/vendor-completions/_flow - file_info: - mode: 0644 - - src: ./LICENSE - dst: /usr/share/doc/flow/copyright - file_info: - mode: 0644 - formats: - - apk - - deb - - rpm - - archlinux - recommends: - - golang - deb: - lintian_overrides: - - statically-linked-binary - - changelog-file-missing-in-native-package - -publishers: - - name: fury.io - ids: - - packages - env: - - "FURY_TOKEN={{ .Env.FURY_TOKEN }}" - cmd: ./scripts/fury-upload.sh {{ .ArtifactName }} - -release: - footer: | - **Full Changelog**: https://github.com/jahvon/flow/compare/{{ .PreviousTag }}...{{ .Tag }} diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..76959e5 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,12 @@ +# flow Development + +`flow` is written in [Go](https://golang.org/). + +The following `make` commands are available: + +| | Make Command | +|--------------------------------|-------------------| +| **Install Local Dependencies** | `make local/deps` | +| **Build** | `make go/build` | +| **Test** | `make go/test` | +| **Pre-commit** | `make pre-commit` | diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index aeb936d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -ARG GO_VERSION=1.20 - -# Build stage -FROM golang:${GO_VERSION} AS builder - -ARG GIT_COMMIT -ARG VERSION - -ENV GO111MODULE=auto -ENV CGO_ENABLED=0 - -WORKDIR $GOPATH/src/github.com/jahvon/pilotcli -COPY go.mod go.sum ./ -RUN go mod download -COPY . . -RUN make go/build -RUN echo "nonroot:x:65534:65534:Non root:/:" > /etc_passwd - - -# Final stage -FROM scratch - -LABEL maintainer="Jahvon Dockery " - -COPY --from=builder /go/bin/pilotcli /bin/pilotcli -COPY --from=builder /etc_passwd /etc/passwd - -USER nonroot - -ENTRYPOINT [ "pilotcli" ] -CMD [ "version" ] diff --git a/Makefile b/Makefile index a400674..20ffdcb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -IMAGE_NAME=jahvon/flow BIN_NAME=flow BIN_PATH=${GOPATH}/bin -GO_VERSION=1.20 +GO_VERSION=1.21.1 default: help @@ -24,19 +23,10 @@ go/build: go generate ./... go build -o ${BIN_PATH}/${BIN_NAME} -## Compile optimized for alpine linux. -docker/build: - @echo "building image ${IMAGE_NAME}" - docker build --build-arg GO_VERSION=${GO_VERSION} -t $(IMAGE_NAME):latest . - ## Make sure everything is ok before a commit pre-commit: go/test go fmt ./... -## Test the goreleaser configuration locally. -goreleaser/test: - goreleaser --snapshot --skip-publish --rm-dist - ## Print his help screen help: @printf "Available targets:\n\n" diff --git a/README.md b/README.md index ed42c26..fa94195 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,72 @@ # flow - Local, CLI Workflow Manager -

- - GitHub release (latest SemVer including pre-releases) - - - - goreleaser - - - - Go reference - - - - License Apache 2.0 - - -
- - - - - - - codeql - - - - Go report card - -

-
+## Configuration and Workflow Definition Files + +`flow` uses a configuration file to define the workspaces and workflows that it manages. +The location for this flow configuration file is `~/.flow/config.yaml`. Below is an example of a flow configuration file. + +```yaml +currentWorkspace: workspace1 +workspaces: + workspace1: /path/to/workspace1 + workspace2: /path/to/workspace2 +backends: + secret: + backend: envFile + auth: + backend: keyring + preferredMode: password + rememberMe: true + rememberDuration: 24h +``` -## Development +Workflows can be defined anywhere within a workspace's directory with the `.flow` file extension. +Below is an example of a workflow definition file. + +```yaml +namespace: ns +tags: + - example +executables: + - type: open + name: config + tags: + - config + description: open flow config in vscode + spec: + args: + - ~/.flow + application: code +``` -### Dependencies +Running `flow open ns:config` will run the above workflow. -`flow` is written in [Go](https://golang.org/). +## CLI Usage -Prerequisites: +```bash +flow [command] +``` -- [Go 1.20+](https://golang.org/doc/install) +### Available Commands -Other local dependencies can be installed with: +**Updating configs and data used by `flow`** -```sh -make local/deps -``` +- `flow get` - Get current value of various configuration options and data +- `flow set` - Update various configuration options and data +- `flow create` - Create ... +- `flow delete` - Delete ... +- `flow login` - Login to auth backend. This is needed only when an auth backend is set. -### Build / Testing +**Executing workflows** -```sh -make go/build -``` +- `flow run` - Run a workflow +- `flow open` - Open a workflow in the browser -```sh -make go/test -``` +**Autocompletion** -### Pre-commit +- `flow completion` - Generate shell autocompletion for `flow` -```sh -make pre-commit -``` +Example autocompletion setup script: `flow completion zsh > ~/.oh-my-zsh/completions/_flow` ## Install @@ -147,7 +150,3 @@ $ go install ``` - -## Credits - -Repository initially generated with [thazelart/golang-cli-template](https://github.com/thazelart/golang-cli-template). diff --git a/go.mod b/go.mod index d35283c..747870e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jahvon/flow -go 1.20 +go 1.21 require ( github.com/fatih/color v1.15.0 diff --git a/go.sum b/go.sum index 636c622..184006c 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,7 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= @@ -59,6 +60,7 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -67,6 +69,7 @@ github.com/zalando/go-keyring v0.2.3/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51D golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -83,6 +86,7 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/config/root.go b/internal/config/root.go index 8c4d12b..4f70ed6 100644 --- a/internal/config/root.go +++ b/internal/config/root.go @@ -65,7 +65,7 @@ func (c *RootConfig) setCurrentWorkspaceConfig() error { func LoadConfig() *RootConfig { if err := common.EnsureDataDir(); err != nil { - log.Fatal().Err(err).Msg("encountered issue with backend directory") + log.Fatal().Err(err).Msg("encountered issue with flow data directory") } var config *RootConfig