Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Alpine (Linux Distro) #331

Merged
merged 34 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
58de4e2
fix: add test automation for Alpine
skinner-m-c Sep 16, 2024
8424d5e
Update .github/CONTRIBUTING.md
Chemaclass Sep 21, 2024
70499d1
docs: improve BASHUNIT_LOAD_FILE documentation
Chemaclass Sep 18, 2024
0055475
feat: add optional second arg to --debug option
Chemaclass Sep 21, 2024
a8ad97e
docs: upgrade changelog
Chemaclass Sep 21, 2024
c8f8848
refactor: rename runtime_in_milliseconds to total_runtime_in_millisec…
Chemaclass Sep 21, 2024
673d1bc
refactor: move duration logic from logger to runner test scope
Chemaclass Sep 21, 2024
291fdb7
feat: add str::rpad()
Chemaclass Sep 21, 2024
5b79121
feat: add time per test if BASHUNIT_SHOW_EXECUTION_TIME=true
Chemaclass Sep 21, 2024
50061f8
fix: static-analysis
Chemaclass Sep 21, 2024
878a55b
refactor: simplify total tests display
Chemaclass Sep 21, 2024
ae2e529
fix: str::rpad()
Chemaclass Sep 21, 2024
4c05947
fix: TERMINAL_WIDTH when TERM is not define, use a default
Chemaclass Sep 21, 2024
dde0369
docs: upgrade changelog
Chemaclass Sep 21, 2024
cc23fa1
test: print_successful_test_output time with and without args
Chemaclass Sep 21, 2024
9874c17
fix: load check_os before clock
Chemaclass Sep 21, 2024
1d66eaf
fix: TERMINAL_WIDTH using stty instead of tput to get the cols
Chemaclass Sep 21, 2024
e70da26
Merge branch 'main' into fix/add-alpine-test-automation
Chemaclass Sep 21, 2024
194853f
feat: distinguish Linux - Ubuntu,Alpine,Other
Chemaclass Sep 21, 2024
cab23f7
fix: filtered_lines in check_duplicate_functions()
Chemaclass Sep 21, 2024
0cd4af1
refactor: _OS split into _OS and _DISTRO
Chemaclass Sep 21, 2024
f6be730
refactor: remove unnecesary test
Chemaclass Sep 21, 2024
9463fb7
test: ignore directory tests for Alpine
Chemaclass Sep 21, 2024
dec200e
fix: alpine compabible filtered_lines grep on check_duplicate_functions
Chemaclass Sep 21, 2024
e4fe41c
fix: add missing deps on teset-alpine make command
Chemaclass Sep 21, 2024
07d44bc
fix: time on linux alpine
Chemaclass Sep 21, 2024
939abfb
docs: update changelog
Chemaclass Sep 21, 2024
c5be076
fix: time per test adding perl to test-alpine
Chemaclass Sep 21, 2024
f144546
refactor: clean ups
Chemaclass Sep 21, 2024
23763f1
docs: testing different OS in contributing
Chemaclass Sep 22, 2024
ee31360
test: add alpine-latest to CI strategy matrix
Chemaclass Sep 22, 2024
9e6d625
fix: CI alpine tests in a separate job
Chemaclass Sep 22, 2024
5426cc5
refactor: remove BASHUNIT_ALPINE_TEST_VERSION from .env.example
Chemaclass Sep 22, 2024
141b208
refactor: make test/alpine for local and CI test alpine with custom d…
Chemaclass Sep 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ BASHUNIT_SHOW_EXECUTION_TIME=
BASHUNIT_LOG_JUNIT=
BASHUNIT_REPORT_HTML=
BASHUNIT_LOAD_FILE=
BASHUNIT_ALPINE_TEST_VERSION=
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Run tests from the library:
```bash
# using make
make test
make alpine-test
Chemaclass marked this conversation as resolved.
Show resolved Hide resolved

# using bashunit itself
./bashunit tests/**/*_test.sh
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,22 @@ jobs:
- name: Run Tests
run: ${{ matrix.script_name }}

alpine:
name: "Run tests on alpine"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
include:
- os: ubuntu-latest
script_name: 'make test-alpine'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Tests
run: ${{ matrix.script_name }}

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

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

- Rename `BASHUNIT_TESTS_ENV` to `BASHUNIT_LOAD_FILE`
- Added support for running tests in Alpine

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

Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SHELL=/bin/bash
STATIC_ANALYSIS_CHECKER := $(shell which shellcheck 2> /dev/null)
LINTER_CHECKER := $(shell which ec 2> /dev/null)
GIT_DIR = $(shell git rev-parse --git-dir 2> /dev/null)
BASHUNIT_ALPINE_TEST_VERSION_DEFAULT:=3.20

OS:=
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -35,6 +36,10 @@ else
endif
endif

ifeq ($(BASHUNIT_ALPINE_TEST_VERSION),)
BASHUNIT_ALPINE_TEST_VERSION:=$(BASHUNIT_ALPINE_TEST_VERSION_DEFAULT)
endif

help:
@echo ""
@echo "Usage: make [command]"
Expand Down Expand Up @@ -67,6 +72,16 @@ test/watch: $(TEST_SCRIPTS)
@./bashunit $(TEST_SCRIPTS)
@fswatch -m poll_monitor -or $(SRC_SCRIPTS_DIR) $(TEST_SCRIPTS_DIR) .env Makefile | xargs -n1 ./bashunit $(TEST_SCRIPTS)

test-alpine:
@# Run tests for Alpine in a container with only the very basic dependencies. Bashunit should work for the base
@# Alpine installation.
docker run -v $$(pwd):/working --rm alpine:${BASHUNIT_ALPINE_TEST_VERSION} /bin/sh -c " \
apk update &&\
apk add bash make &&\
adduser -D builder &&\
chown -R builder /working && \
su - builder -c 'cd /working; make test';"

env/example:
@echo "Copying variables without the values from .env into .env.example"
@sed 's/=.*/=/' .env > .env.example
Expand Down
2 changes: 2 additions & 0 deletions tests/acceptance/fixtures/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ BASHUNIT_SHOW_EXECUTION_TIME=false
BASHUNIT_DEFAULT_PATH=
BASHUNIT_LOG_JUNIT=
BASHUNIT_REPORT_HTML=
BASHUNIT_LOAD_FILE=
BASHUNIT_ALPINE_TEST_VERSION=
Loading