From 74c534abf66b5dede5d2e573f8d6366720f77592 Mon Sep 17 00:00:00 2001 From: Kamil Samigullin Date: Mon, 9 Jan 2023 08:18:03 +0300 Subject: [PATCH] snapshot 2023-01-01 --- .github/actions/notify/action.yml | 58 ++++++++++++ .github/dependabot.yml | 41 +++++++++ .github/settings.yml | 131 +++++++++++++++++++++++++++ .github/workflows/cd.urls.yml | 91 +++++++++++++++++++ .github/workflows/cleanup.caches.yml | 52 +++++++++++ .github/workflows/cleanup.runs.yml | 75 +++++++++++++++ .github/workflows/warmup.caches.yml | 54 +++++++++++ .gitignore | 3 + .gitmodules | 120 ++++++++++++++++++++++++ LICENSE | 21 +++++ Makefile | 9 ++ README.md | 21 +++++ Taskfile | 21 +++++ bin/.gitignore | 3 + bin/lib/config/global.bash | 34 +++++++ bin/lib/core/compile.bash | 11 +++ bin/lib/core/modules.bash | 56 ++++++++++++ bin/lib/git/core.bash | 22 +++++ bin/lib/git/submodule.bash | 12 +++ bin/lib/main.bash | 20 ++++ bin/lib/x/proxy.bash | 14 +++ go.work | 34 +++++++ src/airseat | 1 + src/beads | 1 + src/breakit | 1 + src/cli | 1 + src/click | 1 + src/config | 1 + src/fiddle | 1 + src/forma | 1 + src/go-module | 1 + src/go-service | 1 + src/go-tool | 1 + src/guard | 1 + src/inbox | 1 + src/inboxes/github | 1 + src/inboxes/trello | 1 + src/loop | 1 + src/maintainer | 1 + src/optflow | 1 + src/parallel | 1 + src/passport | 1 + src/pkg | 1 + src/propaganda | 1 + src/protocol | 1 + src/secret | 1 + src/sparkle | 1 + src/tablo | 1 + src/tact | 1 + src/testit | 1 + src/try | 1 + 51 files changed, 932 insertions(+) create mode 100644 .github/actions/notify/action.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/settings.yml create mode 100644 .github/workflows/cd.urls.yml create mode 100644 .github/workflows/cleanup.caches.yml create mode 100644 .github/workflows/cleanup.runs.yml create mode 100644 .github/workflows/warmup.caches.yml create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100755 Taskfile create mode 100644 bin/.gitignore create mode 100644 bin/lib/config/global.bash create mode 100644 bin/lib/core/compile.bash create mode 100644 bin/lib/core/modules.bash create mode 100644 bin/lib/git/core.bash create mode 100644 bin/lib/git/submodule.bash create mode 100644 bin/lib/main.bash create mode 100644 bin/lib/x/proxy.bash create mode 100644 go.work create mode 160000 src/airseat create mode 160000 src/beads create mode 160000 src/breakit create mode 160000 src/cli create mode 160000 src/click create mode 160000 src/config create mode 160000 src/fiddle create mode 160000 src/forma create mode 160000 src/go-module create mode 160000 src/go-service create mode 160000 src/go-tool create mode 160000 src/guard create mode 160000 src/inbox create mode 160000 src/inboxes/github create mode 160000 src/inboxes/trello create mode 160000 src/loop create mode 160000 src/maintainer create mode 160000 src/optflow create mode 160000 src/parallel create mode 160000 src/passport create mode 160000 src/pkg create mode 160000 src/propaganda create mode 160000 src/protocol create mode 160000 src/secret create mode 160000 src/sparkle create mode 160000 src/tablo create mode 160000 src/tact create mode 160000 src/testit create mode 160000 src/try diff --git a/.github/actions/notify/action.yml b/.github/actions/notify/action.yml new file mode 100644 index 0000000..a07306e --- /dev/null +++ b/.github/actions/notify/action.yml @@ -0,0 +1,58 @@ +name: Define notification message +description: Identify an appropriate notification message. +branding: + icon: 'message-square' + color: 'green' + +inputs: + emoji: + description: Prefix for the title. + default: 🤖 + + channel: + description: Notification channel. + required: true + + success: + description: Is the result successful? + required: true + default: 'true' + +runs: + using: composite + steps: + - name: Define notification message + id: message + run: | + if [ '${{ github.event.head_commit.message != null }}' == 'true' ] + then + (cat <<-message + txt=${{ github.event.head_commit.message }} + message + ) | head -1 >> $GITHUB_OUTPUT + + elif [ '${{ github.event.inputs.reason != null }}' == 'true' ] + then + (cat <<-message + txt=${{ github.event.inputs.reason }} + message + ) | head -1 >> $GITHUB_OUTPUT + + elif [ '${{ github.event.schedule != null }}' == 'true' ] + then + echo txt='regular healthcheck' >> $GITHUB_OUTPUT + else + echo Cannot define notification message && exit 1 + fi + shell: bash + + - name: Send Slack notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: ${{ inputs.success == 'true' && 'success' || 'failure' }} + SLACK_FOOTER: made with ❤️ for everyone by + SLACK_ICON: https://cdn.octolab.org/geek/octolab.png + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} + SLACK_TITLE: '${{ inputs.emoji }} ${{ github.repository }}: ${{ github.workflow }}' + SLACK_USERNAME: Notifier + SLACK_WEBHOOK: ${{ inputs.channel }} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bca510a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,41 @@ +version: 2 + +registries: + github: + type: git + url: https://github.com + username: x-access-token + password: ${{ secrets.DEPENDABOT_TOKEN }} + +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + time: '05:00' + timezone: UTC + labels: + - 'type: improvement' + - 'scope: inventory' + - 'scope: deps' + commit-message: + prefix: 'ci/cd' + include: 'scope' + open-pull-requests-limit: 30 + + - package-ecosystem: gitsubmodule + registries: + - github + directory: / + schedule: + interval: daily + time: '05:00' + timezone: UTC + labels: + - 'type: improvement' + - 'scope: code' + - 'scope: deps' + commit-message: + prefix: 'feat' + include: 'scope' + open-pull-requests-limit: 30 diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..66f7f6e --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,131 @@ +repository: + has_wiki: false + has_issues: true + has_projects: false + + allow_forking: true + + allow_auto_merge: false + allow_merge_commit: false + allow_squash_merge: false + allow_rebase_merge: true + allow_update_branch: false + delete_branch_on_merge: true + + default_branch: main + + enable_vulnerability_alerts: true + enable_automated_security_fixes: true + +branches: + - name: main + protection: + required_linear_history: true + +labels: + - name: 'type: bug' + color: '#DA0064' + description: | + A new bug report. + - name: 'type: feature' + color: '#9510AC' + description: | + A new feature request. + - name: 'type: improvement' + color: '#0CA789' + description: | + A new improvement proposal. + + - name: 'severity: critical' + color: '#F24727' + description: | + A bug has critical severity and needs to be fixed as soon as possible. + - name: 'severity: major' + color: '#EF8D79' + description: | + A bug has major severity and needs to be fixed in the nearest iteration. + - name: 'severity: minor' + color: '#FBC7BD' + description: | + A bug has minor severity and should be fixed when possible. + + - name: 'scope: code' + color: '#808080' + description: | + An issue related to source code. + - name: 'scope: deps' + color: '#949494' + description: + An issue related to dependencies. + - name: 'scope: docs' + color: '#ADADAD' + description: | + An issue related to documentation. + - name: 'scope: test' + color: '#D9D9D9' + description: | + An issue related to tests. + - name: 'scope: inventory' + color: '#EAEAEA' + description: | + An issue related to auxiliary code, e.g. CI config, Makefiles, etc. + + - name: 'impact: high' + color: '#652CB3' + description: | + An issue has high impact. + - name: 'impact: medium' + color: '#A380D1' + description: | + An issue has medium impact. + - name: 'impact: low' + color: '#CAB9E1' + description: | + An issue has low impact. + + - name: 'effort: hard' + color: '#414BB2' + description: | + An issue is hard to implement or reproduce. + - name: 'effort: medium' + color: '#8D93D1' + description: | + An issue has a medium complexity. + - name: 'effort: easy' + color: '#C6C9E8' + description: | + An issue is easy to implement. + + - name: 'status: pending' + color: '#2D9BF1' + description: | + Mark an issue as hold. + - name: 'status: stale' + color: '#3A3A3A' + description: | + Mark an issue as stale. + + - name: duplicate + color: '#F8961E' + description: | + An issue or pull request already exists. + - name: good first issue + color: '#90BE6D' + description: | + Good for newcomers. + - name: help wanted + color: '#577590' + description: | + Extra attention is needed. + - name: invalid + color: '#F94144' + description: | + This doesn't seem right. + - name: question + color: '#43AA8B' + description: | + Further information is requested. + - name: wontfix + color: '#F9C74F' + description: | + This will not be worked on. diff --git a/.github/workflows/cd.urls.yml b/.github/workflows/cd.urls.yml new file mode 100644 index 0000000..dd97f40 --- /dev/null +++ b/.github/workflows/cd.urls.yml @@ -0,0 +1,91 @@ +name: Continuous delivery + +on: + push: + branches: [ main ] + paths: + - '.github/workflows/cd.urls.yml' + - 'bin/lib/**/*.bash' + - 'src/**/*' + - 'go.work' + - 'Makefile' + - 'Taskfile' + + schedule: + - cron: 0 7 1 * * # at 07:00 on day-of-month 1, UTC + + workflow_dispatch: + inputs: + reason: + description: The reason for dispatching it manually. + type: string + default: manual healthcheck + required: true + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + name: Building + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + token: ${{ secrets.DEPENDABOT_TOKEN }} + - name: Install dependencies + run: curl -sSfL https://install.octolab.org/maintainer | sh -s -- -b /usr/local/bin -dx + - name: Set up GitHub Pages + uses: actions/configure-pages@v3 + - name: Set up Go environment + uses: actions/setup-go@v4 + with: { go-version: 1.21.x, cache-dependency-path: src/*/go.sum, check-latest: true } + + - name: Build static HTML + run: make + env: + GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }} + - name: Upload the documentation + uses: actions/upload-pages-artifact@v2 + with: { path: dist } + + deploy: + name: Deploying + needs: [ build ] + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + contents: read + id-token: write + pages: write + + steps: + - name: Deploy it to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 + + notify: + name: Notifying + needs: [ build, deploy ] + runs-on: ubuntu-latest + if: failure() || success() + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: { fetch-depth: 0 } + + - name: Send notification + uses: ./.github/actions/notify + continue-on-error: true + with: + emoji: 🤴 + channel: ${{ secrets.SLACK_WEBHOOK }} + success: ${{ ! contains(needs.*.result, 'failure') }} diff --git a/.github/workflows/cleanup.caches.yml b/.github/workflows/cleanup.caches.yml new file mode 100644 index 0000000..a564078 --- /dev/null +++ b/.github/workflows/cleanup.caches.yml @@ -0,0 +1,52 @@ +name: Workflow caches cleanup + +on: + schedule: + - cron: 0 6 1 * * # at 06:00 on day-of-month 1, UTC + + workflow_dispatch: + inputs: + reason: + description: The reason for dispatching it manually. + type: string + default: manual healthcheck + required: true + +jobs: + delete: + name: Deleting + runs-on: ubuntu-latest + + env: + GITHUB_TOKEN: ${{ github.token }} + + steps: + - name: Install the GitHub CLI cache extension + run: gh extension install actions/gh-actions-cache + + - name: Cleanup caches + run: | + echo Deleting caches... + for key in $(gh actions-cache list -L 100 -R '${{ github.repository }}' | cut -f 1); do + gh actions-cache delete "${key}" -R '${{ github.repository }}' --confirm || true + done + echo Done + + notify: + name: Notifying + needs: [ delete ] + runs-on: ubuntu-latest + if: failure() || success() + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: { fetch-depth: 0 } + + - name: Send notification + uses: ./.github/actions/notify + continue-on-error: true + with: + emoji: 🧹 + channel: ${{ secrets.SLACK_WEBHOOK }} + success: ${{ ! contains(needs.*.result, 'failure') }} diff --git a/.github/workflows/cleanup.runs.yml b/.github/workflows/cleanup.runs.yml new file mode 100644 index 0000000..5a707f7 --- /dev/null +++ b/.github/workflows/cleanup.runs.yml @@ -0,0 +1,75 @@ +name: Workflow runs cleanup + +on: + schedule: + - cron: 0 6 1 * * # at 06:00 on day-of-month 1, UTC + + workflow_dispatch: + inputs: + pattern: + description: The name of workflow to clean. + type: choice + options: + - All + - Continuous delivery + - Workflow caches cleanup + - Workflow caches warmup + - Workflow runs cleanup + default: Workflow runs cleanup + required: true + dry_run: + description: Only log actions, do not perform any delete operations. + type: boolean + required: false + reason: + description: The reason for dispatching it manually. + type: string + default: manual healthcheck + required: true + +jobs: + delete: + name: Deleting + runs-on: ubuntu-latest + + steps: + - name: Delete workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + delete_workflow_pattern: ${{ github.event.inputs.pattern || 'all' }} + dry_run: ${{ fromJSON('["", "true"]')[github.event.inputs.dry_run == 'true'] }} + retain_days: 0 + keep_minimum_runs: 0 + - name: Cleanup workflow runs + run: | + gh run list \ + -R '${{ github.repository }}' \ + --status completed \ + --limit 100 \ + --json databaseId \ + --jq '.[] | .databaseId' | + xargs -n1 --no-run-if-empty gh run delete -R '${{ github.repository }}' + env: + GITHUB_TOKEN: ${{ github.token }} + if: github.event.inputs.pattern == 'All' + + notify: + name: Notifying + needs: [ delete ] + runs-on: ubuntu-latest + if: failure() || success() + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: { fetch-depth: 0 } + + - name: Send notification + uses: ./.github/actions/notify + continue-on-error: true + with: + emoji: 🧹 + channel: ${{ secrets.SLACK_WEBHOOK }} + success: ${{ ! contains(needs.*.result, 'failure') }} diff --git a/.github/workflows/warmup.caches.yml b/.github/workflows/warmup.caches.yml new file mode 100644 index 0000000..48ebcb8 --- /dev/null +++ b/.github/workflows/warmup.caches.yml @@ -0,0 +1,54 @@ +name: Workflow caches warmup + +on: + workflow_dispatch: + inputs: + reason: + description: The reason for dispatching it manually. + type: string + default: manual healthcheck + required: true + + workflow_run: + workflows: [ Workflow caches cleanup ] + types: [ completed ] + +jobs: + cache: + name: Caching Go modules + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + token: ${{ secrets.DEPENDABOT_TOKEN }} + - name: Set up Go environment + uses: actions/setup-go@v4 + with: { go-version: 1.21.x, cache-dependency-path: src/*/go.sum, check-latest: true } + + - name: Fetch dependencies + run: make list + env: + GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }} + + notify: + name: Notifying + needs: [ cache ] + runs-on: ubuntu-latest + if: failure() || success() + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: { fetch-depth: 0 } + + - name: Send notification + uses: ./.github/actions/notify + continue-on-error: true + with: + emoji: ♻️ + channel: ${{ secrets.SLACK_WEBHOOK }} + success: ${{ ! contains(needs.*.result, 'failure') }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81a9620 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/dist/ + +go.work.sum diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3b38a3e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,120 @@ +[submodule "src/go-module"] + name = go.octolab.org/template/module + path = src/go-module + url = git@github.com:octomation/go-module.git +[submodule "src/go-tool"] + name = go.octolab.org/template/tool + path = src/go-tool + url = git@github.com:octomation/go-tool.git +[submodule "src/go-service"] + name = go.octolab.org/template/service + path = src/go-service + url = git@github.com:octomation/go-service.git +[submodule "src/inbox"] + name = go.octolab.org/template/inbox + path = src/inbox + url = git@github.com:tact-app/inbox.git + +[submodule "src/beads"] + name = go.octolab.org/ecosystem/beads + path = src/beads + url = git@github.com:tact-app/beads.git +[submodule "src/click"] + name = go.octolab.org/ecosystem/click + path = src/click + url = git@github.com:tact-app/click.git +[submodule "src/forma"] + name = go.octolab.org/ecosystem/forma + path = src/forma + url = git@github.com:octopot/forma.git +[submodule "src/guard"] + name = go.octolab.org/ecosystem/guard + path = src/guard + url = git@github.com:octopot/guard.git +[submodule "src/passport"] + name = go.octolab.org/ecosystem/passport + path = src/passport + url = git@github.com:octopot/passport.git +[submodule "src/sparkle"] + name = go.octolab.org/ecosystem/sparkle + path = src/sparkle + url = git@github.com:withsparkle/service.git +[submodule "src/tablo"] + name = go.octolab.org/ecosystem/tablo + path = src/tablo + url = git@github.com:octomation/tablo.git +[submodule "src/tact"] + name = go.octolab.org/ecosystem/tact + path = src/tact + url = git@github.com:tact-app/service.git + +[submodule "src/airseat"] + name = go.octolab.org/toolset/airseat + path = src/airseat + url = git@github.com:tact-app/airseat.git +[submodule "src/breakit"] + name = go.octolab.org/toolset/breakit + path = src/breakit + url = git@github.com:octolab/breakit.git +[submodule "src/fiddle"] + name = go.octolab.org/toolset/fiddle + path = src/fiddle + url = git@github.com:withsparkle/fiddle.git +[submodule "src/loop"] + name = go.octolab.org/toolset/loop + path = src/loop + url = git@github.com:tact-app/loop.git +[submodule "src/maintainer"] + name = go.octolab.org/toolset/maintainer + path = src/maintainer + url = git@github.com:octomation/maintainer.git +[submodule "src/optflow"] + name = go.octolab.org/toolset/optflow + path = src/optflow + url = git@github.com:tact-app/optflow.git +[submodule "src/parallel"] + name = go.octolab.org/toolset/parallel + path = src/parallel + url = git@github.com:octolab/parallel.git +[submodule "src/secret"] + name = go.octolab.org/toolset/secret + path = src/secret + url = git@github.com:tact-app/secret.git +[submodule "src/testit"] + name = go.octolab.org/toolset/testit + path = src/testit + url = git@github.com:octolab/testit.git +[submodule "src/try"] + name = go.octolab.org/toolset/try + path = src/try + url = git@github.com:octolab/try.git + +[submodule "src/inboxes/github"] + name = go.octolab.org/tact/inbox/github + path = src/inboxes/github + url = git@github.com:tact-app/github.git +[submodule "src/inboxes/trello"] + name = go.octolab.org/tact/inbox/trello + path = src/inboxes/trello + url = git@github.com:tact-app/trello.git + +[submodule "src/pkg"] + name = go.octolab.org + path = src/pkg + url = git@github.com:octolab/pkg.git +[submodule "src/cli"] + name = go.octolab.org/toolkit/cli + path = src/cli + url = git@github.com:octolab/cli.git +[submodule "src/config"] + name = go.octolab.org/toolkit/config + path = src/config + url = git@github.com:octolab/config.git +[submodule "src/propaganda"] + name = go.octolab.org/propaganda + path = src/propaganda + url = git@github.com:octolab/propaganda.git +[submodule "src/protocol"] + name = go.octolab.org/toolkit/protocol + path = src/protocol + url = git@github.com:octolab/protocol.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..dcf858a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 OctoLab, https://www.octolab.org/ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4192dbd --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.DEFAULT_GOAL = compile + +compile: + @ ./Taskfile compile +.PHONY: compile + +list: + @ ./Taskfile modules +.PHONY: list diff --git a/README.md b/README.md new file mode 100644 index 0000000..f0ea691 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +[![Vanity URLs][social.preview]][preview.config] + +[![Mirror][mirror.icon]][mirror.page] + +# 🤴 go.octolab.org + +Vanity URLs for OctoLab's Go modules. + +## 🔗 Dependencies + +- [Maintainer](https://maintainer.octolab.org/) +- [GitHub CLI](https://cli.github.com/) + +

made with ❤️ for everyone by OctoLab

+ +[social.preview]: https://cdn.octolab.org/repo/vanity.png +[preview.config]: https://socialify.git.ci/octomation/vanity?description=1&font=Raleway&language=1&name=1&owner=1&pattern=Circuit%20Board&theme=Light +[preview.fallback]: https://socialify.git.ci/octomation/vanity/image?description=1&font=Raleway&language=1&name=1&owner=1&pattern=Circuit%20Board&theme=Light + +[mirror.page]: https://bitbucket.org/kamilsk/vanity +[mirror.icon]: https://img.shields.io/badge/mirror-bitbucket-blue diff --git a/Taskfile b/Taskfile new file mode 100755 index 0000000..05a568a --- /dev/null +++ b/Taskfile @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[ "${BASH_VERSINFO:-0}" -ge 4 ] || { + echo "bash version 4 or higher is required" >&2 + exit 1 +} + +root=$(git rev-parse --show-toplevel) +include=( + "${root}"/bin/lib/git/*.bash + "${root}"/bin/lib/config/*.bash + "${root}"/bin/lib/core/*.bash + "${root}"/bin/lib/main.bash +) + +for script in "${include[@]}"; do + # shellcheck source=bin/lib/main.bash + source "${script}" +done diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..eb9e537 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,3 @@ +/* +!/lib +!/.gitignore diff --git a/bin/lib/config/global.bash b/bin/lib/config/global.bash new file mode 100644 index 0000000..c3d9bf4 --- /dev/null +++ b/bin/lib/config/global.bash @@ -0,0 +1,34 @@ +declare -A config +config['shift']=0 +config['dryrun']=false + +@handle() { + local arg skip=false + for arg in "${@}"; do + if $skip; then + skip=false + continue + fi + + case "${arg}" in + -d | --dry-run) + config['dryrun']=true + config['shift']=$((config['shift'] + 1)) + shift + ;; + --trace) + set -x + config['shift']=$((config['shift'] + 1)) + shift + ;; + *) break ;; + esac + done +} + +@config() { + local key + for key in "${!config[@]}"; do + printf "[%s]=%s\n" "${key}" "${config[${key}]}" + done +} diff --git a/bin/lib/core/compile.bash b/bin/lib/core/compile.bash new file mode 100644 index 0000000..69291d1 --- /dev/null +++ b/bin/lib/core/compile.bash @@ -0,0 +1,11 @@ +# shellcheck source=modules.bash # modules + +compile() { + mkdir -p dist && rm -rf dist/* + modules | tee dist/modules.yml + + pushd dist >/dev/null || exit 1 + maintainer go vanity build -f modules.yml + tree . + popd >/dev/null || exit 1 +} diff --git a/bin/lib/core/modules.bash b/bin/lib/core/modules.bash new file mode 100644 index 0000000..b5d1057 --- /dev/null +++ b/bin/lib/core/modules.bash @@ -0,0 +1,56 @@ +modules() { + local module name path git url + for module in $(@modules); do + name=$( + git config --file .gitmodules --get-regexp "submodule\.${module}\.name" | + awk '{print $2}' + ) + path=$( + git config --file .gitmodules --get-regexp "submodule\.${module}\.path" | + awk '{print $2}' + ) + git=$( + git config --file .gitmodules --get-regexp "submodule\.${module}\.url" | + awk '{print $2}' + ) + url=$( + echo "${git}" | + sed -e 's|:|/|' -e 's|^git@|https://|' -e 's|\.git$||' + ) + + if ! go list -m | grep -q "^${name}$"; then continue; fi + + local branch tags packages + branch=$( + gh repo view --json defaultBranchRef \ + --jq '.defaultBranchRef.name' \ + "${git}" + ) + tags=$( + gh repo view --json repositoryTopics \ + --jq '.repositoryTopics? | select(. != null) | map(.name) | join(", ")' \ + "${git}" + ) + packages=$'\n' + packages+=$(go list "./${path}/..." | sed 's|^| - |') + + cat < +Tasks: +EOF + compgen -A function | grep -Ev '^(@|_|-|\+)' | sort | cat -n +} + +@main() { + @handle "${@}" + shift "${config['shift']}" + [ -f .env ] && source .env + "${@:-@usage}" +} + +@main "${@}" diff --git a/bin/lib/x/proxy.bash b/bin/lib/x/proxy.bash new file mode 100644 index 0000000..43eb7e3 --- /dev/null +++ b/bin/lib/x/proxy.bash @@ -0,0 +1,14 @@ +@warmup() { + local module=${1} version=${2} + curl -v "https://proxy.golang.org/${module}/@v/${version}.info" +} + +@test() { + local module=${1} version=${2} tmp + + tmp=$(mktemp -d) + pushd "${tmp}" >/dev/null || exit 1 + go mod init test + GOPROXY=https://proxy.golang.org GO111MODULE=on go get "${module}@${version}" + popd >/dev/null || exit 1 +} diff --git a/go.work b/go.work new file mode 100644 index 0000000..412a236 --- /dev/null +++ b/go.work @@ -0,0 +1,34 @@ +go 1.21 + +toolchain go1.21.0 + +use ( + ./src/airseat + ./src/beads + ./src/breakit + ./src/cli + ./src/click + ./src/config + ./src/fiddle + ./src/forma + ./src/go-module + ./src/go-service + ./src/go-tool + ./src/guard + ./src/inbox + ./src/inboxes/github + ./src/inboxes/trello + ./src/loop + ./src/maintainer + ./src/optflow + ./src/parallel + ./src/passport + ./src/pkg + ./src/propaganda + ./src/protocol + ./src/secret + ./src/tablo + ./src/tact + ./src/testit + ./src/try +) diff --git a/src/airseat b/src/airseat new file mode 160000 index 0000000..15bb864 --- /dev/null +++ b/src/airseat @@ -0,0 +1 @@ +Subproject commit 15bb8640595841210313aa379568ee6fab7ebb1d diff --git a/src/beads b/src/beads new file mode 160000 index 0000000..1e1174c --- /dev/null +++ b/src/beads @@ -0,0 +1 @@ +Subproject commit 1e1174c9ebb18d8a5e5ace546fb5c9081a7b5e53 diff --git a/src/breakit b/src/breakit new file mode 160000 index 0000000..264b055 --- /dev/null +++ b/src/breakit @@ -0,0 +1 @@ +Subproject commit 264b0552f9bcf9a52dc3497c189f35d81ca2d39f diff --git a/src/cli b/src/cli new file mode 160000 index 0000000..d3a8508 --- /dev/null +++ b/src/cli @@ -0,0 +1 @@ +Subproject commit d3a8508eadb758359ef9573f9d9001a54203dd53 diff --git a/src/click b/src/click new file mode 160000 index 0000000..edc3545 --- /dev/null +++ b/src/click @@ -0,0 +1 @@ +Subproject commit edc35450c123f4e9b25601e37997401ddfc18171 diff --git a/src/config b/src/config new file mode 160000 index 0000000..d8771f2 --- /dev/null +++ b/src/config @@ -0,0 +1 @@ +Subproject commit d8771f2543c7ba504bf8e9def5cccbb241c86574 diff --git a/src/fiddle b/src/fiddle new file mode 160000 index 0000000..67348e3 --- /dev/null +++ b/src/fiddle @@ -0,0 +1 @@ +Subproject commit 67348e38dc8e6773b5f89abfda954c713afb9335 diff --git a/src/forma b/src/forma new file mode 160000 index 0000000..17ece98 --- /dev/null +++ b/src/forma @@ -0,0 +1 @@ +Subproject commit 17ece98eedf4ec2d747f0be243897f31565983cd diff --git a/src/go-module b/src/go-module new file mode 160000 index 0000000..9157804 --- /dev/null +++ b/src/go-module @@ -0,0 +1 @@ +Subproject commit 9157804b598a80c375f2837d59e438bf670a8a3a diff --git a/src/go-service b/src/go-service new file mode 160000 index 0000000..16e95fe --- /dev/null +++ b/src/go-service @@ -0,0 +1 @@ +Subproject commit 16e95fef2c512b8518c7dc535728bfdb588de7ba diff --git a/src/go-tool b/src/go-tool new file mode 160000 index 0000000..457f9c3 --- /dev/null +++ b/src/go-tool @@ -0,0 +1 @@ +Subproject commit 457f9c3b65c5ca7aade696bfcc2b3ce60fc22df3 diff --git a/src/guard b/src/guard new file mode 160000 index 0000000..5e220c6 --- /dev/null +++ b/src/guard @@ -0,0 +1 @@ +Subproject commit 5e220c6b649457ee98296c8b4de7fb7459387a61 diff --git a/src/inbox b/src/inbox new file mode 160000 index 0000000..3bdefd4 --- /dev/null +++ b/src/inbox @@ -0,0 +1 @@ +Subproject commit 3bdefd4d4ebc1e3a01dd655474ebfa42e58cdbc5 diff --git a/src/inboxes/github b/src/inboxes/github new file mode 160000 index 0000000..fd9e06a --- /dev/null +++ b/src/inboxes/github @@ -0,0 +1 @@ +Subproject commit fd9e06ad3b56406b5c7937c72890331fa3ca1206 diff --git a/src/inboxes/trello b/src/inboxes/trello new file mode 160000 index 0000000..1323138 --- /dev/null +++ b/src/inboxes/trello @@ -0,0 +1 @@ +Subproject commit 1323138c55d3e7da0b9bd05d8af1ffad4274fbc3 diff --git a/src/loop b/src/loop new file mode 160000 index 0000000..82496c2 --- /dev/null +++ b/src/loop @@ -0,0 +1 @@ +Subproject commit 82496c2d7ebe6a2db78c603f9b7159037b9c7910 diff --git a/src/maintainer b/src/maintainer new file mode 160000 index 0000000..5cdc676 --- /dev/null +++ b/src/maintainer @@ -0,0 +1 @@ +Subproject commit 5cdc676d402252c934acf104ad75e266d0064121 diff --git a/src/optflow b/src/optflow new file mode 160000 index 0000000..4678d3d --- /dev/null +++ b/src/optflow @@ -0,0 +1 @@ +Subproject commit 4678d3dc506ced32f5e04172e91f4cfb12c7865c diff --git a/src/parallel b/src/parallel new file mode 160000 index 0000000..700bb7c --- /dev/null +++ b/src/parallel @@ -0,0 +1 @@ +Subproject commit 700bb7ce9a20e56be1f7b263a0575da02dcf26a4 diff --git a/src/passport b/src/passport new file mode 160000 index 0000000..0965997 --- /dev/null +++ b/src/passport @@ -0,0 +1 @@ +Subproject commit 09659973d9cf50730ff740ded3a820507c587f0b diff --git a/src/pkg b/src/pkg new file mode 160000 index 0000000..22a5242 --- /dev/null +++ b/src/pkg @@ -0,0 +1 @@ +Subproject commit 22a52424e46bb94908ef9a5f94bff7c78f60d14f diff --git a/src/propaganda b/src/propaganda new file mode 160000 index 0000000..e85c8da --- /dev/null +++ b/src/propaganda @@ -0,0 +1 @@ +Subproject commit e85c8da55bf2e7c345e74841c2dfa0c73f4e9003 diff --git a/src/protocol b/src/protocol new file mode 160000 index 0000000..c4ac587 --- /dev/null +++ b/src/protocol @@ -0,0 +1 @@ +Subproject commit c4ac58708288fb29a282a3d4fb9dece974ce30ab diff --git a/src/secret b/src/secret new file mode 160000 index 0000000..be30312 --- /dev/null +++ b/src/secret @@ -0,0 +1 @@ +Subproject commit be3031242ba63f1c5f07e3ca29d1dd1198dadea4 diff --git a/src/sparkle b/src/sparkle new file mode 160000 index 0000000..9ad606a --- /dev/null +++ b/src/sparkle @@ -0,0 +1 @@ +Subproject commit 9ad606a776b5d96faa059c1667238c56b36813de diff --git a/src/tablo b/src/tablo new file mode 160000 index 0000000..f296967 --- /dev/null +++ b/src/tablo @@ -0,0 +1 @@ +Subproject commit f29696799e0e38f55219d8ae06f2ea49809dabc7 diff --git a/src/tact b/src/tact new file mode 160000 index 0000000..939e8de --- /dev/null +++ b/src/tact @@ -0,0 +1 @@ +Subproject commit 939e8de8512bad6899af97c0e053aa7e0dd1fe44 diff --git a/src/testit b/src/testit new file mode 160000 index 0000000..569a34d --- /dev/null +++ b/src/testit @@ -0,0 +1 @@ +Subproject commit 569a34d489b3dc8cdd0f9737e68cf2f900b5a224 diff --git a/src/try b/src/try new file mode 160000 index 0000000..b894067 --- /dev/null +++ b/src/try @@ -0,0 +1 @@ +Subproject commit b8940673b0403b32519d2f5d81a3a0598e0fb563