Skip to content

Commit 14bc969

Browse files
committed
fix: CI alpine tests in a separate job
1 parent ee31360 commit 14bc969

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414
matrix:
1515
os:
1616
- ubuntu-latest
17-
- alpine-latest
1817
- macos-latest
1918
- windows-latest
2019
include:
@@ -24,18 +23,21 @@ jobs:
2423
script_name: 'make test'
2524
- os: ubuntu-latest
2625
script_name: 'make test'
27-
- os: alpine-latest
28-
script_name: 'make test'
2926
steps:
3027
- name: Checkout
3128
uses: actions/checkout@v4
3229
with:
3330
fetch-depth: 0
34-
35-
- name: Install dependencies on Alpine
36-
if: matrix.os == 'alpine-latest'
37-
run: |
38-
apk add bash make shellcheck git curl perl
39-
4031
- name: Run Tests
4132
run: ${{ matrix.script_name }}
33+
34+
alpine:
35+
name: "Run tests on alpine-latest"
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
- name: Run Tests
43+
run: make test/alpine

Makefile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ 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
98

109
OS:=
1110
ifeq ($(OS),Windows_NT)
@@ -36,10 +35,6 @@ else
3635
endif
3736
endif
3837

39-
ifeq ($(BASHUNIT_ALPINE_TEST_VERSION),)
40-
BASHUNIT_ALPINE_TEST_VERSION:=$(BASHUNIT_ALPINE_TEST_VERSION_DEFAULT)
41-
endif
42-
4338
help:
4439
@echo ""
4540
@echo "Usage: make [command]"
@@ -48,6 +43,7 @@ help:
4843
@echo " test Run the tests"
4944
@echo " test/list List all tests under the tests directory"
5045
@echo " test/watch Automatically run tests every second"
46+
@echo " test/alpine Run the tests in a Linux/Alpine:latest image"
5147
@echo " env/example Copy variables without the values from .env into .env.example"
5248
@echo " pre_commit/install Install the pre-commit hook"
5349
@echo " pre_commit/run Function that will be called when the pre-commit hook runs"
@@ -72,15 +68,11 @@ test/watch: $(TEST_SCRIPTS)
7268
@./bashunit $(TEST_SCRIPTS)
7369
@fswatch -m poll_monitor -or $(SRC_SCRIPTS_DIR) $(TEST_SCRIPTS_DIR) .env Makefile | xargs -n1 ./bashunit $(TEST_SCRIPTS)
7470

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 shellcheck git curl perl &&\
81-
adduser -D builder &&\
82-
chown -R builder /working && \
83-
su - builder -c 'cd /working; make test';"
71+
test/alpine:
72+
@# Run tests for Alpine in a container with only the very basic dependencies
73+
@docker run --rm -it -v "$(shell pwd)":/project -w /project alpine:latest \
74+
sh -c "apk add --no-cache bash make shellcheck git curl perl && \
75+
bash ./bashunit tests"
8476

8577
env/example:
8678
@echo "Copying variables without the values from .env into .env.example"

0 commit comments

Comments
 (0)