-
Notifications
You must be signed in to change notification settings - Fork 6k
Make installer work on any os/arch and add installer tests #3712
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
Conversation
5e49d2d
to
c23439f
Compare
Codecov Report
@@ Coverage Diff @@
## main #3712 +/- ##
=======================================
Coverage 62.89% 62.89%
=======================================
Files 35 35
Lines 1838 1838
Branches 371 371
=======================================
Hits 1156 1156
Misses 577 577
Partials 105 105 Continue to review full report at Codecov.
|
3bb0c6d
to
8133e7e
Compare
Will this fix #3585? |
d472d4e
to
20bc84b
Compare
Nope but I'll add a fix. |
b8dce0f
to
ed3e60d
Compare
test: | ||
name: Run script unit tests | ||
runs-on: ubuntu-latest | ||
# This runs on Alpine to make sure we're testing with actual sh. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, doesn't the script force things to run as bash due to the shebang? Also, Ubuntu should include Bourne shell (e.g. dash) too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installer shebang is #!/bin/sh
but since that's often a symlink to bash/dash/etc I've used Alpine to make sure it's really using sh
to catch any bashisms that might sneak in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Good point, I was looking at test-scripts.sh
, which uses bash explicitly: #!/usr/bin/env bash
This makes sense then. I think Ubuntu should be using dash for /bin/sh by default, though I'm not sure if GitHub Actions does some customization to the environment:
$ docker run --rm -it ubuntu:latest
root@081f1b5d886d:/# which sh
/usr/bin/sh
root@081f1b5d886d:/# ls -al /usr/bin/sh
lrwxrwxrwx 1 root root 4 Jul 18 2019 /usr/bin/sh -> dash
There's also a handy checkbashisms
script in devscripts
(install it with apt) that you may find useful. I use it in my dotfiles build: https://github.com/jawnsy/dotfiles/blob/0a27557f15aba599056171abc5ff936e7b530d13/.github/workflows/build.yml#L49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's dope! I'll definitely add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Really happy you laid a foundation for writing script tests. Maybe this'll motivate me to write some for our other scripts.
Previously if the prefix was non-existent we would switch to root even if the user does have the permissions to create the directory. Fixes coder#3585
No description provided.