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

Bash ver tests #8

Merged
merged 6 commits into from
Mar 31, 2020
Merged

Bash ver tests #8

merged 6 commits into from
Mar 31, 2020

Conversation

sdolenc
Copy link
Contributor

@sdolenc sdolenc commented Mar 29, 2020

running automated tests for various bash versions

OS ver bash ver
Debian 10 5.0
Debian 9.0 4.4
Debian 8.0 4.3
Debian 7.0 4.2

this starts to resolve issue #5

@sdolenc
Copy link
Contributor Author

sdolenc commented Mar 29, 2020

The commit description describes why changes were made, but to summarize:

  1. Empty arrays are treated as unassigned arrays in earlier bash versions (causing set -u to complain). The workaround is a somewhat strange syntax, but it's the best I could find https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u
  2. quoting numbers within $(( )) math expressions can trip up old versions of bash

@Checksum
Copy link
Owner

Thanks for the great work! I'm interested in seeing if we can get the same checks as GitHub Actions to keep it consistent with the existing tests. Been very busy at work, so this may take a couple of days. If that is going to be a lot of work, I'll just merge your changes in as is (any CI is better than no CI 😃 )

@Checksum
Copy link
Owner

I quickly tested running the same on GitHub Actions:

https://github.com/Checksum/critic.sh/blob/master/.github/workflows/main.yml#L16-L20

@sdolenc
Copy link
Contributor Author

sdolenc commented Mar 30, 2020

Makes sense. I'll take a peak at adjusting my existing PR to use github actions instead. I'll either update this pr with appropriate commit(s) or add comment(s) describing any hurdles I'm seeing.

The main difference I can think of offhand: it'll be easier to use Alpine containers for Bash 4.2 and below. I discovered earlier Debian versions don't work out-of-the-box with github actions because they have trouble installing the minimum node version github actions requires. I can think of some possible workarounds, but I think using Alpine is the easiest/cleanest solution.

The final results would look something like this

OS bash ver CI
Debian 10 5.0 yes
Debian 9.0 4.4 yes
Debian 8.0 4.3 yes
Alpine 4.2 yes
Alpine 4.1 soon
Alpine 4.0 tbd
Alpine 3.2 tbd
Alpine 3.1 tbd

I'll aim to investigate this week

sdolenc and others added 2 commits March 30, 2020 22:30
* removing circleci

* split shellcheck and tests. add test matrix

* print bash version

Co-authored-by: localstepdo <[email protected]>
@sdolenc
Copy link
Contributor Author

sdolenc commented Mar 31, 2020

Switching to github actions was easier than I anticipated 👍

@Checksum
Copy link
Owner

LGTM, thanks for picking this up!

@Checksum Checksum merged commit 7c141d8 into Checksum:master Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants