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 b411c79..22ec82c 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/jahvon/flow go 1.21 -toolchain go1.21.0 +toolchain go1.21.1 require ( github.com/fatih/color v1.15.0 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