From 2d55cacc7eb010106bce7743392650a831414ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Mon, 26 Oct 2020 22:55:15 +0100 Subject: [PATCH] Test multiple shells --- .github/workflows/build.yml | 111 ++++++---------- .github/workflows/lint.yml | 13 +- .github/workflows/package.yml | 58 ++++----- .github/workflows/test.yml | 100 +++++++++++++++ .gitlab-ci.yml | 233 +++++++++++++++++----------------- Makefile | 1 - resources/tests/env.sh | 4 +- resources/tests/test-000.sh | 6 +- resources/tests/test-001.sh | 6 +- resources/tests/test-002.sh | 6 +- resources/tests/test-003.sh | 6 +- resources/tests/test-004.sh | 6 +- resources/tests/test-005.sh | 6 +- resources/tests/test-006.sh | 6 +- resources/tests/test-007.sh | 6 +- resources/tests/test-008.sh | 6 +- resources/tests/test-009.sh | 6 +- 17 files changed, 318 insertions(+), 262 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a95724e..fec0bee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,130 +8,97 @@ on: jobs: - build-ubuntu-latest: - name: 'Build on ubuntu:latest' - runs-on: 'ubuntu-latest' - container: - image: 'docker.io/ubuntu:latest' - steps: - - name: 'Install packages' - run: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates curl file findutils gawk grep gzip idn2 make sed tar zip - - name: 'Checkout project' - uses: 'actions/checkout@main' - - name: 'Build project' - run: | - make clean all - build-debian-latest: - name: 'Build on debian:latest' + name: 'Build on latest Debian' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/debian:latest' + container: 'docker.io/debian:latest' steps: - name: 'Install packages' - run: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates curl file findutils gawk grep gzip idn2 make sed tar zip + run: 'apt-get update && apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' + + build-ubuntu-latest: + name: 'Build on latest Ubuntu' + runs-on: 'ubuntu-latest' + container: 'docker.io/ubuntu:latest' + steps: + - name: 'Install packages' + run: 'apt-get update && apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Build project' + run: 'make clean all' build-fedora-latest: - name: 'Build on fedora:latest' + name: 'Build on latest Fedora' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/fedora:latest' + container: 'docker.io/fedora:latest' steps: - name: 'Install packages' - run: | - dnf install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + run: 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' build-centos-latest: - name: 'Build on centos:latest' + name: 'Build on latest CentOS' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/centos:latest' + container: 'docker.io/centos:latest' steps: - name: 'Install packages' - run: | - dnf install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + run: 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' build-opensuse-latest: - name: 'Build on opensuse/tumbleweed:latest' + name: 'Build on latest openSUSE' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/opensuse/tumbleweed:latest' + container: 'docker.io/opensuse/tumbleweed:latest' steps: - name: 'Install packages' - run: | - zypper install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2-tools make sed tar zip + run: 'zypper install -y ca-certificates curl file findutils grep gzip libidn2-tools make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' build-archlinux-latest: - name: 'Build on archlinux:latest' + name: 'Build on latest Arch Linux' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/archlinux:latest' + container: 'docker.io/archlinux:latest' steps: - name: 'Install packages' - run: | - pacman -Sy --noconfirm --needed \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + run: 'pacman -Sy --noconfirm --needed ca-certificates curl file findutils grep gzip libidn2 make nawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' build-alpine-latest: - name: 'Build on alpine:latest' + name: 'Build on latest Alpine' runs-on: 'ubuntu-latest' - container: - image: 'docker.io/alpine:latest' + container: 'docker.io/alpine:latest' steps: - name: 'Install packages' - run: | - apk add --no-cache \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + run: 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' build-macos-latest: - name: 'Build on macos:latest' + name: 'Build on latest macOS' runs-on: 'macos-latest' steps: - name: 'Install packages' - run: | - brew install \ - curl libidn2 make zip + run: 'brew install curl libidn2 make zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Build project' - run: | - make clean all + run: 'make clean all' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0638161..5064dff 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,20 +8,17 @@ on: jobs: - lint: - name: 'Lint' + lint-shellcheck-stable: + name: 'Lint with stable ShellCheck' runs-on: 'ubuntu-latest' container: image: 'docker.io/koalaman/shellcheck-alpine:stable' steps: - name: 'Install packages' - run: | - apk add --no-cache gzip make tar + run: 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - name: 'Print ShellCheck version' - run: | - shellcheck --version + run: 'shellcheck --version' - name: 'Lint project' - run: | - make clean lint + run: 'make clean lint' diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index c03e0e7..e12da1f 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -12,23 +12,20 @@ jobs: name: 'Create deb package' runs-on: 'ubuntu-latest' container: - image: 'docker.io/ubuntu:latest' + image: 'docker.io/debian:latest' steps: + - name: 'Install packages' + run: 'apt-get update && apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'apt-get update && apt-get install -y build-essential debhelper dh-systemd dpkg-dev' - name: 'Checkout project' uses: 'actions/checkout@main' - - name: 'Install packages' - run: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - build-essential debhelper dh-systemd dpkg-dev make - name: 'Package project' run: | - if [ -d ./resources/deb/ ]; then - make clean package-deb - mv ./dist/ ./dist-package-deb/ - apt install -y ./dist-package-deb/hblock-*.deb - command hblock -v - fi + make clean package-deb + mv ./dist/ ./dist-package-deb/ + apt install -y ./dist-package-deb/hblock-*.deb + command hblock -v package-rpm: name: 'Create RPM package' @@ -36,39 +33,32 @@ jobs: container: image: 'docker.io/fedora:latest' steps: + - name: 'Install packages' + run: 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'dnf install -y rpm-build rpmdevtools systemd' - name: 'Checkout project' uses: 'actions/checkout@main' - - name: 'Install packages' - run: | - dnf install -y \ - make rpm-build rpmdevtools systemd - name: 'Package project' run: | - if [ -d ./resources/rpm/ ]; then - make clean package-rpm - mv ./dist/ ./dist-package-rpm/ - dnf install -y ./dist-package-rpm/hblock-*.rpm - command hblock -v - fi + make clean package-rpm + mv ./dist/ ./dist-package-rpm/ + dnf install -y ./dist-package-rpm/hblock-*.rpm + command hblock -v package-npm: name: 'Create NPM package' runs-on: 'ubuntu-latest' container: - image: 'docker.io/node:current' + image: 'docker.io/node:current-alpine' steps: + - name: 'Install packages' + run: 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' - name: 'Checkout project' uses: 'actions/checkout@main' - - name: 'Install packages' - run: | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - gzip make tar wget - name: 'Package project' run: | - if [ -d ./resources/npm/ ]; then - make clean package-npm - mv ./dist/ ./dist-package-npm/ - npm install -g ./dist-package-npm/hblock-*.tgz - command hblock -v - fi + make clean package-npm + mv ./dist/ ./dist-package-npm/ + npm install -g ./dist-package-npm/hblock-*.tgz + command hblock -v diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3b1a6e0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,100 @@ +name: 'Lint' + +on: + push: + branches: ['*'] + pull_request: + branches: ['*'] + +jobs: + + test-bash-latest: + name: 'Test on latest Bash' + runs-on: 'ubuntu-latest' + container: 'docker.io/bash:latest' + steps: + - name: 'Install packages' + run: 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'bash --version' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v bash)"' + + test-dash-latest: + name: 'Test on latest Dash' + runs-on: 'ubuntu-latest' + container: 'docker.io/debian:latest' + steps: + - name: 'Install packages' + run: 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'apt-get update && apt-get install -y dash' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'dpkg -s dash' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v dash)"' + + test-ksh-latest: + name: 'Test on latest ksh' + runs-on: 'ubuntu-latest' + container: 'docker.io/debian:latest' + steps: + - name: 'Install packages' + run: 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'apt-get update && apt-get install -y ksh' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'dpkg -s ksh' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v ksh)"' + + test-mksh-latest: + name: 'Test on latest mksh' + runs-on: 'ubuntu-latest' + container: 'docker.io/debian:latest' + steps: + - name: 'Install packages' + run: 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'apt-get update && apt-get install -y mksh' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'dpkg -s mksh' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v mksh)"' + + test-busybox-latest: + name: 'Test on latest BusyBox' + runs-on: 'ubuntu-latest' + container: 'docker.io/debian:latest' + steps: + - name: 'Install packages' + run: 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - name: 'Install packages (2nd stage)' + run: 'apt-get update && apt-get install -y busybox' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'dpkg -s busybox' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v busybox) sh"' + + test-macos-latest: + name: 'Test on latest macOS' + runs-on: 'macos-latest' + steps: + - name: 'Install packages' + run: 'brew install curl libidn2 make zip' + - name: 'Checkout project' + uses: 'actions/checkout@main' + - name: 'Print shell version' + run: 'bash --version' + - name: 'Test project' + run: 'make clean test HBLOCK_TEST_SHELL="$(command -v bash)"' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4bb9369..0331f8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - 'lint' + - 'test' - 'build' - 'package' - 'deploy' @@ -7,194 +8,195 @@ stages: default: image: 'docker.io/alpine:latest' -lint: +lint-shellcheck-stable: stage: 'lint' image: 'docker.io/koalaman/shellcheck-alpine:stable' before_script: - - | - apk add --no-cache make - shellcheck --version + - 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' + - 'shellcheck --version' script: - - | - make clean lint + - 'make clean lint' -build:ubuntu:latest: - stage: 'build' - image: 'docker.io/ubuntu:latest' +test-bash-latest: + stage: 'test' + image: 'docker.io/bash:latest' before_script: - - | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates curl file findutils gawk grep gzip idn2 make sed tar zip + - 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' + - 'bash --version' script: - - | - make clean all - mv ./dist/ ./dist-build-ubuntu-latest/ - artifacts: - expire_in: '1 day' - paths: ['./dist-build-ubuntu-latest/'] + - 'make clean test HBLOCK_TEST_SHELL="$(command -v bash)"' -build:debian:latest: +test-dash-latest: + stage: 'test' + image: 'docker.io/debian:latest' + before_script: + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - 'apt-get install -y dash' + - 'dpkg -s dash' + script: + - 'make clean test HBLOCK_TEST_SHELL="$(command -v dash)"' + +test-ksh-latest: + stage: 'test' + image: 'docker.io/debian:latest' + before_script: + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - 'apt-get install -y ksh' + - 'dpkg -s ksh' + script: + - 'make clean test HBLOCK_TEST_SHELL="$(command -v ksh)"' + +test-mksh-latest: + stage: 'test' + image: 'docker.io/debian:latest' + before_script: + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - 'apt-get install -y mksh' + - 'dpkg -s mksh' + script: + - 'make clean test HBLOCK_TEST_SHELL="$(command -v mksh)"' + +test-busybox-latest: + stage: 'test' + image: 'docker.io/bash:latest' + before_script: + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - 'apt-get install -y busybox' + - 'dpkg -s busybox' + script: + - 'make clean test HBLOCK_TEST_SHELL="$(command -v busybox) sh"' + +build-debian-latest: stage: 'build' image: 'docker.io/debian:latest' before_script: - - | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates curl file findutils gawk grep gzip idn2 make sed tar zip + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-debian-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-debian-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-debian-latest/'] -build:fedora:latest: +build-ubuntu-latest: + stage: 'build' + image: 'docker.io/ubuntu:latest' + before_script: + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + script: + - 'make clean all' + - 'mv ./dist/ ./dist-build-ubuntu-latest/' + artifacts: + expire_in: '1 day' + paths: ['./dist-build-ubuntu-latest/'] + +build-fedora-latest: stage: 'build' image: 'docker.io/fedora:latest' before_script: - - | - dnf install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + - 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-fedora-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-fedora-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-fedora-latest/'] -build:centos:latest: +build-centos-latest: stage: 'build' image: 'docker.io/centos:latest' before_script: - - | - dnf install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + - 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-centos-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-centos-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-centos-latest/'] -build:opensuse:latest: +build-opensuse-latest: stage: 'build' image: 'docker.io/opensuse/tumbleweed:latest' before_script: - - | - zypper install -y \ - ca-certificates curl file findutils gawk grep gzip libidn2-tools make sed tar zip + - 'zypper install -y ca-certificates curl file findutils grep gzip libidn2-tools make mawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-opensuse-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-opensuse-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-opensuse-latest/'] -build:archlinux:latest: +build-archlinux-latest: stage: 'build' image: 'docker.io/archlinux:latest' before_script: - - | - pacman -Sy --noconfirm --needed \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + - 'pacman -Sy --noconfirm --needed ca-certificates curl file findutils grep gzip libidn2 make nawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-archlinux-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-archlinux-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-archlinux-latest/'] -build:alpine:latest: +build-alpine-latest: stage: 'build' image: 'docker.io/alpine:latest' before_script: - - | - apk add --no-cache \ - ca-certificates curl file findutils gawk grep gzip libidn2 make sed tar zip + - 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' script: - - | - make clean all - mv ./dist/ ./dist-build-alpine-latest/ + - 'make clean all' + - 'mv ./dist/ ./dist-build-alpine-latest/' artifacts: expire_in: '1 day' paths: ['./dist-build-alpine-latest/'] -build:busybox:latest: - stage: 'build' - image: 'docker.io/busybox:latest' - script: - - | # Partial build, since Busybox does not have the necessary tools. - find ./resources/tests/ -type f -name 'test-*.sh' | sort -n | xargs -n1 /bin/sh - mkdir ./dist/; HOSTNAME='' ./hblock -H builtin -F builtin -S builtin -A builtin -D builtin -O ./dist/hosts - ./resources/alt-formats/domains.txt.sh ./dist/hosts ./dist/hosts_domains.txt ./hblock - ./resources/stats/suffix.sh ./dist/hosts_domains.txt none > ./dist/most_abused_tlds.txt - ./resources/templates/index.sh ./dist/ > ./dist/index.html - mv ./dist/ ./dist-build-busybox-latest/ - artifacts: - expire_in: '1 day' - paths: ['./dist-build-busybox-latest/'] - -package:deb: +package-deb: stage: 'package' - image: 'docker.io/ubuntu:latest' + image: 'docker.io/debian:latest' before_script: - - | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - build-essential debhelper dh-systemd dpkg-dev make + - 'apt-get update' + - 'apt-get install -y ca-certificates curl file findutils grep gzip idn2 make mawk sed tar zip' + - 'apt-get install -y build-essential debhelper dh-systemd dpkg-dev' script: - - | - if [ -d ./resources/deb/ ]; then - make clean package-deb - mv ./dist/ ./dist-package-deb/ - apt install -y ./dist-package-deb/hblock-*.deb - command hblock -v - fi + - 'make clean package-deb' + - 'mv ./dist/ ./dist-package-deb/' + - 'apt install -y ./dist-package-deb/hblock-*.deb' + - 'command hblock -v' artifacts: expire_in: '1 day' paths: ['./dist-package-deb/'] -package:rpm: +package-rpm: stage: 'package' image: 'docker.io/fedora:latest' before_script: - - | - dnf install -y \ - make rpm-build rpmdevtools systemd + - 'dnf install -y ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' + - 'dnf install -y rpm-build rpmdevtools systemd' script: - - | - if [ -d ./resources/rpm/ ]; then - make clean package-rpm - mv ./dist/ ./dist-package-rpm/ - dnf install -y ./dist-package-rpm/hblock-*.rpm - command hblock -v - fi + - 'make clean package-rpm' + - 'mv ./dist/ ./dist-package-rpm/' + - 'dnf install -y ./dist-package-rpm/hblock-*.rpm' + - 'command hblock -v' artifacts: expire_in: '1 day' paths: ['./dist-package-rpm/'] -package:npm: +package-npm: stage: 'package' - image: 'docker.io/node:current' + image: 'docker.io/node:current-alpine' before_script: - - | - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - gzip make tar wget + - 'apk add --no-cache ca-certificates curl file findutils grep gzip libidn2 make mawk sed tar zip' script: - - | - if [ -d ./resources/npm/ ]; then - make clean package-npm - mv ./dist/ ./dist-package-npm/ - npm install -g ./dist-package-npm/hblock-*.tgz - command hblock -v - fi + - 'make clean package-npm' + - 'mv ./dist/ ./dist-package-npm/' + - 'npm install -g ./dist-package-npm/hblock-*.tgz' + - 'command hblock -v' artifacts: expire_in: '1 day' paths: ['./dist-package-npm/'] @@ -203,7 +205,6 @@ pages: stage: 'deploy' only: ['master'] script: - - | - mv ./dist-build-ubuntu-latest/ ./public/ + - 'mv ./dist-build-debian-latest/ ./public/' artifacts: paths: ['./public/'] diff --git a/Makefile b/Makefile index fe90bc9..fa73229 100755 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ VERSION := $(shell ./resources/version/version.sh get) .PHONY: all all: - $(MAKE) test $(MAKE) build stats $(MAKE) index diff --git a/resources/tests/env.sh b/resources/tests/env.sh index 24aa7b9..0fa6b3c 100644 --- a/resources/tests/env.sh +++ b/resources/tests/env.sh @@ -9,7 +9,9 @@ export LC_ALL='C' SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" -export TEST_SHELL='/bin/sh' +if [ -z "${HBLOCK_TEST_SHELL+x}" ]; then + export HBLOCK_TEST_SHELL='/bin/sh' +fi export HBLOCK_OUTPUT_FILE='/dev/null' diff --git a/resources/tests/test-000.sh b/resources/tests/test-000.sh index ac6bb6a..fbb2195 100755 --- a/resources/tests/test-000.sh +++ b/resources/tests/test-000.sh @@ -16,13 +16,13 @@ main() { . "${SCRIPT_DIR:?}"/env.sh expected="$(cat -- "${SCRIPT_DIR:?}"/test-000.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --no-lenient 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --no-lenient 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 000 - OK\n' + printf -- 'Test 000 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 000 - FAIL\n' >&2 + printf -- 'Test 000 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-001.sh b/resources/tests/test-001.sh index db0e10b..1541bd8 100755 --- a/resources/tests/test-001.sh +++ b/resources/tests/test-001.sh @@ -16,13 +16,13 @@ main() { . "${SCRIPT_DIR:?}"/env.sh expected="$(cat -- "${SCRIPT_DIR:?}"/test-001.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --lenient 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --lenient 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 001 - OK\n' + printf -- 'Test 001 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 001 - FAIL\n' >&2 + printf -- 'Test 001 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-002.sh b/resources/tests/test-002.sh index 191ef71..a95e97c 100755 --- a/resources/tests/test-002.sh +++ b/resources/tests/test-002.sh @@ -18,13 +18,13 @@ main() { export HBLOCK_SOURCES='' expected="$(cat -- "${SCRIPT_DIR:?}"/test-002.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 002 - OK\n' + printf -- 'Test 002 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 002 - FAIL\n' >&2 + printf -- 'Test 002 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-003.sh b/resources/tests/test-003.sh index 29546ae..aca158b 100755 --- a/resources/tests/test-003.sh +++ b/resources/tests/test-003.sh @@ -18,13 +18,13 @@ main() { export HBLOCK_SOURCES='' expected="$(cat -- "${SCRIPT_DIR:?}"/test-003.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --comment='//' -- --comment='!' 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --comment='//' -- --comment='!' 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 003 - OK\n' + printf -- 'Test 003 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 003 - FAIL\n' >&2 + printf -- 'Test 003 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-004.sh b/resources/tests/test-004.sh index 6ff1cd7..64b96fc 100755 --- a/resources/tests/test-004.sh +++ b/resources/tests/test-004.sh @@ -39,13 +39,13 @@ main() { )" expected="$(cat -- "${SCRIPT_DIR:?}"/test-004.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 004 - OK\n' + printf -- 'Test 004 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 004 - FAIL\n' >&2 + printf -- 'Test 004 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-005.sh b/resources/tests/test-005.sh index 034dede..513d2fc 100755 --- a/resources/tests/test-005.sh +++ b/resources/tests/test-005.sh @@ -31,13 +31,13 @@ main() { )" expected="$(cat -- "${SCRIPT_DIR:?}"/test-005.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --no-regex 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --no-regex 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 005 - OK\n' + printf -- 'Test 005 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 005 - FAIL\n' >&2 + printf -- 'Test 005 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-006.sh b/resources/tests/test-006.sh index 340692b..5a06437 100755 --- a/resources/tests/test-006.sh +++ b/resources/tests/test-006.sh @@ -31,13 +31,13 @@ main() { )" expected="$(cat -- "${SCRIPT_DIR:?}"/test-006.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --regex 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --regex 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 006 - OK\n' + printf -- 'Test 006 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 006 - FAIL\n' >&2 + printf -- 'Test 006 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-007.sh b/resources/tests/test-007.sh index d209c4b..2882adc 100755 --- a/resources/tests/test-007.sh +++ b/resources/tests/test-007.sh @@ -16,13 +16,13 @@ main() { . "${SCRIPT_DIR:?}"/env.sh expected="$(cat -- "${SCRIPT_DIR:?}"/test-007.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -O- -H/dev/null -F /dev/null --sources /dev/null --allowlist=/dev/null -rcqI 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -O- -H/dev/null -F /dev/null --sources /dev/null --allowlist=/dev/null -rcqI 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 007 - OK\n' + printf -- 'Test 007 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 007 - FAIL\n' >&2 + printf -- 'Test 007 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-008.sh b/resources/tests/test-008.sh index acf2b05..e70cfa4 100755 --- a/resources/tests/test-008.sh +++ b/resources/tests/test-008.sh @@ -16,13 +16,13 @@ main() { . "${SCRIPT_DIR:?}"/env.sh expected="$(cat -- "${SCRIPT_DIR:?}"/test-008.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --continue --no-regex --lenient --invalid 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --continue --no-regex --lenient --invalid 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 008 - OK\n' + printf -- 'Test 008 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 008 - FAIL\n' >&2 + printf -- 'Test 008 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1 diff --git a/resources/tests/test-009.sh b/resources/tests/test-009.sh index 355486a..8a1ea29 100755 --- a/resources/tests/test-009.sh +++ b/resources/tests/test-009.sh @@ -16,13 +16,13 @@ main() { . "${SCRIPT_DIR:?}"/env.sh expected="$(cat -- "${SCRIPT_DIR:?}"/test-009.out)" - obtained="$("${TEST_SHELL:?}" "${hblock:?}" -qO- --header=/no/such/file 2>&1 ||:)" + obtained="$(${HBLOCK_TEST_SHELL:?} "${hblock:?}" -qO- --header=/no/such/file 2>&1 ||:)" if [ "${obtained?}" = "${expected?}" ]; then - printf -- 'Test 009 - OK\n' + printf -- 'Test 009 - %s - OK\n' "${HBLOCK_TEST_SHELL:?}" exit 0 else - printf -- 'Test 009 - FAIL\n' >&2 + printf -- 'Test 009 - %s - FAIL\n' "${HBLOCK_TEST_SHELL:?}" >&2 printf -- 'Expected:\n\n%s\n\n' "${expected?}" >&2 printf -- 'Obtained:\n\n%s\n\n' "${obtained?}" >&2 exit 1