Skip to content

Commit b1e4b46

Browse files
committed
Add shell/yaml linting, apply fixes and add CI jobs.
1 parent 71dcdba commit b1e4b46

File tree

16 files changed

+683
-575
lines changed

16 files changed

+683
-575
lines changed

.github/workflows/ci.yml

Lines changed: 325 additions & 285 deletions
Large diffs are not rendered by default.

.github/workflows/release.yml

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,123 @@
1-
name: Release
2-
3-
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
8-
permissions:
9-
contents: write # Required for creating releases and uploading assets
10-
11-
env:
12-
CARGO_TERM_COLOR: always
13-
RUST_BACKTRACE: 1
14-
15-
jobs:
16-
create-release:
17-
name: Create Release
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v4
21-
22-
- name: Extract version from tag
23-
id: get_version
24-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
25-
26-
- name: Create Release
27-
id: release
28-
uses: softprops/action-gh-release@v2
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
with:
32-
tag_name: ${{ steps.get_version.outputs.VERSION }}
33-
name: Ruby Butler ${{ steps.get_version.outputs.VERSION }}
34-
body: |
35-
🎩 **Ruby Butler ${{ steps.get_version.outputs.VERSION }}**
36-
37-
A sophisticated Ruby environment manager release with the refined precision of a proper gentleman's gentleman.
38-
39-
## Installation
40-
41-
Download the appropriate binary for your platform below and place it in your PATH.
42-
43-
## What's New
44-
45-
See the [CHANGELOG](https://github.com/RubyElders/ruby-butler/blob/main/CHANGELOG.md) for detailed changes.
46-
47-
## Binaries
48-
49-
- **Linux**: `rb-linux` and `rb-linux-debug`
50-
- **macOS**: `rb-macos` and `rb-macos-debug`
51-
- **Windows**: `rb-windows.exe` and `rb-windows-debug.exe`
52-
53-
---
54-
*At your distinguished service,*
55-
*RubyElders.com*
56-
draft: true
57-
prerelease: false
58-
59-
build-release:
60-
name: Build Release Binaries
61-
needs: create-release
62-
strategy:
63-
matrix:
64-
include:
65-
- os: ubuntu-latest
66-
target: x86_64-unknown-linux-gnu
67-
suffix: linux
68-
ext: ""
69-
- os: macos-x86_64-latest
70-
target: x86_64-apple-darwin
71-
suffix: macos
72-
ext: ""
73-
- os: macos-latest
74-
target: aarch64-apple-darwin
75-
suffix: macos
76-
ext: ""
77-
- os: windows-latest
78-
target: x86_64-pc-windows-msvc
79-
suffix: windows
80-
ext: ".exe"
81-
runs-on: ${{ matrix.os }}
82-
steps:
83-
- uses: actions/checkout@v4
84-
with:
85-
fetch-depth: 0 # Need full history for git info
86-
87-
- name: Install Rust
88-
uses: dtolnay/rust-toolchain@stable
89-
with:
90-
toolchain: 1.90.0
91-
targets: ${{ matrix.target }}
92-
93-
- name: Cache cargo registry
94-
uses: actions/cache@v4
95-
with:
96-
path: |
97-
~/.cargo/registry
98-
~/.cargo/git
99-
target
100-
key: ${{ matrix.os }}-1.90.0-cargo-${{ hashFiles('**/Cargo.lock') }}
101-
restore-keys: |
102-
${{ matrix.os }}-1.90.0-cargo-
103-
${{ matrix.os }}-cargo-
104-
105-
- name: Build release binary
106-
run: cargo build --release --target ${{ matrix.target }}
107-
108-
- name: Build debug binary
109-
run: cargo build --target ${{ matrix.target }}
110-
111-
- name: Rename binaries with platform suffix
112-
run: |
113-
cp target/${{ matrix.target }}/release/rb${{ matrix.ext }} rb-${{ matrix.suffix }}${{ matrix.ext }}
114-
cp target/${{ matrix.target }}/debug/rb${{ matrix.ext }} rb-${{ matrix.suffix }}-debug${{ matrix.ext }}
115-
116-
- name: Upload release assets
117-
uses: softprops/action-gh-release@v2
118-
env:
119-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120-
with:
121-
files: |
122-
rb-${{ matrix.suffix }}${{ matrix.ext }}
123-
rb-${{ matrix.suffix }}-debug${{ matrix.ext }}
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write # Required for creating releases and uploading assets
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: 1
14+
15+
jobs:
16+
create-release:
17+
name: Create Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Extract version from tag
23+
id: get_version
24+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
25+
26+
- name: Create Release
27+
id: release
28+
uses: softprops/action-gh-release@v2
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
tag_name: ${{ steps.get_version.outputs.VERSION }}
33+
name: Ruby Butler ${{ steps.get_version.outputs.VERSION }}
34+
body: |
35+
🎩 **Ruby Butler ${{ steps.get_version.outputs.VERSION }}**
36+
37+
A sophisticated Ruby environment manager release with the refined precision of a proper gentleman's gentleman.
38+
39+
## Installation
40+
41+
Download the appropriate binary for your platform below and place it in your PATH.
42+
43+
## What's New
44+
45+
See the [CHANGELOG](https://github.com/RubyElders/ruby-butler/blob/main/CHANGELOG.md) for detailed changes.
46+
47+
## Binaries
48+
49+
- **Linux**: `rb-linux` and `rb-linux-debug`
50+
- **macOS**: `rb-macos` and `rb-macos-debug`
51+
- **Windows**: `rb-windows.exe` and `rb-windows-debug.exe`
52+
53+
---
54+
*At your distinguished service,*
55+
*RubyElders.com*
56+
draft: true
57+
prerelease: false
58+
59+
build-release:
60+
name: Build Release Binaries
61+
needs: create-release
62+
strategy:
63+
matrix:
64+
include:
65+
- os: ubuntu-latest
66+
target: x86_64-unknown-linux-gnu
67+
suffix: linux
68+
ext: ""
69+
- os: macos-x86_64-latest
70+
target: x86_64-apple-darwin
71+
suffix: macos
72+
ext: ""
73+
- os: macos-latest
74+
target: aarch64-apple-darwin
75+
suffix: macos
76+
ext: ""
77+
- os: windows-latest
78+
target: x86_64-pc-windows-msvc
79+
suffix: windows
80+
ext: ".exe"
81+
runs-on: ${{ matrix.os }}
82+
steps:
83+
- uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 0 # Need full history for git info
86+
87+
- name: Install Rust
88+
uses: dtolnay/rust-toolchain@stable
89+
with:
90+
toolchain: 1.90.0
91+
targets: ${{ matrix.target }}
92+
93+
- name: Cache cargo registry
94+
uses: actions/cache@v4
95+
with:
96+
path: |
97+
~/.cargo/registry
98+
~/.cargo/git
99+
target
100+
key: ${{ matrix.os }}-1.90.0-cargo-${{ hashFiles('**/Cargo.lock') }}
101+
restore-keys: |
102+
${{ matrix.os }}-1.90.0-cargo-
103+
${{ matrix.os }}-cargo-
104+
105+
- name: Build release binary
106+
run: cargo build --release --target ${{ matrix.target }}
107+
108+
- name: Build debug binary
109+
run: cargo build --target ${{ matrix.target }}
110+
111+
- name: Rename binaries with platform suffix
112+
run: |
113+
cp target/${{ matrix.target }}/release/rb${{ matrix.ext }} rb-${{ matrix.suffix }}${{ matrix.ext }}
114+
cp target/${{ matrix.target }}/debug/rb${{ matrix.ext }} rb-${{ matrix.suffix }}-debug${{ matrix.ext }}
115+
116+
- name: Upload release assets
117+
uses: softprops/action-gh-release@v2
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
with:
121+
files: |
122+
rb-${{ matrix.suffix }}${{ matrix.ext }}
123+
rb-${{ matrix.suffix }}-debug${{ matrix.ext }}

.shellcheckrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ShellCheck configuration for Ruby Butler
2+
# Excludes warnings that don't apply to ShellSpec test files
3+
4+
# SC2034: Variable appears unused
5+
# False positive - variables like LATEST_RUBY, OLDER_RUBY, RUBIES_DIR
6+
# are used by ShellSpec framework
7+
disable=SC2034
8+
9+
# SC2164: Use 'cd ... || exit' or 'cd ... || return'
10+
# Not critical in test setup code where failures are caught by test assertions
11+
disable=SC2164

.yamllint

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
# yamllint configuration for Ruby Butler CI files
3+
4+
extends: default
5+
6+
rules:
7+
# Allow longer lines for GitHub Actions (they often have long commands)
8+
line-length:
9+
max: 160
10+
level: warning
11+
12+
# Indentation: Allow GitHub Actions style (4 spaces for steps is common)
13+
indentation:
14+
spaces: consistent
15+
indent-sequences: whatever
16+
17+
# Don't require document start marker (---)
18+
document-start: disable
19+
20+
# Allow truthy values like 'on' in GitHub Actions
21+
truthy:
22+
allowed-values: ['true', 'false', 'on', 'off']
23+
24+
# Trailing spaces
25+
trailing-spaces: enable
26+
27+
# New line at end of file
28+
new-line-at-end-of-file: enable
29+
30+
# Brackets spacing (GitHub Actions uses both styles)
31+
brackets:
32+
min-spaces-inside: 0
33+
max-spaces-inside: 1

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,27 @@ docker:
1717
spec: cargo docker
1818
@echo "🚀 Running ShellSpec tests with distinguished parallel execution..."
1919
./shellspec
20+
21+
# Format shell scripts (trailing whitespace + final newline only)
22+
fmt-shell:
23+
@echo "✨ Formatting shell scripts..."
24+
@find spec -name "*.sh" -type f -exec sed -i 's/[[:space:]]*$$//' {} \;
25+
@find spec -name "*.sh" -type f -exec sh -c 'tail -c1 "$$1" | read -r _ || echo >> "$$1"' _ {} \;
26+
@echo "✅ Shell script formatting complete"
27+
28+
# Check shell scripts for common issues
29+
lint-shell:
30+
@echo "🔍 Linting shell scripts..."
31+
@shellcheck spec/**/*.sh
32+
33+
# Format YAML files (trailing whitespace + final newline only)
34+
fmt-yaml:
35+
@echo "✨ Formatting YAML files..."
36+
@find .github -name "*.yml" -type f -exec sed -i 's/[[:space:]]*$$//' {} \;
37+
@find .github -name "*.yml" -type f -exec sh -c 'tail -c1 "$$1" | read -r _ || echo >> "$$1"' _ {} \;
38+
@echo "✅ YAML formatting complete"
39+
40+
# Check YAML files
41+
lint-yaml:
42+
@echo "🔍 Linting YAML files..."
43+
@yamllint .github/workflows/

0 commit comments

Comments
 (0)