diff --git a/.codespell-ignores b/.ci/linters/.codespell-ignores similarity index 100% rename from .codespell-ignores rename to .ci/linters/.codespell-ignores diff --git a/.github/linters/.commitlintrc.json b/.ci/linters/.commitlintrc.json similarity index 100% rename from .github/linters/.commitlintrc.json rename to .ci/linters/.commitlintrc.json diff --git a/.github/linters/.eslintignore b/.ci/linters/.eslintignore similarity index 100% rename from .github/linters/.eslintignore rename to .ci/linters/.eslintignore diff --git a/.ci/linters/.eslintrc.js b/.ci/linters/.eslintrc.js new file mode 100644 index 0000000..41d2518 --- /dev/null +++ b/.ci/linters/.eslintrc.js @@ -0,0 +1,28 @@ +module.exports = { + parser: "@typescript-eslint/parser", + env: { + node: true, + es2021: true + }, + parserOptions: { + ecmaVersion: 6, + sourceType: "module" // Allows for the use of imports + }, + extends: [ + "plugin:prettier/recommended", + "plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin + "plugin:import/warnings" + ], + plugins: ["@typescript-eslint"], + rules: { + "@typescript-eslint/semicolon": "off", + "@typescript-eslint/member-delimiter-style": "off", + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/semi": "off", + "no-throw-literal": "warn", + curly: "warn", + eqeqeq: "warn", + semi: "off" + }, + ignorePatterns: ["**/*.d.ts"] +} diff --git a/.github/linters/.gitleaks.toml b/.ci/linters/.gitleaks.toml similarity index 87% rename from .github/linters/.gitleaks.toml rename to .ci/linters/.gitleaks.toml index 5b1a1b0..c220305 100644 --- a/.github/linters/.gitleaks.toml +++ b/.ci/linters/.gitleaks.toml @@ -160,27 +160,10 @@ title = "gitleaks config" description = "ignore value fake" regexes = [ '''host=HOST''', + '''--private-key={{.PRIVATE_KEY_FILE}}''', + '''PASSWORD=XXXXXX''', ] -[[rules]] - description = "Email" - regex = '''[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}''' - tags = ["email"] - [rules.allowlist] - description = "ignore emails" - regexes = [ - '''[a-zA-Z0-9._%+-]+@users.noreply.github.com''', - '''[a-zA-Z0-9._%+-]+@yopmail.com''', - '''git@github.com''', - '''git@gitlab.com''', - '''slovacus@gmail.com''', - '''luis@hadenlabs.com''', - '''hola@hadenlabs.com''', - '''hello@hadenlabs.com''', - '''support@hadenlbas.com''', - '''support@hadenlabs.com''', - '''dum-u@hadenlabs.com''', - ] [[rules]] description = "High Entropy" @@ -222,29 +205,57 @@ title = "gitleaks config" description = "Files with keys and credentials" file = '''(?i)(id_rsa|passwd|id_rsa.pub|pgpass)$''' tags = ["key", "files"] + [rules.allowlist] + description = "ignore some" + files = ['''(.*pub|env)$'''] [[rules]] description = "Extension Files with keys and credentials" file = '''(.*?)(pub|pem|ppk|key)$''' tags = ["key", "files"] + [rules.allowlist] + description = "ignore file test" + files = [ + '''.*-test.*$''', + ] # Global allowlist [allowlist] description = "Whitelisted files" - files = [ - '''(.*?)(jpg|gif|png|doc|pdf|bin|mp3|mp4|mov|ttf|woff|woff2|eot|lock)$''', - '''^\.gitignore$''', - '''^\.gitleaks.toml$''', - '''^yarn.lock$''', - '''^vendor/(.*?)$''', - '''^node_modules/(.*?)$''', - ] + paths = [ + '''^vendor/''', + '''^bower_components/''', + '''^public/''', + '''^node_modules/''', + '''^theme/''', + ] + files = [ + '''(.*?)(jpg|gif|png|doc|pdf|bin|mp3|mp4|mov|ttf|woff|woff2|eot|lock)$''', + '''^\.gitignore$''', + '''^\.gitleaks.toml$''', + '''^yarn.lock$''', + '''^vendor/(.*?)$''', + '''^sonar-project.properties$''', + '''^node_modules/(.*?)$''', + ] + commits = [] [whitelist] description = "image and html allowlists" - files = [ + paths = [ + '''^vendor/''', + '''^bower_components/''', + '''^public/''', + '''^node_modules/''', + '''^theme/''', + ] + files = [ '''(.*?)(jpg|gif|png|doc|pdf|bin|mp3|mp4|mov|ttf|woff|woff2|eot|lock)$''', + '''^\.gitignore$''', '''^\.gitleaks.toml$''', '''^\.gitignore$''', '''^yarn.lock$''', + '''^sonar-project.properties$''', ] + + commits = [] diff --git a/.github/linters/.golangci.yml b/.ci/linters/.golangci.yml similarity index 96% rename from .github/linters/.golangci.yml rename to .ci/linters/.golangci.yml index 398ea9b..2a88814 100644 --- a/.github/linters/.golangci.yml +++ b/.ci/linters/.golangci.yml @@ -99,6 +99,7 @@ linters: - unconvert - misspell - nakedret + - unused presets: - bugs @@ -113,6 +114,17 @@ linters: - goerr113 - scopelint - golint + - bodyclose + - contextcheck + - nilerr + - noctx + - rowserrcheck + - sqlclosecheck + - structcheck + - unparam + - deadcode + - varcheck + - asasalint # Drives todos nuts - godox diff --git a/.ci/linters/.goreleaser.yml b/.ci/linters/.goreleaser.yml new file mode 100644 index 0000000..7b9af07 --- /dev/null +++ b/.ci/linters/.goreleaser.yml @@ -0,0 +1,73 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +project_name: zsh-rvm +env: + - GO111MODULE=on + - REPO=github.com/hadenlabs/zsh-rvm +before: + hooks: + - go mod download + - go mod tidy + - go mod vendor + - go generate ./... + +# https://goreleaser.com/build/ +builds: + # Defaults to the project name. + - id: default + # ID of the build. + env: + - CGO_ENABLED=0 + ldflags: + - -s -w + - -X "{{.Env.REPO}}/cmd.Version={{.Version}}" + - -X "{{.Env.REPO}}/cmd.Commit={{.FullCommit}}" + - -X "{{.Env.REPO}}/cmd.RepoURL={{.GitURL}}" + - -X "{{.Env.REPO}}/cmd.BuildDate={{.Date}}" + - -X "{{.Env.REPO}}/cmd.BuiltWithGoVersion={{.Env.GO_VERSION}}" + - -X "{{.Env.REPO}}/cmd.BuiltBy={{.Env.BUILT_BY}}" + goos: + - darwin + - linux + goarch: + - amd64 +archives: + - replacements: + darwin: Darwin + linux: Linux + amd64: x86_64 + builds: + - default + wrap_in_directory: true + name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}" + format: tar.gz + format_overrides: + - goos: windows + format: zip + files: + - LICENSE + - README.md + - CHANGELOG.md + - config/**/* + - systemd/* +# https://goreleaser.com/snapshots/ +snapshot: + name_template: "dev@{{.ShortCommit}}" + +# https://goreleaser.com/checksum/ +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" + algorithm: sha256 +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" +release: + github: + owner: hadenlabs + name: zsh-rvm + draft: true + prerelease: auto + name_template: "{{.ProjectName}}-v{{.Version}}-{{.ShortCommit}}-{{.Date}}" diff --git a/.ci/linters/.hadolint.yaml b/.ci/linters/.hadolint.yaml new file mode 100644 index 0000000..2dc085f --- /dev/null +++ b/.ci/linters/.hadolint.yaml @@ -0,0 +1,12 @@ +ignored: + - DL3008 # Pin versions in apt get install. Instead of `apt-get install ` use `apt-get install =` + - DL3013 # Pin versions in pip. Instead of `pip install ` use `pip install ==` + - DL3016 # Pin versions in npm. Instead of `npm install ` use `npm install @ + - DL3018 # Pin versions in apk add. Instead of `apk add ` use `apk add = + - DL3028 # Pin versions in gem install. Instead of `gem install ` use `gem install :` + + - SC2086 # info: Double quote to prevent globbing and word splitting. + + # temp + + - DL4006 # Set the SHELL option -o pipefail before RUN with a pipe in it diff --git a/.github/linters/.lintstagedrc.js b/.ci/linters/.lintstagedrc.js similarity index 51% rename from .github/linters/.lintstagedrc.js rename to .ci/linters/.lintstagedrc.js index 426f4d7..3e5b49a 100644 --- a/.github/linters/.lintstagedrc.js +++ b/.ci/linters/.lintstagedrc.js @@ -1,10 +1,10 @@ -const escape = require('shell-quote').quote +const escape = require("shell-quote").quote module.exports = { - '*.{ts,tsx,js,json,css}': (filenames) => [ + "*.{ts,tsx,js,json,css}": (filenames) => [ ...filenames.map((filename) => `prettier --check "${escape([filename])}"`), ...filenames.map((filename) => `git add "${filename}"`) ], - '*.{ts,tsx,js,jsx}': ['eslint'], - '*.{ts,tsx,css}': ['stylelint'] + "*.{ts,tsx,js,jsx}": ["eslint"], + "*.{ts,tsx,css}": ["stylelint"] } diff --git a/.github/linters/.prettierignore b/.ci/linters/.prettierignore similarity index 62% rename from .github/linters/.prettierignore rename to .ci/linters/.prettierignore index 36732cc..2b990ab 100644 --- a/.github/linters/.prettierignore +++ b/.ci/linters/.prettierignore @@ -9,9 +9,19 @@ coverage .mypy_cache/ .build .terraform +.ci/linters/.cache/* +.cache/* terraform.md *.tpl.md *.enc.yaml vendor +public +staticfiles out .vscode-test +.cache +.venv +contrib/ +site/ +.external_modules +CHANGELOG.md diff --git a/.github/linters/.pylintrc b/.ci/linters/.pylintrc similarity index 100% rename from .github/linters/.pylintrc rename to .ci/linters/.pylintrc diff --git a/.github/linters/.stylintrc b/.ci/linters/.stylintrc similarity index 100% rename from .github/linters/.stylintrc rename to .ci/linters/.stylintrc diff --git a/.ci/linters/.tflint.hcl b/.ci/linters/.tflint.hcl new file mode 100644 index 0000000..ba83a3c --- /dev/null +++ b/.ci/linters/.tflint.hcl @@ -0,0 +1,39 @@ +plugin "aws" { + enabled = true + version = "0.26.0" + source = "github.com/terraform-linters/tflint-ruleset-aws" +} +rule "terraform_deprecated_index" { + enabled = true +} +rule "terraform_unused_declarations" { + enabled = true +} +rule "terraform_comment_syntax" { + enabled = true +} +rule "terraform_documented_outputs" { + enabled = true +} +rule "terraform_documented_variables" { + enabled = true +} +rule "terraform_typed_variables" { + enabled = true +} +rule "terraform_naming_convention" { + enabled = true +} +rule "terraform_required_version" { + enabled = true +} +rule "terraform_standard_module_structure" { + enabled = true +} +rule "terraform_required_providers" { + enabled = false +} +rule "terraform_module_pinned_source" { + enabled = true + style = "semver" +} diff --git a/.ci/linters/.yamllint b/.ci/linters/.yamllint new file mode 100644 index 0000000..6d56f1b --- /dev/null +++ b/.ci/linters/.yamllint @@ -0,0 +1,7 @@ +--- +extends: default + +rules: + line-length: + max: 200 + level: warning diff --git a/.ci/linters/checkov.yml b/.ci/linters/checkov.yml new file mode 100644 index 0000000..6d8d0d5 --- /dev/null +++ b/.ci/linters/checkov.yml @@ -0,0 +1,11 @@ +download-external-modules: true +evaluate-variables: true +external-modules-download-path: .external_modules +framework: + - all +no-guide: true +output: cli +quiet: true +skip-fixes: true +skip-suppressions: true +soft-fail: true diff --git a/.github/linters/markdown-link-config.json b/.ci/linters/markdown-link-config.json similarity index 81% rename from .github/linters/markdown-link-config.json rename to .ci/linters/markdown-link-config.json index 1d739cd..111335f 100644 --- a/.github/linters/markdown-link-config.json +++ b/.ci/linters/markdown-link-config.json @@ -3,9 +3,6 @@ "ignorePatterns": [ { "pattern": "^https://hadenlabs.com" - }, - { - "pattern": "^https://github.com/hadenlabs/zsh-rvm/compare" } ], "replacementPatterns": [ diff --git a/.ci/linters/prettier.config.js b/.ci/linters/prettier.config.js new file mode 100644 index 0000000..da525f2 --- /dev/null +++ b/.ci/linters/prettier.config.js @@ -0,0 +1,72 @@ +module.exports = { + arrowParens: "always", + printWidth: 120, + proseWrap: "preserve", + semi: false, + singleQuote: false, + tabWidth: 2, + trailingComma: "none", + overrides: [ + { + files: "{*.js?(x),*.ts?(x),*.y?(a)ml,.*.y?(a)ml,*.md,.prettierrc,.stylelintrc,.babelrc}", + options: { + arrowParens: "always", + printWidth: 100, + semi: false, + quoteProps: "as-needed", + tabWidth: 2, + trailingComma: "none" + } + }, + { + files: "{*.lua}", + options: { + printWidth: 100, + tabWidth: 2, + quoteProps: "preserve" + } + }, + + { + files: "{*.json,.*.json,**/.vscode/*.json,**/tsconfig.json,**/tsconfig.*.json}", + options: { + parser: "json", + tabWidth: 2, + quoteProps: "preserve" + } + }, + { + files: "*.md", + options: { + parser: "markdown", + printWidth: 120, + proseWrap: "never", + semi: false, + trailingComma: "none" + } + }, + { + files: "*.mdx", + options: { + printWidth: 120, + proseWrap: "never", + semi: false, + trailingComma: "none" + } + }, + { + files: "*.{sass,scss}", + options: { + parser: "scss" + } + }, + { + files: "*.less", + options: { + tabWidth: 4, + printWidth: 80, + parser: "less" + } + } + ] +} diff --git a/.ci/linters/yamllint.config.yaml b/.ci/linters/yamllint.config.yaml new file mode 100644 index 0000000..7274672 --- /dev/null +++ b/.ci/linters/yamllint.config.yaml @@ -0,0 +1,31 @@ +ignore: | + .gitlab/ + +extends: default + +rules: + braces: + level: warning + max-spaces-inside: 1 + brackets: + level: warning + max-spaces-inside: 1 + colons: + level: warning + commas: + level: warning + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + level: warning + hyphens: + level: warning + indentation: + level: warning + indent-sequences: consistent + line-length: + max: 180 + level: warning + allow-non-breakable-inline-mappings: true + truthy: disable diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index e63c0c1..0000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.* -!.coveragerc -!.env -!.pylintrc diff --git a/.editorconfig b/.editorconfig index 7454de4..51a2a62 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,11 +13,30 @@ indent_style = space # Set default charset charset = utf-8 trim_trailing_whitespace = true +indent_size = 2 + +# Custom Coding Styles for Java files +[*.java] + +# The other allowed value you can use is space +indent_style = tab + +# You can play with this value and set it to how +# many characters you want your indentation to be +indent_size = 2 + +# Character set to be used in java files. +charset = utf-8 +trim_trailing_whitespace = true [*.{el}] insert_final_newline = false -[*.{el,sh,md,yml,yaml,js,json,toml,ts,tsx,hcl,tf,graphql}] +[*.{el,md,mdx,yml,yaml,js,json,toml,ts,tsx,hcl,tf,graphql,hbs,sh,lua}] +indent_style = space +indent_size = 2 + +[*.{lua}] indent_style = space indent_size = 2 diff --git a/.env.example b/.env.example index 18a16a8..d994467 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,4 @@ +# **NOTE**: please check the following document docs/env-vars.md APP_NAME=zsh-rvm +SONAR_URL= +SONAR_TOKEN= diff --git a/.gitattributes b/.gitattributes index 15ff949..989c092 100644 --- a/.gitattributes +++ b/.gitattributes @@ -146,6 +146,7 @@ bin/* text eol=lf *.so binary *.war binary *.xls binary -*.xlsx binary +*.xlsx binary *.pem binary *.pub binary +*.crt binary diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e119523..69404a3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -12,3 +12,4 @@ otechie: # Replace with a single Otechie username custom: - https://www.paypal.me/luismayta - https://www.buymeacoffee.com/luismayta + - https://amzn.com/w/1VJ9F3BEK0S8B diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..4d26610 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ +## The problem + +Briefly describe the issue you are experiencing (or the feature you want to see added). Tell us what you were trying to do and what happened instead. Remember, this is _not_ a place to ask questions. + +## Environment + +- OS: {Please write here} +- Python version: {Please write here} + +## Details + +If necessary, describe the problem you have been experiencing in more detail. + +## Link to logs + +Create a [GIST](https://gist.github.com) which is a paste of your _full_ logs, and link them here. Do _NOT_ paste your full logs here, as it will make this issue very long and hard to read! If you are reporting a bug, _always_ include logs! + +## Tasks + +- [ ] Task number 1 diff --git a/.github/ISSUE_TEMPLATE/support_question.md b/.github/ISSUE_TEMPLATE/support_question.md new file mode 100644 index 0000000..ef8d82b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_question.md @@ -0,0 +1,23 @@ +--- +name: Support Question +about: I have a question and require assistance +labels: question +--- + + + +## What are you trying to achieve + + + +## Minimal example (if applicable) + + diff --git a/.github/linters/.eslintrc.js b/.github/linters/.eslintrc.js deleted file mode 100644 index ce35ce3..0000000 --- a/.github/linters/.eslintrc.js +++ /dev/null @@ -1,28 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - env: { - node: true, - es2021: true - }, - parserOptions: { - ecmaVersion: 6, - sourceType: 'module' // Allows for the use of imports - }, - extends: [ - 'plugin:prettier/recommended', - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin - 'plugin:import/warnings' - ], - plugins: ['@typescript-eslint'], - rules: { - '@typescript-eslint/semicolon': 'off', - '@typescript-eslint/member-delimiter-style': 'off', - '@typescript-eslint/naming-convention': 'warn', - '@typescript-eslint/semi': 'off', - 'no-throw-literal': 'warn', - curly: 'warn', - eqeqeq: 'warn', - semi: 'off' - }, - ignorePatterns: ['**/*.d.ts'] -} diff --git a/.github/linters/prettier.config.js b/.github/linters/prettier.config.js deleted file mode 100644 index db2b6d3..0000000 --- a/.github/linters/prettier.config.js +++ /dev/null @@ -1,65 +0,0 @@ -module.exports = { - arrowParens: 'always', - printWidth: 120, - proseWrap: 'preserve', - semi: false, - singleQuote: true, - tabWidth: 2, - trailingComma: 'none', - overrides: [ - { - files: '{*.js?(x),*.ts?(x),*.y?(a)ml,.*.y?(a)ml,*.md,.prettierrc,.stylelintrc,.babelrc}', - options: { - arrowParens: 'always', - printWidth: 100, - semi: false, - singleQuote: true, - quoteProps: 'as-needed', - tabWidth: 2, - trailingComma: 'none' - } - }, - { - files: '{*.json,.*.json,**/.vscode/*.json,**/tsconfig.json,**/tsconfig.*.json}', - options: { - parser: 'json', - tabWidth: 2, - quoteProps: 'preserve', - singleQuote: false - } - }, - { - files: '*.md', - options: { - parser: 'markdown', - printWidth: 120, - proseWrap: 'never', - semi: false, - trailingComma: 'none' - } - }, - { - files: '*.mdx', - options: { - printWidth: 120, - proseWrap: 'never', - semi: false, - trailingComma: 'none' - } - }, - { - files: '*.{sass,scss}', - options: { - parser: 'scss' - } - }, - { - files: '*.less', - options: { - tabWidth: 4, - printWidth: 80, - parser: 'less' - } - } - ] -} diff --git a/.github/stale.yml b/.github/stale.yml index b56231c..0a1bbef 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -23,6 +23,8 @@ exemptLabels: - priority/critical - good first issue - pinned + - security + - planned # Set to true to ignore issues in a project (defaults to false) exemptProjects: false diff --git a/.github/workflows/confluence.yml b/.github/workflows/confluence.yml index dc9bab8..0ec3bc8 100644 --- a/.github/workflows/confluence.yml +++ b/.github/workflows/confluence.yml @@ -1,21 +1,16 @@ name: confluence on: - workflow_run: - workflows: - - lint-code - types: - - completed + push: branches: - - develop - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" jobs: confluence: @@ -23,23 +18,24 @@ jobs: steps: - name: Check out a copy of the repo if: ${{ !env.ACT }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v17.1 + uses: tj-actions/changed-files@v26 with: files: | - *.md + docs/*.md files_ignore: | *.tpl.md + ^.terraform - name: Sync confluence uses: hadenlabs/action-confluence-sync@0.1.0 with: - files: '${{ steps.changed-files.outputs.all_changed_files }}' + files: "${{ steps.changed-files.outputs.all_changed_files }}" confluence_url: ${{ secrets.CONFLUENCE_BASE_URL }} confluence_username: ${{ secrets.CONFLUENCE_USER }} confluence_token: ${{ secrets.CONFLUENCE_ACCESS_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b638015..a75560f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,6 @@ name: lint-code on: pull_request: branches: - - develop - main push: @@ -12,11 +11,11 @@ on: - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" permissions: contents: read @@ -28,7 +27,7 @@ jobs: steps: - name: Checkout if: ${{ !env.ACT }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - uses: hadenlabs/action-pre-commit@0.2.0 with: args: run --all-files diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7020fd5..54dfd3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,52 +1,50 @@ name: create-release on: - workflow_run: - workflows: - - lint-code - types: - - completed - push: tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" + +env: + TMP_CHANGELOG_FILENAME: TMP_CHANGELOG.md jobs: release: runs-on: ubuntu-20.04 - if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/') }} + if: startsWith(github.ref, 'refs/tags/') container: - image: golang:1.16 + image: golang:1.19 steps: - name: Check out a copy of the repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Install Task + uses: arduino/setup-task@v1 + + - name: Install changelog + run: task changelog:install + + - name: Check dependences + run: task changelog:check + - id: get_version uses: battila7/get-version-action@v2 - - name: set vars to github - run: | - echo "APP_TAG=${{ steps.get_version.outputs.version-without-v }}" >> $GITHUB_ENV - - - name: install + - name: set vars to github run: | - go get github.com/git-chglog/git-chglog/cmd/git-chglog + echo "APP_TAG=${{ steps.get_version.outputs.version-without-v }}" >> $GITHUB_ENV - - name: generate changelog - run: | - # https://github.com/git-chglog/git-chglog#git-chglog - $(go env GOPATH)/bin/git-chglog \ - -c .chglog/config.yml \ - -o RELEASE_CHANGELOG.md \ - ${{ env.APP_TAG }} + - name: Generate changelog + run: task changelog:tag - name: Create Release + if: ${{ !env.ACT }} id: create_release uses: actions/create-release@v1 env: @@ -54,6 +52,6 @@ jobs: with: tag_name: ${{ env.APP_TAG }} release_name: ${{ env.APP_TAG }} - draft: true + draft: false prerelease: false - body_path: RELEASE_CHANGELOG.md + body_path: ${{ env.TMP_CHANGELOG_FILENAME }} diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index c127912..a3455b6 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -1,25 +1,20 @@ name: sonarqube on: - workflow_run: - workflows: - - lint-code - types: - - completed + push: branches: - - develop - main tags: - - '[0-9]+.[0-9]+.[0-9]+' + - "[0-9]+.[0-9]+.[0-9]+" # https://semver.org/ proper release tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" # prerelease tags, more or less - - 'v[0-9]+.[0-9]+.[0-9]+-*' + - "v[0-9]+.[0-9]+.[0-9]+-*" env: - SONAR_HOST_URL: '${{ secrets.SONAR_HOST_URL }}' - SONAR_LOGIN: '${{ secrets.SONAR_LOGIN }}' + SONAR_HOST_URL: "${{ secrets.SONAR_HOST_URL }}" + SONAR_LOGIN: "${{ secrets.SONAR_LOGIN }}" jobs: sonar-scan: @@ -28,7 +23,7 @@ jobs: steps: - name: Check out a copy of the repo if: ${{ !env.ACT }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 diff --git a/.mailmap b/.mailmap deleted file mode 100644 index 935b361..0000000 --- a/.mailmap +++ /dev/null @@ -1,5 +0,0 @@ -@slovacus luis mayta luis alberto mayta -@slovacus L. Mayta $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> -@slovacus @slovacus slovacus@gmail.com Luis Alberto Mayta -@slovacus luis Alberto Mayta Mamani -@slovacus luis Alberto Mayta slovacus@gmail.com diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..bb52a16 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18.18.2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b26ca94..908b348 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,34 +1,51 @@ +ci: + autoupdate_schedule: monthly + default_stages: - commit +exclude: > + (?x)^( + ^(\/|)vendor\/(.*?)$| + .+\.node_modules\/.*$| + .+\.external_modules.*$| + .+\.terraform.*$| + .+\.venv.*$| + .+\.lock$| + )$ repos: - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.3.0 hooks: - id: codespell - args: [--ignore-words=.codespell-ignores] + args: + - --ignore-words=.ci/linters/.codespell-ignores exclude: > (?x)^( .+\.vendor\/.*$| .+\.node_modules\/.*$| + .+\.sops.*$| .+\.lock$| + go.mod| + go.sum| )$ - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v5.0.0 + rev: v9.18.0 hooks: - id: commitlint stages: [commit-msg] - additional_dependencies: ['@hadenlabs/commitlint-config'] + additional_dependencies: ["@hadenlabs/commitlint-config"] args: - - --config=.github/linters/.commitlintrc.json + - --config=.ci/linters/.commitlintrc.json - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v5.0.0 hooks: - id: detect-private-key files: ^(?!\.?git-crypt) exclude: > (?x)^( .+\.gitleaks.toml$| + test/fixtures/keys/.*-test.*$ )$ - id: check-merge-conflict - id: check-added-large-files @@ -37,6 +54,8 @@ repos: - id: check-json - id: check-xml - id: check-yaml + args: + - --allow-multiple-documents - id: check-byte-order-marker - id: check-ast - id: debug-statements @@ -47,13 +66,20 @@ repos: - id: fix-encoding-pragma - id: sort-simple-yaml - repo: https://github.com/hadenlabs/pre-commit-hooks - rev: 32eda4af34084f4e03d83a75b0ae3d2b91b45246 + rev: e50751c9323b0a03f27271c57513f5c389f6591b hooks: - id: do-not-commit - id: markdown-link-check args: - - --config=.github/linters/markdown-link-config.json - exclude: \.tpl.md$ + - --config=.ci/linters/markdown-link-config.json + exclude: > + (?x)^( + .+\.docs/env-vars.md$| + docs/env-vars.md$| + docs\/include\/terraform.md$| + .+\.tpl.md$| + )$ + - id: shellcheck exclude: > (?x)^( @@ -62,9 +88,11 @@ repos: )$ args: - --exclude=SC1072,SC1073,SC2068 - - id: todocheck - id: gitleaks args: - --path=. - - --repo-config-path=.github/linters/.gitleaks.toml + - --repo-config-path=.ci/linters/.gitleaks.toml - --verbose + - id: hadolint + args: + - --config=.ci/linters/.hadolint.yaml diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..c8d5014 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11.5 \ No newline at end of file diff --git a/.todocheck.yaml b/.todocheck.yaml deleted file mode 100644 index 2a61fc6..0000000 --- a/.todocheck.yaml +++ /dev/null @@ -1,9 +0,0 @@ -origin: github.com/hadenlabs/zsh-rvm -issue_tracker: GITHUB -auth: - type: none -ignored: - - vendor/ - - node_modules/ -custom_todos: - - '@fix' diff --git a/Makefile b/Makefile deleted file mode 100644 index 9715bd9..0000000 --- a/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# See ./docs/contributing.md -# - -OS := $(shell uname) - -.PHONY: help -.DEFAULT_GOAL := help - -HAS_PIP := $(shell command -v pip;) -HAS_PIPENV := $(shell command -v pipenv;) - -ifdef HAS_PIPENV - PIPENV_RUN:=pipenv run - PIPENV_INSTALL:=pipenv install -else - PIPENV_RUN:= - PIPENV_INSTALL:= -endif - -TEAM := hadenlabs -REPOSITORY_DOMAIN:=github.com -REPOSITORY_OWNER:=${TEAM} -AWS_VAULT ?= ${TEAM} -PROJECT := zsh-rvm - -PYTHON_VERSION=3.8.0 -NODE_VERSION=14.16.1 -PYENV_NAME="${PROJECT}" -GIT_IGNORES:=python,node,go,zsh -GI:=gi - -# issues reviewers -REVIEWERS?=luismayta - -# Configuration. -SHELL ?=/bin/bash -ROOT_DIR=$(shell pwd) -MESSAGE:=🍺️ -MESSAGE_HAPPY?:="Done! ${MESSAGE}, Now Happy Hacking" -SOURCE_DIR=$(ROOT_DIR) -PROVISION_DIR:=$(ROOT_DIR)/provision -DOCS_DIR:=$(ROOT_DIR)/docs -README_TEMPLATE:=$(PROVISION_DIR)/templates/README.tpl.md - -export README_FILE ?= README.md -export README_YAML ?= provision/generators/README.yaml -export README_INCLUDES ?= $(file://$(shell pwd)/?type=text/plain) - -FILE_README:=$(ROOT_DIR)/README.md - -include provision/make/*.mk - -## Display help for all targets -.PHONY: help -help: - @echo '${MESSAGE} Makefile for ${PROJECT}' - @echo '' - @awk '/^.PHONY: / { \ - msg = match(lastLine, /^## /); \ - if (msg) { \ - cmd = substr($$0, 9, 100); \ - msg = substr(lastLine, 4, 1000); \ - printf " ${GREEN}%-30s${RESET} %s\n", cmd, msg; \ - } \ - } \ - { lastLine = $$0 }' $(MAKEFILE_LIST) - -## Create README.md by building it from README.yaml -.PHONY: readme -readme: - @gomplate --file $(README_TEMPLATE) \ - --out $(README_FILE) - -## setup dependences of project -.PHONY: setup -setup: - @echo "==> install packages..." - make python.setup - make python.precommit - @[ -e ".env" ] || cp -rf .env.example .env - make git.setup - @echo ${MESSAGE_HAPPY} - -## setup environment of project -.PHONY: environment -environment: - @echo "==> loading virtualenv ${PYENV_NAME}..." - make python.environment - @echo ${MESSAGE_HAPPY} diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 5c35cfc..0000000 --- a/Pipfile +++ /dev/null @@ -1,29 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -bridgecrew = "*" -bumpversion = "*" -doc8 = "*" -grip = "*" -isort = "*" -mkdocs = "*" -mkdocs-material = "*" -mypy = "*" -parso = "*" -pre-commit = "*" -pycodestyle = "*" -pydocstyle = "*" -pygments = "*" -pylint = "*" -pymdown-extensions = "*" - -[packages] - -[scripts] -update = "pre-commit autoupdate" - -[requires] -python_version = "3.8.0" diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..83373f0 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,15 @@ + + + + + + + + +# Security Policy + +## Reporting a Security Bug + +If you think you have discovered a security issue in any of the zsh-rvm projects, we'd love to hear from you. We will take all security bugs seriously and if confirmed upon investigation we will patch it within a reasonable amount of time and release a public security bulletin discussing the impact and credit the discoverer. + +There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at zsh-rvm dot org](mailto:security@hadenlabs.com). diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..59dfbc6 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,126 @@ +--- +version: "3" + +includes: + changelog: ./provision/task/changelog.yml + confluence: ./provision/task/confluence.yml + python: ./provision/task/python.yml + git: ./provision/task/git.yml + docs: ./provision/task/docs.yml + docker: ./provision/task/docker.yml + version: ./provision/task/version.yml + plantuml: ./provision/task/plantuml.yml + prettier: ./provision/task/prettier.yml + sonar: ./provision/task/sonar.yml + diagrams: ./provision/diagrams/Taskfile.yml + +env: + DOCKER: + sh: docker --version 2> /dev/null || echo "not exist" + PYTHON: + sh: python --version 2> /dev/null || echo "not exist" + GO: + sh: go version 2> /dev/null || echo "not exist" + NODE: + sh: node --version 2> /dev/null || echo "not exist" + APP_TAG: + sh: git describe --tags $(git rev-list --tags --max-count=1) 2> /dev/null || echo "0.0.0" + README_YAML: provision/generators/README.yaml + README_TEMPLATE: provision/templates/README.tpl.md + README_INCLUDES: file:// + +dotenv: + - .env + +vars: + PROJECT_NAME: zsh-rvm + GROUP_NAME: hadenlabs + ORGANIZATION: hadenlabs + DOCKER_PLATFORM: linux/amd64 + REVIEWERS: luismayta + PYTHON_VERSION: 3.11.5 + NODE_VERSION: 18.19.1 + TERRAFORM_VERSION: 1.9.5 + GIT_IGNORES: python,node,go,zsh,sonar,java,maven,intellij+all,terraform,linux + GOLANGCI_VERSION: 1.42.0 + README_FILE: README.md + GIT_IGNORES_CUSTOM: | + bin + .scannerwork + .secrets + public + TMP_CHANGELOG.md + .task + .terraform.lock.hcl + *.lock.hcl + *.zip + .external_modules + vendor + +tasks: + default: + deps: + - task: check + cmds: + - cmd: echo Application {{.PROJECT_NAME}} + silent: true + - task: version:default + - task: summary + - cmd: task -l + silent: true + + summary: + desc: "Summary information" + cmds: + - echo Go available {{.GO}} + - echo Python available {{.PYTHON}} + - echo Docker available {{.DOCKER}} + - echo Node available {{.NODE}} + silent: true + + check: + desc: "Check all dependencies" + deps: + - python:check + - changelog:check + - git:check + - docs:check + + readme: + run: once + desc: Generate Readme + silent: true + cmds: + - >- + gomplate --file {{.README_TEMPLATE}} + --out {{.README_FILE}} + --datasource config={{.README_YAML}} + --datasource includes={{.README_INCLUDES}} + - task: prettier + + prettier: + run: once + desc: Execute prettier files + cmds: + - task: prettier:all + + upgrade: + run: once + desc: Execute upgrade packages + cmds: + - poetry update + - poetry run pre-commit autoupdate + + setup: + desc: Setup dependences of project + cmds: + - >- + [ -e ".env" ] || cp -rf .env.example .env + - task: python:setup + - task: python:precommit + - task: git:setup + + environment: + desc: Setup environment of project + cmds: + - task: python:environment diff --git a/config/base.zsh b/config/base.zsh index f1b0945..659d416 100644 --- a/config/base.zsh +++ b/config/base.zsh @@ -6,9 +6,9 @@ export RVM_PACKAGE_NAME=rvm export RVM_ROOT="${HOME}"/.rvm export RVM_CACHE_DIR="${HOME}/.cache/rvm" export RVM_VERSIONS=( - 2.7.2 + 3.3.6 ) -export RVM_VERSION_GLOBAL=2.7.2 +export RVM_VERSION_GLOBAL=3.3.6 export RVM_PACKAGES=( tmuxinator cocoapods diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index dd012c6..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Docker Compose -# https://docs.docker.com/compose/ -# Usage: docker-compose up ---- -version: '3.6' - -services: - app: - build: - context: . - dockerfile: provision/docker/app/Dockerfile - environment: &environment - - STAGE=dev - volumes: - - .:/usr/src - env_file: - - .env diff --git a/docs/authors.md b/docs/authors.md index 8b10dcf..3eae9c2 100644 --- a/docs/authors.md +++ b/docs/authors.md @@ -2,6 +2,6 @@ ## Leads -- Luis Mayta [@slovacus](https://github.com/luismayta) +- Luis Mayta [@luismayta](https://github.com/luismayta) ## Contributors (chronological) diff --git a/docs/code_of_conduct.md b/docs/code_of_conduct.md index 7e2de51..1a0ed30 100644 --- a/docs/code_of_conduct.md +++ b/docs/code_of_conduct.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project\'s leadership. diff --git a/docs/commands.md b/docs/commands.md new file mode 100755 index 0000000..854b625 --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,94 @@ + + + + + + + + + +# Commands + +## Poetry + +## Taskfile + +### Confluence + +#### Sync Markdown with confluence + +```{.bash} +task confluence:sync:all +``` + +### Python + +#### Format syntax code python with [black](https://github.com/psf/black) + +```{.bash} +task python:fmt -- {{file_name or path}} +``` + +### Diagrams + +#### Publish diagrams + +```{.bash} +task diagrams:publish +``` + +### Mkdocs + +#### Generate Website + +```{.bash} +task docs:build +``` + +### Changelog + +#### Generate Changelog Next Tag + +```{.bash} +task changelog:next APP_TAG={{tag name}} +``` + +#### Parameters + +| Name | Description | sample | Required | +| -------- | ------------- | ------ | :------: | +| tag name | Name next tag | 0.1.0 | yes | + +### Version + +#### Version Major + +```{.bash} +task version:major +``` + +#### Version Minor + +```{.bash} +task version:minor +``` + +#### Version Patch + +```{.bash} +task version:patch +``` + +### Docs + +#### build + +```{.bash} +task docs:build +``` + +#### server + +```{.bash} +task docs:serve +``` diff --git a/docs/components.md b/docs/components.md new file mode 100755 index 0000000..ad3a6a5 --- /dev/null +++ b/docs/components.md @@ -0,0 +1,10 @@ + + + + + + + + + +# Components diff --git a/docs/contribute/github-flow.md b/docs/contribute/github-flow.md new file mode 100644 index 0000000..34c1f86 --- /dev/null +++ b/docs/contribute/github-flow.md @@ -0,0 +1,81 @@ + + + + + + + + + + +To contribute to zsh-rvm project on [GitHub](https://github.com/hadenlabs/zsh-rvm), We use [GitHub Flow](https://githubflow.github.io/), it means that you should branch from the main repository and contribute back by making [pull request](https://github.com/hadenlabs/zsh-rvm/pulls). + +GitHub Flow is very lightweight (especially compared to GitFlow). This workflow uses only two kinds of branches: + +- Feature branch +- Main branch (previously called master) + +The _feature_ branches are used to develop new features as well as fixes. These branches are usually created out of main. + +Anything in the _main_ branch is deployable. The _main_ branch is expected to be deployed regularly and is considered stable. + +For more information see [GitHub Flow](https://githubflow.github.io/) + +## Getting started + +To follow the instructions in this guide and start contributing to zsh-rvm project on GitHub: + +1. **Fork** the repo on GitHub +2. **Clone** the project to your own machine + +To synchronize with the main repository, add it to the remotes: + +```bash +git remote add upstream https://github.com/hadenlabs/zsh-rvm.git +``` + +Now your **upstream** points to **hadenlabs/zsh-rvm**. + +## Branches + +### master or main + +The master branch contains production code and it stores the official release history. + +### Feature Branch + +Each new feature should reside in its own branch, which can be pushed to the central repository for backup/collaboration. But, instead of branching off of main, **feature branches** use develop as their parent branch. + +- When a feature is complete, it gets merged back into main. + +## Merge requirements + +### No merge conflicts + +Resolve any merge conflicts that may arise. If conflict occurs, a corresponding message will be displayed on the PR page on GitHub. + +To resolve a conflict, run the following commands. + +```bash +# checkout a branch you open PR from +git fetch upstream # assuming upstream is hadenlabs/zsh-rvm +git merge upstream/merge_branch # Where merge_branch is a branch you open merge request against. +# resolve merge requests +git add changed_files +git commit +git push +``` + +Github will automatically update your pull request. + +### Testing + +All merge requests are automatically tested using [Github Actions](https://github.com/hadenlabs/zsh-rvm/actions). In case some tests fail, fix the issues or describe why the fix cannot be done. + +### Review + +Every pull request is reviewed by the assigned team members as per standard [Pull Request](https://opensource.com/article/19/7/create-pull-request-github). Reviewers can comment on a PR, approve it, or request changes to it. A PR can be merged when it is approved by at least two assigned reviewers and has no pending requests for changes. + +## Code of Conduct + +Please have a look at our [Code of Conduct](../code_of_conduct.md) before you write an Issue or make a PR. diff --git a/docs/contributing.md b/docs/contributing.md index 0296a6c..389cd1a 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,94 +1,96 @@ - - + + + + + + + # How To Contribute Contributions to zsh-rvm are welcome. +Feel free to use all of the contribution options: + +- Contribute to zsh-rvm repositories on [GitHub](https://github.com/hadenlabs/zsh-rvm). See [Git flow](./contribute/github-flow.md). + ## Getting Started -### Commits +### Development + +In general, MRs are welcome. We follow the typical "fork-and-pull" [Git flow](./contribute/github-flow.md). + +1. **Fork** the repo on Github +2. **Clone** the project to your own machine +3. **Commit** changes to your own branch using [Git flow](./contribute/github-flow.md) +4. **Push** your work back up to your fork + +5. Submit a **Pull Request** so that we can review your changes + +**NOTE:** Be sure to rebase the latest changes from "upstream" before making a pull request! -Follow [semantic commits](https://seesparkbox.com/foundry/semantic_commit_messages) to make `git log`{.interpreted-text role="command"} a little easier to follow. +## Styleguides -chore: something just needs to happen, e.g. versioning +### Git Commit Messages -docs: documentation pages in `_docs/` or docstrings +Your commit messages should serve these 3 important purposes: -feat: new code in `src/` +- To speed up the reviewing process. +- To provide the least amount of necessary documentation +- To help the future maintainers. -fix: code improvement in `src/` +Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) to make `git log`{.interpreted-text role="command"} a little easier to follow. We use commitlint enforcing conventional commits (See more [here](https://github.com/conventional-changelog/commitlint)) -refactor: code movement in `src/` +**chore**: something just needs to happen, e.g. versioning -style: aesthetic changes +**docs**: documentation pages in `docs/` or docstrings -test: test case modifications in `test/` +**feat**: new code in `./` + +**fix**: code improvement in `./` + +**refactor**: code movement in `./` + +**style**: aesthetic changes + +**test**: test case modifications in `test/` Examples commit messages: -- chore: v10.0 (IN-698) -- docs: Add configuration setting (IN-698) -- feat: Create Lambda function (IN-698) -- fix: Retry upload on failure (IN-698) -- refctor: Extract duplicate code (IN-698) -- style: isort, YAPF (IN-698) -- test: Coverage around add permissions (IN-698) +- chore: IN-698 implement model devices +- docs: IN-698 implement configuration settings +- feat: IN-698 create lambda function +- fix: IN-698 retry upload on failure +- refactor: IN-698 extract duplicate code +- style: IN-698 format files python +- test: IN-698 coverage around add permissions -### Branches +**Keep it short and simple!** -Use [slash convention]() with the same leaders as `commits` e.g.: +### Branches -- (prefix-task) +See [Git flow](./contribute/github-flow.md). ### Documentation -### Testing +Documentation is a part of the zsh-rvm code base. You can find the documentation files in the `doc/` subdirectory of the [main repository](https://github.com/hadenlabs/zsh-rvm). This means that the contribution process is the same for both the source code and documentation. -## Code Submission +### Testing -### Code Improvement +See [Testing](./testing.md). ### Code Submission -1. See if a [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls/) exists +1. See if a [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls) exists - Add some comments or review the code to help it along - Don\'t be afraid to comment when logic needs clarification -2. Create a Fork and open a [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls/) if needed +2. Create a Fork and open a [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls) if needed ### Code Review - Anyone can review code -- Any [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls/) should be closed or merged within a week +- Any [Pull Request](https://github.com/hadenlabs/zsh-rvm/pulls) should be closed or merged within a week ### Code Acceptance Try to keep history as linear as possible using a [rebase] merge strategy. - -1. One thumb up at minimum, two preferred - -2. Request submitter to [rebase]{.title-ref} and resolve all conflicts - - ```{.bash} - # Update `develop` - git checkout develop - git pull origin develop - - # Update `IN-698` Branch - git flow feature start IN-698 - git rebase develop - - # Update remote Branch and Pull Request - git push -f - ``` - -3. Merge the new feature - - ```{.bash} - # Merge `IN-698` into `develop` - git checkout develop - git merge --ff-only feature/IN-698 - git push - ``` - -4. Delete merged Branch diff --git a/docs/diagrams/example.png b/docs/diagrams/example.png new file mode 100644 index 0000000..ad8b301 Binary files /dev/null and b/docs/diagrams/example.png differ diff --git a/docs/diagrams/logo.png b/docs/diagrams/logo.png new file mode 100644 index 0000000..ad8b301 Binary files /dev/null and b/docs/diagrams/logo.png differ diff --git a/docs/disclaimer.md b/docs/disclaimer.md new file mode 100644 index 0000000..0b55c17 --- /dev/null +++ b/docs/disclaimer.md @@ -0,0 +1 @@ +**NOTE**: this document is generated [mark](https://github.com/kovetskiy/mark), do not edit manually. diff --git a/docs/env-vars.md b/docs/env-vars.md new file mode 100644 index 0000000..15ccc1b --- /dev/null +++ b/docs/env-vars.md @@ -0,0 +1,14 @@ + + + + + + + + + +--- + +## Env Vars + +### Application diff --git a/docs/examples/common.md b/docs/examples/common.md index 6ee967f..15c8f8d 100644 --- a/docs/examples/common.md +++ b/docs/examples/common.md @@ -1 +1,8 @@ -### common + + + + + + + +### Common diff --git a/docs/faq.md b/docs/faq.md index e69de29..cdf5dd6 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -0,0 +1 @@ +# Faq diff --git a/docs/include/installation/antibody.md b/docs/include/installation/antibody.md index 906dd5a..69bcc4c 100644 --- a/docs/include/installation/antibody.md +++ b/docs/include/installation/antibody.md @@ -1,11 +1,20 @@ + + + + + + + + + ### [antibody](https://github.com/getantibody/antibody) users If you're using [Antibody](https://github.com/getantibody/antibody), install this plugin by doing the following: -1. Add : +1. Add : ```{.sourceCode .bash} - antibody bundle hadenlabs/zsh-rvm +antibody bundle hadenlabs/zsh-rvm ``` to your `.zshrc` where you're adding your other plugins. diff --git a/docs/include/installation/antigen.md b/docs/include/installation/antigen.md index 88081c0..69a9aba 100644 --- a/docs/include/installation/antigen.md +++ b/docs/include/installation/antigen.md @@ -1,3 +1,13 @@ + + + + + + + + + + ### [antigen](https://github.com/zsh-users/antigen) users If you're using [Antigen](https://github.com/zsh-users/antigen), install this plugin by doing the following: diff --git a/docs/include/installation/oh-my-zsh.md b/docs/include/installation/oh-my-zsh.md index 24f81e9..52e2389 100644 --- a/docs/include/installation/oh-my-zsh.md +++ b/docs/include/installation/oh-my-zsh.md @@ -1,6 +1,16 @@ -### [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) users + + + + + + + + + -If you're using [oh-my-zsh](https://gitub.com/robbyrussell/oh-my-zsh), install this plugin by doing the following: +### [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) users + +If you're using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh), install this plugin by doing the following: 1. Go to your oh-my-zsh custom plugins directory -`cd ~/.oh-my-zsh/custom/plugins` 2. Clone the plugin `bash git clone https://github.com/hadenlabs/zsh-rvm`bash diff --git a/docs/releasing.md b/docs/releasing.md index 2b481a8..29946cd 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,15 +1,52 @@ + + + + + + + + + # Releasing ## Bump a new version Make a new version of zsh-rvm in the following steps: -- Make sure everything is commit to github.com. -- Update `CHANGELOG.md` with the next version. +### Generate version major + +```bash +task version:major +``` + +### Generate version minor + +```bash +task version:minor +``` + +### Generate version patch + +```bash +task version:patch +``` + +## Generate Changelog + +### Generate Changelog Next Tag + +```bash +task changelog:next APP_TAG={{tag}} +``` + +#### Parameters + +| Name | Description | sample | Required | +| -------- | ------------- | ------ | :------: | +| tag name | Name next tag | 0.1.0 | yes | -- Dry Run: `bumpversion --dry-run --verbose --new-version 0.8.1 patch` -- Do it: `bumpversion --new-version 0.8.1 patch` -- \... or: `bumpversion --new-version 0.9.0 minor` -- Push it: `git push --tags` +### Generate Changelog Tag Now -See the [bumpversion](https://pypi.org/project/bumpversion/) documentation for details. +```bash +task changelog:tag +``` diff --git a/docs/roadmap.md b/docs/roadmap.md new file mode 100644 index 0000000..ad6ce06 --- /dev/null +++ b/docs/roadmap.md @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + +# Roadmap 2021 + +The Roadmap is a list of all the things we're working on for the year. + +You can see the corresponding projects on [zsh-rvm](https://github.com/hadenlabs/zsh-rvm) + +## Legend + +- :todo: : To Do +- :done: : done +- :wip: : work in progress +- :feedback: : actively looking for feedback + +## Epics + +### Agosto 2021 + +### September 2021 + +### October 2021 + +### November 2021 + +### December 2021 + +## Long Lived Initiatives diff --git a/docs/testing.md b/docs/testing.md index 6ad1b2b..fa42a33 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -1,5 +1,11 @@ # Testing +## Running all tests + +```bash +task test +``` + ## Running tests ## Running tests Syntax diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 725069d..866edbd 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -2,10 +2,10 @@ ## Environment -### Wrong pre-commit with pyenv +### Wrong pre-commit with poetry Execute the next: ```{.bash} -make environment +task environment ``` diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..fcbbb47 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,5 @@ +# How to use this project + +```bash +task setup +``` diff --git a/mkdocs.yml b/mkdocs.yml index b7e9fc4..c9b284b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ site_name: zsh-rvm Documentation -theme: 'material' +theme: "material" markdown_extensions: - toc: permalink: True @@ -10,15 +10,15 @@ markdown_extensions: linenums: True extra: palette: - primary: '#087da1' - accent: '#00a889' + primary: "#087da1" + accent: "#00a889" font: - text: 'Source Sans Pro' + text: "Source Sans Pro" -repo_name: 'hadenlabs/zsh-rvm' -repo_url: 'https://github.com/hadenlabs/zsh-rvm' +repo_name: "hadenlabs/zsh-rvm" +repo_url: "https://github.com/hadenlabs/zsh-rvm" copyright: 'Copyright © 2021 hadenlabs' google_analytics: - - '' - - 'auto' + - "" + - "auto" diff --git a/provision/diagrams/Taskfile.yml b/provision/diagrams/Taskfile.yml new file mode 100644 index 0000000..855a24a --- /dev/null +++ b/provision/diagrams/Taskfile.yml @@ -0,0 +1,46 @@ +# https://taskfile.dev + +version: "3" + +tasks: + build: + desc: Build Diagrams Plantuml. + run: once + silent: true + cmds: + - cmd: mkdir -p decks/images/diagrams + - cmd: mkdir -p static/images/diagrams + - cmd: mkdir -p docs/images/diagrams + - task: make + + publish: + desc: Publish Diagrams. + run: once + silent: true + deps: + - task: build + cmds: + - >- + rsync -avhP --remove-source-files + --include='*.png' --include='*/' + --exclude='*' + provision/diagrams/ ./ + + make: + desc: generate files plantuml. + cmds: + - cmd: echo {{.FILES_PLANTUML}} + - cmd: |- + docker run + --platform linux/amd64 + --rm + --workdir /data + -v {{.PWD}}:/data + infosisarg/plantuml {{.FILES_PLANTUML}} + vars: + FILES_PLANTUML: + sh: >- + find ./ -type f -name '*.plantuml' + | grep -v '.terraform' + | sort -u + | xargs diff --git a/provision/diagrams/docs/diagrams/example.plantuml b/provision/diagrams/docs/diagrams/example.plantuml new file mode 100644 index 0000000..7a1a009 --- /dev/null +++ b/provision/diagrams/docs/diagrams/example.plantuml @@ -0,0 +1,2 @@ +@startuml +@enduml diff --git a/provision/diagrams/docs/diagrams/logo.plantuml b/provision/diagrams/docs/diagrams/logo.plantuml new file mode 100644 index 0000000..7a1a009 --- /dev/null +++ b/provision/diagrams/docs/diagrams/logo.plantuml @@ -0,0 +1,2 @@ +@startuml +@enduml diff --git a/provision/docker-compose/dev.yml b/provision/docker-compose/dev.yml deleted file mode 100644 index c20d500..0000000 --- a/provision/docker-compose/dev.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Docker Compose -# https://docs.docker.com/compose/ - -services: - # Python - app: - environment: &environment - - STAGE=local - image: zsh-rvm-app-dev - build: - args: - stage: dev - - check: - image: zsh-rvm-check-dev - environment: *environment - build: - context: . - dockerfile: provision/docker/check/Dockerfile - args: - stage: dev - volumes: - - .:/usr/src - env_file: - - .env diff --git a/provision/docker-compose/test.yml b/provision/docker-compose/test.yml deleted file mode 100644 index 6d84ba2..0000000 --- a/provision/docker-compose/test.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Docker Compose -# https://docs.docker.com/compose/ -# -# Usage: test up - -services: - app: - image: zsh-rvm-app-test - environment: &environment - - STAGE=testing - build: - args: - stage: test diff --git a/provision/docker/app/Dockerfile b/provision/docker/app/Dockerfile deleted file mode 100644 index 2fd3db6..0000000 --- a/provision/docker/app/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM hadenlabs/python:3.8.0-slim - -ARG stage - -LABEL NAME zsh-rvm-$stage - -ENV USERNAME developer - -ENV PACKAGES bash \ - openssl - -ENV ZUNIT_VERSION "0.8.2" - -COPY Pipfile* /usr/src/ - -# set working directory to /usr/src/ -WORKDIR /usr/src/ - -# install packages -RUN apt-get update -y \ - && apt-get install -y ${PACKAGES} --no-install-recommends \ - - # revolver - && curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > /usr/local/bin/revolver \ - && chmod +x /usr/local/bin/revolver \ - # zunit - && curl -L https://github.com/zunit-zsh/zunit/releases/download/v${ZUNIT_VERSION}/zunit > /usr/local/bin/zunit \ - && chmod +x /usr/local/bin/zunit \ - - # Permissions - && groupadd -g 500 -r python \ - && groupadd ${USERNAME} \ - && useradd -m -g ${USERNAME} -G python ${USERNAME} \ - && chown -R ${USERNAME}:python /usr/local/bin \ - && su ${USERNAME} \ - && mkdir -p /usr/src \ - && chown -R ${USERNAME} /usr/src \ - - -# pipenv - && pip3 install --no-cache-dir pipenv \ - && pipenv install --dev --skip-lock \ - && pipenv shell --fancy \ - -# clean - && apt-get clean \ - && apt-get autoremove \ - && apt-get purge \ - && rm -rf /var/lib/apt/lists/* diff --git a/provision/docker/check/Dockerfile b/provision/docker/check/Dockerfile deleted file mode 100644 index 9717375..0000000 --- a/provision/docker/check/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM hadenlabs/python:3.8.0-slim - -ARG stage -LABEL NAME zsh-rvm-check-$stage - -COPY Pipfile* /usr/src/ - -# set working directory to /usr/src/ -WORKDIR /usr/src/ - -RUN apt-get update -y \ - && apt-get -y install --no-install-recommends \ - # tools validation - git-core \ - shellcheck \ - # install python dependencies - && pip3 install --no-cache-dir pipenv \ - && pipenv install --dev --skip-lock \ - && pipenv shell --fancy \ - && apt-get purge \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* diff --git a/provision/generators/README.yaml b/provision/generators/README.yaml index 2a1e705..8db364b 100644 --- a/provision/generators/README.yaml +++ b/provision/generators/README.yaml @@ -27,6 +27,12 @@ badges: - name: Lint image: https://img.shields.io/github/workflow/status/hadenlabs/zsh-rvm/lint-code url: https://github.com/hadenlabs/zsh-rvm/actions?workflow=lint-code + - name: CI + image: https://img.shields.io/github/workflow/status/hadenlabs/zsh-rvm/ci + url: https://github.com/hadenlabs/zsh-rvm/actions?workflow=ci + - name: Test + image: https://img.shields.io/github/workflow/status/hadenlabs/zsh-rvm/test + url: https://github.com/hadenlabs/zsh-rvm/actions?workflow=test - name: pre-commit image: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white url: https://github.com/pre-commit/pre-commit @@ -34,26 +40,33 @@ badges: image: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow url: https://conventionalcommits.org - name: KeepAChangelog - image: https://img.shields.io/badge/Keep%20A%20Changelog-1.0.0-%23E05735 + image: https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.0.0-orange url: https://keepachangelog.com -# Short description of this project -description: |- - zsh-rvm plugin for zsh. - requirements: |- This is a list of plugins that need to be installed previously to enjoy all the goodies of this configuration: - * [zsh-core](https://github.com/hadenlabs/zsh-core) + - [zsh-rvm](https://github.com/hadenlabs/zsh-rvm) + - [gomplate](https://github.com/hairyhenderson/gomplate) + - [python](https://www.python.org) + - [taskfile](https://github.com/go-task/task) -usage: | +# Short description of this project +description: |- + zsh-rvm for project installation: - - 'docs/include/installation/oh-my-zsh.md' - - 'docs/include/installation/antigen.md' - - 'docs/include/installation/antibody.md' + - "docs/include/installation/oh-my-zsh.md" + - "docs/include/installation/antigen.md" + - "docs/include/installation/antibody.md" + +usages: + - docs/usage.md include: - - 'docs/functions.md' + - "docs/functions.md" + +examples: + - "docs/examples/common.md" diff --git a/provision/make/alias.mk b/provision/make/alias.mk deleted file mode 100644 index 367b33c..0000000 --- a/provision/make/alias.mk +++ /dev/null @@ -1,11 +0,0 @@ -# alias - -alias: alias.help - -alias.help: - @echo ' Alias:' - @echo '' - @echo ' stage stage' - @echo '' - -stage: stage diff --git a/provision/make/docker.mk b/provision/make/docker.mk deleted file mode 100644 index f7d9a0d..0000000 --- a/provision/make/docker.mk +++ /dev/null @@ -1,105 +0,0 @@ -# Docker -.PHONY: docker.help -DOCKER_NETWORK = $(PROJECT)_network - -docker: docker.help - -docker.help: - @echo ' Docker:' - @echo '' - @echo ' docker.build build all or one example: make docker.build service={services} args=(--pull|...)' - @echo ' docker.down down services docker-compose' - @echo ' docker.exec exec command in container by {services} {command}' - @echo ' docker.ssh connect by ssh to container' - @echo ' docker.stop stop services by stage' - @echo ' docker.log log {service} {stage}' - @echo ' docker.verify_network verify network' - @echo ' docker.up up services of docker-compose' - @echo ' docker.run run {service} {stage}' - @echo ' docker.restart restart by {stage}' - @echo ' docker.list list services of docker' - @echo '' - -docker.run: - @if [ -z "${stage}" ]; then \ - $(docker-dev) run --rm ${service} bash; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml run --rm ${service} bash; \ - fi - -docker.restart: - @if [ -z "${stage}" ]; then \ - $(docker-dev) restart; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml restart; \ - fi - -docker.build: - @echo $(MESSAGE) "Building stage: ${stage} ${service}" - @if [ -z "${stage}" ] && [ -z "${service}" ]; then \ - $(docker-dev) build ${args}; \ - elif [ -z "${stage}" ] && [ -n "${service}" ]; then \ - $(docker-dev) build ${service} ${args}; \ - elif [ -n "${stage}" ] && [ -z "${service}" ]; then \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml build ${args}; \ - elif [ -n "${stage}" ] && [ -n "${service}" ]; then \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml build ${service} ${args}; \ - fi - -docker.log: - @echo $(MESSAGE) "Building environment: ${stage} ${service}" - @if [ -z "${stage}" ] && [ -z "${service}" ]; then \ - $(docker-dev) logs -f ; \ - elif [ -z "${stage}" ] && [ -n "${service}" ]; then \ - $(docker-dev) logs -f ${service}; \ - elif [ -n "${stage}" ] && [ -z "${service}" ]; then \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml logs -f; \ - elif [ -n "${stage}" ] && [ -n "${service}" ]; then \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml logs -f ${service} ; \ - fi - -docker.down: - @echo $(MESSAGE) "Down Services Stage: ${stage}" - @if [ -z "${stage}" ]; then \ - $(docker-dev) down --remove-orphans; \ - $(docker-test) down --remove-orphans; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml down --remove-orphans; \ - fi - -docker.exec: - @echo $(MESSAGE) "Exec Services Stage: ${stage}" - @if [ -z "${stage}" ]; then \ - $(docker-dev) exec ${service} ${command} ; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml exec ${service} ${command} ; \ - fi - -docker.stop: - @echo $(MESSAGE) "Stop Services: ${stage}" - @if [ "${stage}" == "" ]; then \ - $(docker-dev) stop; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml stop; \ - fi - -docker.verify_network: ## Verify network - @if [ -z $$(docker network ls | grep $(DOCKER_NETWORK) | awk '{print $$2}') ]; then\ - (docker network create $(DOCKER_NETWORK));\ - fi - -docker.up: - @echo $(MESSAGE) "Up Services: ${stage}" - @if [ -z "${stage}" ]; then \ - $(docker-dev) up --remove-orphans; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml up --remove-orphans; \ - fi - -docker.list: - @echo $(MESSAGE) "List Services: ${stage}" - @if [ -z "${stage}" ]; then \ - $(docker-dev) ps; \ - else \ - $(docker-compose) -f ${PATH_DOCKER_COMPOSE}/${stage}.yml ps; \ - fi diff --git a/provision/make/docs.mk b/provision/make/docs.mk deleted file mode 100644 index 8431ab1..0000000 --- a/provision/make/docs.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -# See ./docs/contributing.md -# - -docs: - make docs.help - -docs.help: - @echo ' Docs:' - @echo '' - @echo ' docs.show Show grip readme' - @echo ' docs.build Show mkdocs' - @echo ' docs.serve server Make documentation' - @echo '' - -docs.show: - $(PIPENV_RUN) grip - -docs.build: - $(PIPENV_RUN) mkdocs build - -docs.serve: - $(PIPENV_RUN) mkdocs serve diff --git a/provision/make/git.mk b/provision/make/git.mk deleted file mode 100644 index 1967170..0000000 --- a/provision/make/git.mk +++ /dev/null @@ -1,42 +0,0 @@ -## Show commands help git -.PHONY: git.help -git.help: - @echo ' git:' - @echo '' - @echo ' git show help' - @echo ' git.setup install dependences to application' - @echo ' git.ignore ignore dependences to application' - @echo ' git.reviews add revieweers to git config' - @echo '' - -## Show commands git -.PHONY: git -git: - @if [ -z "${command}" ]; then \ - make git.help;\ - fi - - -## Setup all actions git ignore. -.PHONY: git.setup -git.setup: - @echo "==> setup git..." - make git.ignore - make git.reviews - -## Generate git ignore of files. -.PHONY: git.ignore -git.ignore: - @echo "==> git ignore generated..." - @$(GI) ${GIT_IGNORES} > .gitignore - @for ignore in ${GIT_IGNORES_CUSTOM} ; do \ - echo "$${ignore}" >> .gitignore ; \ - done - @echo ${MESSAGE_HAPPY} - -## Add reviewers to git config. -.PHONY: git.reviews -git.reviews: - @echo "==> add issues revievers..." - @git config github.reviews "${REVIEWERS}" - @echo ${MESSAGE_HAPPY} diff --git a/provision/make/gitflow.mk b/provision/make/gitflow.mk deleted file mode 100644 index d98b6c8..0000000 --- a/provision/make/gitflow.mk +++ /dev/null @@ -1,38 +0,0 @@ -## Show commands help gitflow -GITFLOW_PREFIX_FEATURE ?= "feature/" -.PHONY: gitflow.help - -gitflow.help: - @echo ' gitflow:' - @echo '' - @echo ' gitflow show help' - @echo ' gitflow.install install gitflow' - @echo ' gitflow.setup install gitflow setup' - @echo ' gitflow.prefix add dependences prefix for gitflow' - @echo '' - -## Show commands gitflow -.PHONY: gitflow -gitflow: - @if [ -z "${command}" ]; then \ - make gitflow.help;\ - fi - -## Setup all actions gitflow ignore. -.PHONY: gitflow.setup -gitflow.setup: - @echo "==> setup gitflow..." - make gitflow.prefix - -## Install gitflow. -.PHONY: gitflow.install -gitflow.install: - @echo "==> install gitflow..." - @gitflow init -d - -## Generate gitflow prefix of files. -.PHONY: gitflow.prefix -gitflow.prefix: - @echo "==> gitflow prefix generated..." - @git config gitflow.prefix.feature ${GITFLOW_PREFIX_FEATURE} - @echo ${MESSAGE_HAPPY} diff --git a/provision/make/python.mk b/provision/make/python.mk deleted file mode 100644 index 7a3421c..0000000 --- a/provision/make/python.mk +++ /dev/null @@ -1,55 +0,0 @@ -# python show help commands. -.PHONY: python.help -python.help: - @echo ' python:' - @echo '' - @echo ' python show help' - @echo ' python.environment make environment for python' - @echo ' python.lint lint python' - @echo ' python.fix fix code' - @echo ' python.precommit precommit install hooks' - @echo ' python.setup install dependences to application' - @echo '' - -## Show commands python -.PHONY: python -python: - @if [ -z "${command}" ]; then \ - make python.help;\ - fi - -## Run linter -.PHONY: python.lint -python.lint: - @echo "==> lint python..." - @echo ${MESSAGE_HAPPY} - -## Fix lint violations -.PHONY: python.fix -python.fix: - @echo "==> fix python..." - @echo ${MESSAGE_HAPPY} - -## setup download and install dependence. -.PHONY: python.setup -python.setup: - @echo "==> setup python..." - $(PIPENV_INSTALL) --dev --skip-lock - @echo ${MESSAGE_HAPPY} - -## environment make for python. -.PHONY: python.environment -python.environment: - @echo "==> environment python..." - pipenv --venv || $(PIPENV_INSTALL) --skip-lock - @echo ${MESSAGE_HAPPY} - -## python pre-commit make for python. -.PHONY: python.precommit -python.precommit: - @echo "==> install hooks for pre-commit..." - $(PIPENV_RUN) pre-commit install - $(PIPENV_RUN) pre-commit install -t pre-push - $(PIPENV_RUN) pre-commit install -t commit-msg - $(PIPENV_RUN) pre-commit install -t prepare-commit-msg - @echo ${MESSAGE_HAPPY} diff --git a/provision/make/tests.mk b/provision/make/tests.mk deleted file mode 100644 index e98f909..0000000 --- a/provision/make/tests.mk +++ /dev/null @@ -1,19 +0,0 @@ -test.help: - @echo ' Tests:' - @echo '' - @echo ' test show help' - @echo ' test.all Run all module test' - @echo ' test.lint Run all pre-commit' - @echo '' - -test: - @echo $(MESSAGE) Running tests on the current Python interpreter with coverage $(END) - make test.help - -test.all: - @echo $(MESSAGE) Running all tests $(END) - make test.lint - -test.lint: - @echo $(MESSAGE) Running validator for pre-commit $(END) - $(PIPENV_RUN) pre-commit run --all-files --verbose diff --git a/provision/make/utils.mk b/provision/make/utils.mk deleted file mode 100644 index 131819d..0000000 --- a/provision/make/utils.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# See ./docs/contributing.md -# -.PHONY: utils.help - -utils.help: - @echo ' utils:' - @echo '' - @echo ' utils help utils' - @echo ' utils.generate generate key ssh by stage' - @echo '' - -utils: - make utils.help - -utils.generate: - mkdir -p ${KEYBASE_PROJECT_PATH}/${stage}/{pem,pub,private,openssl} - mkdir -p ${KEYBASE_PROJECT_PATH}/${stage}/pub - mkdir -p ${KEYBASE_PROJECT_PATH}/${stage}/private - mkdir -p ${KEYBASE_PROJECT_PATH}/${stage}/openssl - - ssh-keygen -q -m PEM -t rsa -b 4096 -C "admin@${PROJECT}-${stage}.com" -f ${PROJECT}-${stage} -P "" - openssl rsa -in ${PROJECT}-${stage} -outform pem > ${PROJECT}-${stage}.pem - chmod 0600 ${PROJECT}-${stage}.pem - cp -rf ${PROJECT}-${stage}.pem ${KEYBASE_PROJECT_PATH}/${stage}/pem/ - cp -rf ${PROJECT}-${stage}.pub ${KEYBASE_PROJECT_PATH}/${stage}/pub/ - cp -rf ${PROJECT}-${stage} ${KEYBASE_PROJECT_PATH}/${stage}/private/ diff --git a/provision/make/yarn.mk b/provision/make/yarn.mk deleted file mode 100644 index dfb7188..0000000 --- a/provision/make/yarn.mk +++ /dev/null @@ -1,71 +0,0 @@ -# -# See ./docs/contributing.md -# - -## show commands help. -.PHONY: yarn.help -yarn.help: - @echo ' yarn:' - @echo '' - @echo ' yarn command=(build|dev|start|export)' - @echo ' yarn.setup Install dependences of project' - @echo ' yarn.install Install dependences' - @echo ' yarn.dev dev project' - @echo ' yarn.start run project' - @echo ' yarn.export export project' - @echo ' yarn.build build or with stage=(prod)' - @echo '' - -## Show commands yarn. -.PHONY: yarn -yarn: - @if [ -z "${command}" ]; then \ - make yarn.help;\ - fi - @if [ -n "${command}" ]; then \ - mkdir -p public;\ - $(docker-yarn-run) yarn ${command};\ - fi - -## Setup download and install dependence. -.PHONY: yarn.setup -yarn.setup: - @echo "==> setup dependence yarn..." - yarn install - @echo ${MESSAGE_HAPPY} - -## Setup environment nvm version node. -.PHONY: yarn.environment -yarn.environment: - @echo "==> environment yarn..." - nvm use ${NODE_VERSION} - @echo ${MESSAGE_HAPPY} - -## Install dependences in docker. -.PHONY: yarn.install -yarn.install: - $(docker-yarn-run) yarn install - -## Start yarn docker package. -.PHONY: yarn.start -yarn.start: - $(docker-yarn-run) yarn start - -## Build yarn docker package. -.PHONY: yarn.build -yarn.build: - @if [ -z "${stage}" ]; then \ - $(docker-yarn-run) yarn build; \ - else \ - $(docker-yarn-run) yarn build:${stage}; \ - fi - -## Run yarn dev docker. -.PHONY: yarn.dev -yarn.dev: - $(docker-yarn-run) yarn dev - -## Run yarn export with docker. -.PHONY: yarn.export -yarn.export: - $(docker-yarn-run) yarn export diff --git a/provision/task/changelog.yml b/provision/task/changelog.yml new file mode 100644 index 0000000..e6e2f64 --- /dev/null +++ b/provision/task/changelog.yml @@ -0,0 +1,58 @@ +version: "3" + +env: + TMP_CHANGELOG_FILENAME: TMP_CHANGELOG.md + +tasks: + check: + desc: Exist git-chglog + run: once + deps: + - task: check:go + - task: check:chglog + + check:chglog: + desc: Exist git-chglog + run: once + preconditions: + - sh: command -v git-chglog + msg: "Please install git-chglog" + + check:go: + desc: Exist go + run: once + preconditions: + - sh: command -v go + msg: "Please install go" + + install: + desc: install dependences git-chglog + run: once + cmds: + - go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest + deps: + - task: check:go + + generate: + desc: Generate changelog + run: once + cmds: + - git-chglog -o CHANGELOG.md + deps: + - task: check:chglog + + tag: + desc: Generate tag changelog + run: once + cmds: + - git-chglog {{.APP_TAG}} > {{.TMP_CHANGELOG_FILENAME}} + deps: + - task: check:chglog + + next: + desc: Generate next tag changelog + run: once + cmds: + - git-chglog --next-tag {{.APP_TAG}} --output CHANGELOG.md + deps: + - task: check:chglog diff --git a/provision/task/confluence.yml b/provision/task/confluence.yml new file mode 100644 index 0000000..d26b749 --- /dev/null +++ b/provision/task/confluence.yml @@ -0,0 +1,150 @@ +# https://taskfile.dev + +version: "3" + +tasks: + default: + desc: Show commands confluence + run: once + silent: true + cmds: + - cmd: task -l + + check: + desc: Exist Mark and dependences + run: once + deps: + - task: check:docker + - task: check:vars + + check:docker: + desc: Exist docker + run: once + preconditions: + - sh: command -v docker + msg: "Please Install docker" + + check:vars: + desc: Exist vars for mark + run: once + preconditions: + - sh: test -v CONFLUENCE_BASE_URL + msg: "Please add var environment CONFLUENCE_BASE_URL" + - sh: test -v CONFLUENCE_ACCESS_TOKEN + msg: "Please add var environment CONFLUENCE_ACCESS_TOKEN" + - sh: test -v CONFLUENCE_USER + msg: "Please add var environment CONFLUENCE_USER" + + make:credentials: + desc: run sync mark. + run: once + silent: true + cmds: + - cmd: echo initial sync files + - cmd: echo "" > config.log + - cmd: echo "username = '{{.CONFLUENCE_USER}}'" >> config.log + - cmd: echo "password = '{{.CONFLUENCE_ACCESS_TOKEN}}'" >> config.log + - cmd: echo "base_url = '{{.CONFLUENCE_BASE_URL}}'" >> config.log + deps: + - task: check + + sync: + desc: run sync mark. + run: once + cmds: + - cmd: >- + for file in {{.FILES_CONFLUENCE}}; do + echo "> Sync $file"; + docker run \ + --platform linux/amd64 \ + --rm \ + --workdir /usr/src/ \ + -v {{.PWD}}/:/usr/src/ \ + -v {{.PWD}}/config.log:/config/config.toml \ + kovetskiy/mark:latest mark --config /config/config.toml \ + --minor-edit \ + -f $file; + echo; + done + - cmd: echo ending sync files + deps: + - task: make:credentials + + sync:all: + desc: run sync mark branch develop. + run: once + deps: + - task: check + cmds: + - task: sync + vars: + FILES_CONFLUENCE: + sh: >- + find ./docs -type f -name '*.md' -print + | grep -v '.tpl.md' + | grep -v '^.terraform' + | xargs grep ' {{ end }} +{{ if has $confluence "parent" }} {{- end -}} +{{ if has $confluence "title" -}} {{ end }} +{{ if has $confluence "images" -}} +{{ range $image := $confluence.images -}} + +{{ end }} +{{ end }} +{{- end }} + + -{{ defineDatasource "config" .Env.README_YAML | regexp.Replace ".*" "" }} {{ defineDatasource "includes" .Env.README_INCLUDES | regexp.Replace ".*" "" }} - -{{ if has (ds "config") "confluence" }} -{{ $confluence := (ds "config").confluence }} -{{ if has $confluence "space" }} {{ end }} -{{ if has $confluence "parent" }} {{ end }} -{{ if has $confluence "title" }} {{ end }} -{{ end }} - {{ if has (ds "config") "badges" }}{{- range $badge := (ds "config").badges -}}{{ printf " [![%s](%s)](%s)" $badge.name $badge.image $badge.url }}{{ end }}{{ end }} # {{(ds "config").name}}{{ if gt (len (ds "config").name) 34 }}{{ print "\n\n" }}{{ end }} -{{ if has (ds "config") "logo" }} ![{{(ds "config").name}}]({{ (ds "config").logo }}) {{- end -}} +{{ if has (ds "config") "logo" -}} ![{{(ds "config").name}}]({{ (ds "config").logo }}) {{ end }} -{{ if has (ds "config") "description" }} {{(ds "config").description }} {{ end }} +{{ if has (ds "config") "description" -}} {{(ds "config").description }} {{ end }} {{ if has (ds "config") "screenshots" }} @@ -39,6 +43,7 @@ {{ end }}{{ end }} {{ if has (ds "config") "features" }} + ## Features {{ range $feature := (ds "config").features }}{{printf "- %s\n" $feature}}{{ end }} {{ end }} @@ -49,7 +54,6 @@ {{ (ds "config").introduction -}} {{ end }} - {{ if has (ds "config") "todo" }} ## TODO @@ -65,20 +69,23 @@ {{ (ds "config").requirements -}} {{ end }} - {{ if has (ds "config") "installation" }} + ## Installation + {{ range $file := (datasource "config").installation -}} {{ (include "includes" $file) }} {{- end }} {{- end }} -{{ if has (ds "config") "usage" }} +{{ if has (ds "config") "usages" }} ## Usage -{{ (ds "config").usage -}} {{ end }} - +{{ range $file := (datasource "config").usages -}} +{{ (include "includes" $file) }} +{{- end }} +{{ end }} {{ if has (ds "config") "quickstart" -}} @@ -121,26 +128,17 @@ For additional context, refer to some of these links. ## Help **Got a question?** - +{{ if has (ds "config") "github_repo" }} File a GitHub [issue]({{ printf "https://github.com/%s/issues" (ds "config").github_repo}}). +{{ else if has (ds "config") "gitlab_host" }} +File a GitLab [issue]({{ printf "https://%s/%s/-/issues" (ds "config").gitlab_host (ds "config").gitlab_repo}}). +{{ else if has (ds "config") "gitlab_repo" }} +File a GitLab [issue]({{ printf "https://gitlab.com/%s/-/issues" (ds "config").gitlab_repo}}). +{{ end }} ## Contributing -### Bug Reports & Feature Requests - -Please use the [issue tracker]({{ printf "https://github.com/%s/issues" (ds "config").github_repo}}) to report any bugs or file feature requests. - -### Development - -In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. - -1. **Fork** the repo on GitHub -2. **Clone** the project to your own machine -3. **Commit** changes to your own branch -4. **Push** your work back up to your fork -5. Submit a **Pull Request** so that we can review your changes - -**NOTE:** Be sure to rebase the latest changes from "upstream" before making a pull request! +See [Contributing](./docs/contributing.md). ## Module Versioning @@ -211,4 +209,10 @@ The code and styles are licensed under the {{(ds "config").license }} license [S ## Don't forget to 🌟 Star 🌟 the repo if you like {{(ds "config").name}} +{{ if has (ds "config") "github_repo" }} [Your feedback is appreciated]({{ printf "https://github.com/%s/issues" (ds "config").github_repo}}) +{{ else if has (ds "config") "gitlab_host" }} +[Your feedback is appreciated]({{ printf "https://%s/%s/-/issues" (ds "config").gitlab_host (ds "config").gitlab_repo}}) +{{ else if has (ds "config") "gitlab_repo" }} +[Your feedback is appreciated]({{ printf "https://gitlab.com/%s/-/issues" (ds "config").gitlab_repo}}) +{{ end }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d4493fa --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[tool.poetry] +name = "zsh-rvm" +version = "0.0.0" +description = "zsh plugin name" +authors = ["Luis Mayta "] +license = "LGPL-3.0" +readme = "README.md" +repository = "https://github.com/hadenlabs/zsh-rvm" + +[tool.poetry.dependencies] +python = "^3.9,<3.12" +boto3 = "^1.26.130" + +[tool.poetry.group.dev.dependencies] +requests = "^2.28.2" +bridgecrew = "*" +doc8 = "*" +grip = "*" +isort = "*" +mkdocs = "*" +mkdocs-material = "*" +mypy = "*" +parso = "*" +pre-commit = "*" +pycodestyle = "*" +pydocstyle = "*" +pygments = "*" +pylint = "*" +pymdown-extensions = "*" +pytest = ">=6.2.4" +black = "*" +bumpversion = "*" + +[tool.poetry.extras] +docs = ["mkdocs", "mkdocs-material"] + +[tool.poetry_bumpversion.file."sonar-project.properties"] +search = 'sonar.projectVersion={current_version}' +replace = 'sonar.projectVersion={new_version}' + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..80a5037 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.organization=hadenlabs +sonar.projectKey=hadenlabs:zsh-rvm +sonar.projectVersion=0.0.0 +sonar.projectBaseDir=./ +sonar.sources=./ +sonar.coverage.dtdVerification=false +sonar.coverage.exclusions=provision +sonar.sourceEncoving=UTF-8