Skip to content

Commit

Permalink
Patch release 0.2.1
Browse files Browse the repository at this point in the history
Signed-off-by: Torsten Long <[email protected]>
  • Loading branch information
razziel89 committed Nov 17, 2023
1 parent f21f127 commit 3a89e3e
Show file tree
Hide file tree
Showing 15 changed files with 267 additions and 120 deletions.
37 changes: 33 additions & 4 deletions .github/workflows/test-lint-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ jobs:

steps:
- name: Install system dependencies
env:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -qq
sudo apt-get install -qqy --no-install-recommends \
ca-certificates coreutils curl git jq kcov make shellcheck
build-essential ca-certificates coreutils curl gawk gcc git jq \
kcov make shellcheck
- name: Install bats
run: |
Expand All @@ -65,18 +66,46 @@ jobs:
chmod +x shfmt
sudo mv shfmt /usr/local/bin/shfmt
- name: Install prettier
run: |
curl -sSfL -o install_nvm.sh https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh
echo "${NVMINSTALL_SHA256} install_nvm.sh" | sha256sum --check
bash install_nvm.sh
source "${HOME}/.nvm/nvm.sh"
nvm install "${NODE_VERSION}"
dirname "$(which npm)" >> "${GITHUB_PATH}"
npm install -g prettier
env:
NODE_VERSION: "20"
NVM_VERSION: v0.39.5
NVMINSTALL_SHA256: 69da4f89f430cd5d6e591c2ccfa2e9e3ad55564ba60f651f00da85e04010c640

- name: Install mdslw
run: |
curl -sSfL -o mdslw https://github.com/razziel89/mdslw/releases/download/${MDSLW_VERSION}/mdslw_x86_64-unknown-linux-musl
echo "${MDSLW_SHA256} mdslw" | sha256sum --check
chmod +x mdslw
sudo mv mdslw /usr/local/bin
env:
MDSLW_VERSION: 0.5.5
MDSLW_SHA256: 04d944b8e9596b82b7511c29bbf5ff10ab3ca707772d6a3164acb087a7e3f02e

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build Package
run: make build

- name: Test Package
run: make test

- name: Lint Package
run: make lint

- name: Build Package
run: make build
- name: Test Supported Bash Versions
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') }}
run: make test-bash-versions

- name: Publish package on GH (only tags)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Deployable.
/shellmock.bash
/.coverage
# Version test artefacts.
/.failed
/.bash-*_test.log
6 changes: 3 additions & 3 deletions 3rd-party-licenses.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Copyright (c) 2022 - for information on the respective copyright owner
see the NOTICE file or the repository
https://github.com/boschresearch/shellmock
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Expand Down
31 changes: 16 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Copyright (c) 2022 - for information on the respective copyright owner
see the NOTICE file or the repository
https://github.com/boschresearch/shellmock
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Expand All @@ -27,10 +27,10 @@ Shellmock team early in the process.
Coordinating up front helps to avoid frustration later on.
Please make sure to:

- add tests for all new or updated code
- make sure existing tests work by running `make test`
- make sure the code follows this repository's guidelines by running the
commands `make format` and `make lint`
- add tests for all new or updated code
- make sure existing tests work by running `make test`
- make sure the code follows this repository's guidelines by running the
commands `make format` and `make lint`

Your contribution must be licensed under the Apache-2.0 license, the license
used by this project.
Expand Down Expand Up @@ -90,8 +90,9 @@ By making a contribution to this project, I certify that:

With the sign-off in a commit message you certify that you authored the patch or
otherwise have the right to submit it under an open source license.
The procedure is simple: To certify above Developer's Certificate of Origin 1.1
for your contribution just append a line
The procedure is simple:
To certify above Developer's Certificate of Origin 1.1 for your contribution
just append a line

```text
Signed-off-by: Random J Developer <[email protected]>
Expand All @@ -112,9 +113,9 @@ which is stored in an external repository.

### Individual vs. Corporate Contributors

Often employers or academic institution have ownership over code that is
written in certain circumstances, so please do due diligence to ensure that
you have the rights to submit the code.
Often employers or academic institution have ownership over code that is written
in certain circumstances, so please do due diligence to ensure that you have the
rights to submit the code.

If you are a developer who is authorized to contribute to Shellmock on behalf of
your employer, then please use your corporate email address in the Signed-off-by
Expand Down Expand Up @@ -146,13 +147,13 @@ holder(s) to the [NOTICE](./NOTICE) file as part of your contribution.
Copyright (c) 2022 - for information on the respective copyright owner
see the NOTICE file or the repository
https://github.com/boschresearch/shellmock
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Expand Down
49 changes: 45 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2022 - for information on the respective copyright owner
# see the NOTICE file or the repository
# https://github.com/boschresearch/shellmock
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Expand Down Expand Up @@ -40,6 +40,45 @@ lint:
test: build
bats --print-output-on-failure ./tests/*.bats

DOWNLOAD_URL_PREFIX := https://mirror.kumi.systems/gnu/bash/

.PHONY: build-bash-version
build-bash-version:
# Ensure that the arguments have been set.
[[ -n "$(BASH_VERSION)" && -n "$(BASH_PATH)" ]]
cd "$(BASH_PATH)" && \
curl -sSfL -o bash.tar.gz "$(DOWNLOAD_URL_PREFIX)/bash-$(BASH_VERSION).tar.gz" && \
tar -xvzf bash.tar.gz && \
cd "bash-$(BASH_VERSION)" && \
./configure && \
make && \
mv bash "$(BASH_PATH)"

.PHONY: test-bash-version
test-bash-version:
# Ensure that the temp dir will be removed afterwards.
tmp=$$(mktemp -d) && trap "rm -rf '$${tmp}'" EXIT && \
$(MAKE) build-bash-version BASH_PATH="$${tmp}" && \
export PATH="$${tmp}:$${PATH}" && \
echo "INFO: using $$(which bash) @ $$(bash -c 'echo $${BASH_VERSION}')" && \
bats --print-output-on-failure ./tests/*.bats

SUPPORTED_VERSIONS := 5.2 5.1 5.0 4.4

.PHONY: test-bash-versions
test-bash-versions: build
rm -f .failed .bash-*_test.log
for version in $(SUPPORTED_VERSIONS); do \
$(MAKE) test-bash-version BASH_VERSION="$${version}" 2>&1 \
| tee ".bash-$${version}_test.log" \
|| echo "$${version}" >> .failed & \
done; \
wait
if [[ -s .failed ]]; then \
echo "Failed versions: $$(sort .failed | tr -s '[:space:]' ' ')"; \
fi
[[ ! -s .failed ]]

COVERAGE_FAILED_MESSAGE := \
Cannot generate coverage reports as root user because kcov is not \
compatible with current versions of bash when run as root, also see \
Expand All @@ -54,7 +93,7 @@ coverage: test
bats --print-output-on-failure ./tests/*.bats
# Analyse output of coverage reports and fail if not all files have been
# covered of if coverage is not high enough.
awk \
gawk \
-v min_cov="92" \
-v tot_num_files="1" \
'BEGIN{num_files=0; cov=0;} \
Expand All @@ -77,10 +116,12 @@ coverage: test
format:
shfmt -w -bn -i 2 -sr -ln bash ./bin/* ./lib/*
shfmt -w -bn -i 2 -sr -ln bats ./tests/*
mdslw --mode=format --upstream="prettier --parser=markdown" .

check-format:
shfmt -d -bn -i 2 -sr -ln bash ./bin/* ./lib/*
shfmt -d -bn -i 2 -sr -ln bats ./tests/*
mdslw --mode=check --upstream="prettier --parser=markdown" .

build:
./generate_deployable.sh
Expand Down
Loading

0 comments on commit 3a89e3e

Please sign in to comment.