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

chore: Rework setup script #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

halostatue
Copy link

@halostatue halostatue commented Nov 22, 2024

Addresses #20 (comment).

@halostatue
Copy link
Author

I’m going to heavily annotate the changes I made to explain why. It makes a lot of changes that may or may not work with your ultimate goals, but inasmuch as I can test it locally (when I have everything except PostgreSQL installed), it seems to work once I added a DRY_RUN flag.

$ mkdir z && touch z/{.bashrc,.zshrc}
$ DRY_RUN=1 HOME=z priv/scirpt.sh

priv/script.sh Outdated Show resolved Hide resolved
@halostatue halostatue force-pushed the reworked-setup-and-config branch from e76cd1b to 09316ee Compare November 22, 2024 03:22
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Outdated Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
priv/script.sh Show resolved Hide resolved
@almirsarajcic
Copy link
Member

Wow, the best PR I've seen in my life!
Thanks for all the annotations. My shell scripting is bad, so this is a huge learning opportunity for me.

Most of the things you've changed I agree with. The rest I don't understand yet.

I'm only worried about whether we'll still be able to run the GitHub Actions workflow with these changes.
We don't have much in the expect script, so I thought our tests would be robust enough.

#!/usr/bin/expect
set script [lindex $argv 0]
set timeout -1
spawn ./../../priv/script.sh
match_max 100000
expect "Do you want to continue? (y/n) "
send -- "y\r"
expect eof

But they failed at line

spawn ./../../priv/script.sh
tput: No value for $TERM and no -T specified

@halostatue
Copy link
Author

Wow, the best PR I've seen in my life! Thanks for all the annotations. My shell scripting is bad, so this is a huge learning opportunity for me.

Thanks for the kind words. I’ve been shell scripting for decades now, so this really wasn't too hard.

Most of the things you've changed I agree with. The rest I don't understand yet.

I'm only worried about whether we'll still be able to run the GitHub Actions workflow with these changes. We don't have much in the expect script, so I thought our tests would be robust enough.

I didn't look at this from the perspective of testing, but from user experience. The test failures did point out a bug, and I should have tested for it, but it's sort of hard to test for on a machine. I’ve put a fixup commit that should resolve the test failures in the expect script. It makes a couple of changes to the expect script to make sure that a bit more is seen than was previously expected.

@almirsarajcic
Copy link
Member

spawn ./../../priv/script.sh
Unsupported shell: bash
expect: spawn id exp3 not open
    while executing
"expect "phx.tools setup is complete!""
    (file "script.exp" line 13)

This time I think it's because of this line
https://github.com/optimumBA/phx.tools/pull/27/files#diff-5cd7660b84bc8ab514a6b77b04c735c4581ddde80ed19035e9f08ded4a34aa50R83

*/bash | */fish | */zsh) : ;;

- name: Test the script
if: steps.result_cache.outputs.cache-hit != 'true'
run: cd test/scripts && expect script.exp
shell: bash -l {0}

https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell
Not sure if /bin/ prefix works for the shell option.

@halostatue
Copy link
Author

I'll look at that a bit later. Probably by pushing a debugging fix.

@halostatue halostatue force-pushed the reworked-setup-and-config branch 4 times, most recently from bd54cb5 to 9319c8e Compare November 23, 2024 01:21
.github/dependabot.yml Show resolved Hide resolved
.github/github_workflows.ex Outdated Show resolved Hide resolved
.github/github_workflows.ex Outdated Show resolved Hide resolved
.github/github_workflows.ex Show resolved Hide resolved
@halostatue halostatue force-pushed the reworked-setup-and-config branch from 9319c8e to e0d8374 Compare January 9, 2025 03:09
@halostatue halostatue marked this pull request as ready for review January 9, 2025 03:30
@halostatue halostatue force-pushed the reworked-setup-and-config branch from 23e053a to 3074ff8 Compare January 9, 2025 03:59
- Add dependency checking with dependabot.
- Put more specific version locks for actions.
- Upgrade actions which were using Node 16 actions.
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