-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce23df4
Showing
26 changed files
with
1,062 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/asdf | ||
asdf: rynkowsg/asdf@0.1.2 | ||
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/checkout | ||
checkout: rynkowsg/checkout@0.3.0 | ||
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/rynkowsg | ||
rynkowsg: rynkowsg/rynkowsg@0.4.0 | ||
|
||
jobs: | ||
checks: | ||
executor: rynkowsg/docker_x86_cimg_base | ||
steps: | ||
- checkout/checkout: {depth: 1} | ||
- asdf/install: {version: 0.14.0} | ||
- restore_cache: | ||
name: asdf - restore cache (partial) | ||
keys: | ||
- asdf-{{ checksum ".tool-versions" }} | ||
- run: | ||
name: asdf - add plugin | ||
command: | | ||
set -x | ||
cd /tmp | ||
git config --global advice.detachedHead false | ||
asdf plugin add babashka https://github.com/fredZen/asdf-babashka.git | ||
asdf plugin add java https://github.com/halcyon/asdf-java.git | ||
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git | ||
asdf plugin add shfmt https://github.com/luizm/asdf-shfmt.git | ||
- run: | ||
name: asdf - install tools | ||
command: | | ||
set -x | ||
bash --version | ||
asdf install | ||
bb --version | ||
java --version | ||
shellcheck --version | ||
shfmt --version | ||
- save_cache: | ||
name: asdf - save cache (partial) | ||
key: asdf-{{ checksum ".tool-versions" }} | ||
paths: | ||
- ~/.asdf/installs | ||
- ~/.asdf/plugins | ||
- ~/.asdf/shims | ||
- rynkowsg/install_sosh: { version: "v0.2.0" } | ||
- run: make lint | ||
- run: make format-check | ||
|
||
workflows: | ||
lint_and_format: | ||
jobs: | ||
- checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{md,yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Lint PR | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
semantic-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5.5.2 # https://github.com/amannn/action-semantic-pull-request/releases | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
validateSingleCommit: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
|
||
jobs: | ||
actionlint: | ||
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images?tab=readme-ov-file#available-images | ||
steps: | ||
- uses: actions/checkout@v4.1.7 # https://github.com/actions/checkout/releases | ||
- name: Check workflow files | ||
uses: docker://rhysd/actionlint:1.7.1 # https://hub.docker.com/r/rhysd/actionlint/tags | ||
with: | ||
args: -color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
|
||
jobs: | ||
plugin_test: | ||
name: plugin test | ||
strategy: | ||
matrix: | ||
os: | ||
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images | ||
- ubuntu-22.04 | ||
- macos-12 # x86_64 | ||
- macos-14 # arm64 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: asdf_plugin_test | ||
uses: asdf-vm/actions/plugin-test@v3.0.2 # https://github.com/asdf-vm/actions/releases | ||
with: | ||
command: jet --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# JetBrains IDEs | ||
/.idea/* | ||
!/.idea/codeStyles/ | ||
!/.idea/copyright/ | ||
!/.idea/dictionaries/ | ||
!/.idea/fileTemplates/ | ||
!/.idea/repl-commands.xml | ||
!/.idea/runConfigurations/ | ||
*.iml | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# sosh | ||
/.github_deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# PLUGIN: https://github.com/fredZen/asdf-babashka | ||
# RELEASES: https://github.com/babashka/babashka/releases | ||
babashka 1.3.191 | ||
|
||
# required for: sosh | ||
# PLUGIN: https://github.com/halcyon/asdf-java | ||
java temurin-17.0.11+9 | ||
|
||
# PLUGIN: https://github.com/luizm/asdf-shellcheck | ||
# RELEASES: https://github.com/koalaman/shellcheck/releases | ||
shellcheck 0.10.0 | ||
|
||
# PLUGIN: https://github.com/luizm/asdf-shfmt | ||
# RELEASES: https://github.com/mvdan/sh/releases | ||
shfmt 3.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2024 Greg Rynkowski. All rights reserved. | ||
# License: MIT License | ||
|
||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
# | ||
# Validates/corrects format | ||
# | ||
# Example: | ||
# | ||
# - check: @bin/format.bash check | ||
# - apply: @bin/format.bash apply | ||
# | ||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
# Bash Strict Mode Settings | ||
set -euo pipefail | ||
# Path Initialization | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P || exit 1)" | ||
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd -P || exit 1)" | ||
export SHELL_GR_DIR="${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@a52035c" # needed for shell-gr to resolve paths | ||
# Library Sourcing | ||
source "${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@a52035c/lib/tool/format.bash" # format_with_env | ||
|
||
main() { | ||
local format_cmd_type="${1:-"apply"}" | ||
local error=0 | ||
format_with_env "${format_cmd_type}" bash \ | ||
< <( | ||
find "${ROOT_DIR}" \( -type f \( -name '*.bash' -o -name '*.sh' \) -o -path '*/bin/*' \) \ | ||
| grep -v -E '(.github_deps|/gen/)' \ | ||
| sort | ||
) \ | ||
|| ((error += $?)) | ||
format_with_env "${format_cmd_type}" bats < <(find "${ROOT_DIR}" -type f -name '*.bats' | sort) || ((error += $?)) | ||
if ((error > 0)); then | ||
exit "$error" | ||
fi | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2024 Greg Rynkowski. All rights reserved. | ||
# License: MIT License | ||
|
||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
# | ||
# Lint bash source files | ||
# | ||
# Example: | ||
# | ||
# @bin/lint.bash | ||
# | ||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
# Bash Strict Mode Settings | ||
set -euo pipefail | ||
# Path Initialization | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P || exit 1)" | ||
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd -P || exit 1)" | ||
export SHELL_GR_DIR="${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@a52035c" # needed for shell-gr to resolve paths | ||
# Library Sourcing | ||
source "${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@a52035c/lib/tool/lint.bash" # lint | ||
|
||
main() { | ||
local error=0 | ||
lint bash \ | ||
< <( | ||
find "${ROOT_DIR}" \( -type f \( -name '*.bash' -o -name '*.sh' \) -o -path '*/bin/*' \) \ | ||
| grep -v -E '(.github_deps|/gen/)' \ | ||
| sort | ||
) \ | ||
|| ((error += $?)) | ||
lint bats < <(find "${ROOT_DIR}" -type f -name '*.bats' | sort) || ((error += $?)) | ||
if ((error > 0)); then | ||
exit "$error" | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024 Greg Rynkowski | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.PHONY: deps-clean _format_deps format-check format _lint_deps lint | ||
|
||
SCRIPTS := $(wildcard bin/*) | ||
deps: $(SCRIPTS) | ||
@$(foreach script,$^,echo "Fetching for $(script)"; sosh fetch $(script);) | ||
|
||
deps-clean: | ||
rm -rf lib/.github_deps | ||
make deps | ||
|
||
_format_deps: @bin/format.bash | ||
sosh fetch @bin/format.bash | ||
|
||
format-check: _format_deps | ||
\@bin/format.bash check | ||
|
||
format: _format_deps | ||
\@bin/format.bash apply | ||
|
||
_lint_deps: @bin/lint.bash | ||
sosh fetch @bin/lint.bash | ||
|
||
lint: _format_deps _lint_deps deps | ||
\@bin/lint.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div align="center"> | ||
|
||
# asdf-jet | ||
[![GitHub Actions Test Status][ci-actions-test-badge]][ci-actions-test] | ||
[![GitHub Actions Lint Status][ci-actions-lint-badge]][ci-actions-lint] | ||
[![CircleCI Lint Status][ci-circleci-lint-badge]][ci-circleci-lint] | ||
[![License][license-badge]][license] | ||
|
||
[jet] plugin for the [asdf version manager][asdf-website]. | ||
|
||
</div> | ||
|
||
## Contents | ||
|
||
- [Dependencies](#dependencies) | ||
- [Install](#install) | ||
- [License](#license) | ||
|
||
## Dependencies | ||
|
||
- `bash`, `curl`, `tar`: generic POSIX utilities. | ||
|
||
## Install | ||
|
||
Install the plugin: | ||
|
||
```shell | ||
asdf plugin add jet https://github.com/rynkowsg/asdf-jet.git | ||
``` | ||
|
||
Install jet: | ||
|
||
```shell | ||
# Show all installable versions | ||
asdf list-all jet | ||
|
||
# Install specific version | ||
asdf install jet latest | ||
|
||
# Set a version globally (on your ~/.tool-versions file) | ||
asdf global jet latest | ||
|
||
# Now jet tool is available | ||
jet --help | ||
``` | ||
|
||
Check [asdf][asdf-repo] readme for more instructions on how to install & manage versions. | ||
|
||
## License | ||
|
||
See [LICENSE](LICENSE) © [Grzegorz Rynkowski][gh-profile-rynkowsg] | ||
|
||
[asdf-repo]: https://github.com/asdf-vm/asdf | ||
[asdf-website]: https://asdf-vm.com | ||
[ci-actions-lint-badge]: https://github.com/rynkowsg/asdf-jet/actions/workflows/lint.yml/badge.svg | ||
[ci-actions-lint]: https://github.com/rynkowsg/asdf-jet/actions/workflows/lint.yml | ||
[ci-actions-test-badge]: https://github.com/rynkowsg/asdf-jet/actions/workflows/test.yml/badge.svg | ||
[ci-actions-test]: https://github.com/rynkowsg/asdf-jet/actions/workflows/test.yml | ||
[ci-circleci-lint-badge]: https://circleci.com/gh/rynkowsg/asdf-jet.svg?style=shield | ||
[ci-circleci-lint]: https://circleci.com/gh/rynkowsg/asdf-jet | ||
[gh-profile-rynkowsg]: https://github.com/rynkowsg | ||
[jet-repo]: https://github.com/borkdude/jet | ||
[license-badge]: https://img.shields.io/badge/license-MIT-lightgrey.svg | ||
[license]: LICENSE |
Oops, something went wrong.