Skip to content

Commit 930bc47

Browse files
committed
fix: add test automation for Alpine
1 parent 68ed162 commit 930bc47

File tree

6 files changed

+40
-1
lines changed

6 files changed

+40
-1
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ BASHUNIT_SHOW_EXECUTION_TIME=
77
BASHUNIT_LOG_JUNIT=
88
BASHUNIT_REPORT_HTML=
99
BASHUNIT_LOAD_FILE=
10+
BASHUNIT_ALPINE_TEST_VERSION=

.github/CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Run tests from the library:
5555
```bash
5656
# using make
5757
make test
58+
make alpine-test
5859

5960
# using bashunit itself
6061
./bashunit tests/**/*_test.sh

.github/workflows/tests.yml

+19
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,22 @@ jobs:
3232
- name: Run Tests
3333
run: ${{ matrix.script_name }}
3434

35+
alpine:
36+
name: "Run tests on alpine"
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os:
41+
- ubuntu-latest
42+
include:
43+
- os: ubuntu-latest
44+
script_name: 'make test-alpine'
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
51+
- name: Run Tests
52+
run: ${{ matrix.script_name }}
53+

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Changelog
22

3-
## Unreleased
3+
## [Unreleased](https://github.com/TypedDevs/bashunit/compare/0.16.0...main)
44

55
- Rename `BASHUNIT_TESTS_ENV` to `BASHUNIT_LOAD_FILE`
6+
- Added support for running tests in Alpine
67

78
## [0.16.0](https://github.com/TypedDevs/bashunit/compare/0.15.0...0.16.0) - 2024-09-15
89

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SHELL=/bin/bash
55
STATIC_ANALYSIS_CHECKER := $(shell which shellcheck 2> /dev/null)
66
LINTER_CHECKER := $(shell which ec 2> /dev/null)
77
GIT_DIR = $(shell git rev-parse --git-dir 2> /dev/null)
8+
BASHUNIT_ALPINE_TEST_VERSION_DEFAULT:="3.20"
89

910
OS:=
1011
ifeq ($(OS),Windows_NT)
@@ -35,6 +36,10 @@ else
3536
endif
3637
endif
3738

39+
ifeq ($(BASHUNIT_ALPINE_TEST_VERSION),)
40+
BASHUNIT_ALPINE_TEST_VERSION_DEFAULT:="3.20"
41+
endif
42+
3843
help:
3944
@echo ""
4045
@echo "Usage: make [command]"
@@ -67,6 +72,16 @@ test/watch: $(TEST_SCRIPTS)
6772
@./bashunit $(TEST_SCRIPTS)
6873
@fswatch -m poll_monitor -or $(SRC_SCRIPTS_DIR) $(TEST_SCRIPTS_DIR) .env Makefile | xargs -n1 ./bashunit $(TEST_SCRIPTS)
6974

75+
test-alpine:
76+
# Run tests for Alpine in a container with only the very basic dependencies. Bashunit should work for the base
77+
# Alpine installation.
78+
docker run -v $$(pwd):/working --rm alpine:${BASHUNIT_ALPINE_TEST_VERSION} /bin/sh -c " \
79+
apk update &&\
80+
apk add bash make &&\
81+
adduser -D builder &&\
82+
chown -R builder /working && \
83+
su - builder -c 'cd /working; make test';"
84+
7085
env/example:
7186
@echo "Copying variables without the values from .env into .env.example"
7287
@sed 's/=.*/=/' .env > .env.example

tests/acceptance/fixtures/.env.default

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ BASHUNIT_SHOW_EXECUTION_TIME=false
66
BASHUNIT_DEFAULT_PATH=
77
BASHUNIT_LOG_JUNIT=
88
BASHUNIT_REPORT_HTML=
9+
BASHUNIT_LOAD_FILE=
10+
BASHUNIT_ALPINE_TEST_VERSION=3.20

0 commit comments

Comments
 (0)