Skip to content

Commit c149532

Browse files
feat: Add composite action to install host-side CLI tools (vault, bats) and update CI workflow
Signed-off-by: Alex Lovell-Troy <alex@lovelltroy.org>
1 parent 601c30e commit c149532

2 files changed

Lines changed: 66 additions & 4 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Composite action that installs the host-side CLI tools the sandbox
2+
# fixtures and bats suite expect on a runner. Currently:
3+
#
4+
# vault — fixtures/vault-seed.sh and tests/bats/cli-smoke.bats both
5+
# shell out to the vault CLI; not preinstalled on ubuntu-latest.
6+
# bats — tests/bats/*.bats are bash-test scripts; not preinstalled.
7+
#
8+
# Idempotent: each step checks for the binary and short-circuits if
9+
# present, so calling this from setup + test-bats + test-uc* is cheap on
10+
# a hot apt cache and re-runs cleanly under `act`.
11+
name: setup-tools
12+
description: Install host-side CLI tools (vault, bats) the sandbox needs.
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Install bats
18+
shell: bash
19+
run: |
20+
if command -v bats >/dev/null 2>&1; then
21+
echo "bats already installed: $(bats --version)"
22+
exit 0
23+
fi
24+
sudo apt-get update -qq
25+
sudo apt-get install -y --no-install-recommends bats
26+
bats --version
27+
28+
- name: Install vault CLI
29+
shell: bash
30+
run: |
31+
if command -v vault >/dev/null 2>&1; then
32+
echo "vault already installed: $(vault --version)"
33+
exit 0
34+
fi
35+
curl -fsSL https://apt.releases.hashicorp.com/gpg \
36+
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
37+
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" \
38+
| sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null
39+
sudo apt-get update -qq
40+
sudo apt-get install -y --no-install-recommends vault
41+
vault --version

.github/workflows/ci.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ jobs:
125125
cache: true
126126
cache-dependency-path: tests/go.sum
127127

128-
- name: Install bats
129-
run: sudo apt-get update && sudo apt-get install -y bats
128+
- name: Install host-side tools (vault, bats)
129+
uses: ./.github/actions/setup-tools
130130

131131
- name: Set up Docker Buildx
132132
uses: docker/setup-buildx-action@v3
@@ -184,8 +184,8 @@ jobs:
184184
- name: Checkout
185185
uses: actions/checkout@v4
186186

187-
- name: Install bats
188-
run: sudo apt-get update && sudo apt-get install -y bats
187+
- name: Install host-side tools (vault, bats)
188+
uses: ./.github/actions/setup-tools
189189

190190
- name: Set up Docker Buildx
191191
uses: docker/setup-buildx-action@v3
@@ -252,6 +252,9 @@ jobs:
252252
cache: true
253253
cache-dependency-path: tests/go.sum
254254

255+
- name: Install host-side tools (vault, bats)
256+
uses: ./.github/actions/setup-tools
257+
255258
- name: Set up Docker Buildx
256259
uses: docker/setup-buildx-action@v3
257260
continue-on-error: true
@@ -341,6 +344,9 @@ jobs:
341344
cache: true
342345
cache-dependency-path: tests/go.sum
343346

347+
- name: Install host-side tools (vault, bats)
348+
uses: ./.github/actions/setup-tools
349+
344350
- name: Set up Docker Buildx
345351
uses: docker/setup-buildx-action@v3
346352
continue-on-error: true
@@ -430,6 +436,9 @@ jobs:
430436
cache: true
431437
cache-dependency-path: tests/go.sum
432438

439+
- name: Install host-side tools (vault, bats)
440+
uses: ./.github/actions/setup-tools
441+
433442
- name: Set up Docker Buildx
434443
uses: docker/setup-buildx-action@v3
435444
continue-on-error: true
@@ -519,6 +528,9 @@ jobs:
519528
cache: true
520529
cache-dependency-path: tests/go.sum
521530

531+
- name: Install host-side tools (vault, bats)
532+
uses: ./.github/actions/setup-tools
533+
522534
- name: Set up Docker Buildx
523535
uses: docker/setup-buildx-action@v3
524536
continue-on-error: true
@@ -608,6 +620,9 @@ jobs:
608620
cache: true
609621
cache-dependency-path: tests/go.sum
610622

623+
- name: Install host-side tools (vault, bats)
624+
uses: ./.github/actions/setup-tools
625+
611626
- name: Set up Docker Buildx
612627
uses: docker/setup-buildx-action@v3
613628
continue-on-error: true
@@ -697,6 +712,9 @@ jobs:
697712
cache: true
698713
cache-dependency-path: tests/go.sum
699714

715+
- name: Install host-side tools (vault, bats)
716+
uses: ./.github/actions/setup-tools
717+
700718
- name: Set up Docker Buildx
701719
uses: docker/setup-buildx-action@v3
702720
continue-on-error: true
@@ -786,6 +804,9 @@ jobs:
786804
cache: true
787805
cache-dependency-path: tests/go.sum
788806

807+
- name: Install host-side tools (vault, bats)
808+
uses: ./.github/actions/setup-tools
809+
789810
- name: Set up Docker Buildx
790811
uses: docker/setup-buildx-action@v3
791812
continue-on-error: true

0 commit comments

Comments
 (0)