Skip to content

Commit 933c6f4

Browse files
nmccreadyclaude
andcommitted
feat: add npm package setup, GitHub workflows, and bats tests
- Package as @brickhouse-tech/envcache with npm bin entry - Move shell script to src/sh/ matching org conventions - Add full GitHub workflow suite (tests, publish, release, commitlint, dependabot) - Add 10 bats tests with mock op CLI covering all cache scenarios - Fix cross-platform md5 hashing (macOS md5 vs Linux md5sum) - Add editorconfig, commitlint, and org-standard gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d7828a1 commit 933c6f4

15 files changed

Lines changed: 460 additions & 9 deletions

.editorconfig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.json]
13+
indent_size = 2
14+
15+
[*.sh]
16+
indent_size = 2
17+
18+
[*.(j|t)s]
19+
indent_size = 2
20+
quote_type = single
21+
22+
[*.go]
23+
indent_style = tab
24+
indent_size = 4
25+
26+
[*.md]
27+
trim_trailing_whitespace = false
28+
indent_size = 2
29+
30+
[Makefile]
31+
indent_style = tab
32+
indent_size = 4
33+
[*.mk]
34+
indent_style = tab
35+
indent_size = 4

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [nmccready, brickhouse-tech]

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
all:
9+
patterns:
10+
- "*"

.github/workflows/auto-release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: auto-release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
tests:
10+
uses: ./.github/workflows/tests.yml
11+
12+
release:
13+
needs: [tests]
14+
uses: brickhouse-tech/.github/.github/workflows/auto-release.yml@main

.github/workflows/commitlint.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: commitlint
2+
3+
on:
4+
workflow_call:
5+
push:
6+
paths-ignore:
7+
- '.devcontainer/**'
8+
- '.github/workflows/**'
9+
pull_request:
10+
branches: ["main"]
11+
paths-ignore:
12+
- '.devcontainer/**'
13+
- '.github/workflows/**'
14+
jobs:
15+
commitlint:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Install required dependencies
22+
run: |
23+
sudo apt update
24+
sudo apt install -y sudo
25+
sudo apt install -y git curl
26+
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
- name: node setup
31+
run: npm i
32+
- name: Print versions
33+
run: |
34+
git --version
35+
node --version
36+
npm --version
37+
npx commitlint --version
38+
39+
- name: Validate current commit (last commit) with commitlint
40+
if: github.event_name == 'push'
41+
run: npx commitlint --last --verbose
42+
43+
- name: Validate PR commits with commitlint
44+
if: github.event_name == 'pull_request'
45+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Dependabot Auto-Merge
2+
3+
on: pull_request_target
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
dependabot:
11+
uses: brickhouse-tech/.github/.github/workflows/dependabot-auto-merge.yml@main

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
tests:
10+
uses: ./.github/workflows/tests.yml
11+
publish-npm:
12+
needs: [tests]
13+
uses: brickhouse-tech/.github/.github/workflows/publish.yml@main
14+
permissions:
15+
contents: read
16+
id-token: write
17+
secrets: inherit

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths-ignore:
7+
- '.devcontainer/**'
8+
tags-ignore: ['**']
9+
10+
jobs:
11+
tests:
12+
uses: ./.github/workflows/tests.yml
13+
tag-release:
14+
needs: [tests]
15+
uses: brickhouse-tech/.github/.github/workflows/release.yml@main
16+
secrets:
17+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: tests
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
branches: ["main"]
7+
paths-ignore:
8+
- '.devcontainer/**'
9+
- '.github/workflows/**'
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Use Node.js 22.x
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22.x'
19+
20+
- run: npm install
21+
- run: npm run lint
22+
- run: npm test
23+
24+
tests:
25+
name: tests
26+
needs: [test]
27+
runs-on: ubuntu-latest
28+
if: always()
29+
steps:
30+
- name: Check test results
31+
run: |
32+
results=($(echo '${{ toJSON(needs.*.result) }}' | jq -r '.[]'))
33+
for r in "${results[@]}"; do
34+
if [[ "$r" != "success" ]]; then
35+
echo "One or more jobs failed: $r"
36+
exit 1
37+
fi
38+
done
39+
echo "All jobs passed"

.gitignore

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
.DS_Store
2+
3+
# Logs
4+
logs
5+
*.log
6+
7+
# Runtime data
8+
pids
9+
*.pid
10+
*.seed
11+
12+
# Coverage directory
13+
coverage
14+
15+
# Dependency directory
16+
node_modules
17+
tmp
18+
temp
19+
20+
yarn.lock
21+
dist/
22+
23+
# Agent tool artifacts
24+
.cursor/
25+
.codex/
26+
.claude/
27+
.windsurf/
28+
.github/copilot/
29+
CLAUDE.md
30+
131
# Cache files (contain plaintext secrets)
232
*.cache
333
*.cache.meta
@@ -6,9 +36,6 @@
636
.envcache.secrets
737
envcache.secrets
838

9-
# OS
10-
.DS_Store
11-
12-
# Rust (for future)
39+
# Rust (future)
1340
/target/
1441
Cargo.lock

0 commit comments

Comments
 (0)