-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: extract inline bash into testable scripts with CI pipeline #132
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
Changes from all commits
1deca16
153e9ac
d46d282
1dde674
8d7d9db
8e6fd8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you test the whole refactored implementation already in another repository? 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR includes 64 unit tests that cover all extracted bash logic (tag generation, architecture validation, retagging, GitOps updates, deployment annotations). These validate the refactored scripts behave identically to the original inline bash. I will test it today and report back.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Working examples:
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Shellcheck | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Install mise | ||
| uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | ||
|
|
||
| - name: Run shellcheck | ||
| run: mise run lint | ||
|
|
||
| test: | ||
| name: Bash Tests | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Install mise | ||
| uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2 | ||
|
|
||
| - name: Run tests | ||
| run: mise run test | ||
|
|
||
| validate-action: | ||
| name: Validate Action Structure | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Verify all referenced scripts exist | ||
| run: | | ||
| grep -oP 'github\.action_path \}\}/\K[^ "]+' action.yml | while read -r script; do | ||
| if [[ ! -f "$script" ]]; then | ||
| echo "::error::Script referenced in action.yml does not exist: $script" | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| - name: Verify scripts are executable | ||
| run: | | ||
| find scripts/ -name '*.sh' | while read -r script; do | ||
| if [[ ! -x "$script" ]]; then | ||
| echo "::error::Script is not executable: $script" | ||
| exit 1 | ||
| fi | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,14 @@ | ||
| # Intellij | ||
| .idea/* | ||
|
|
||
| # Node | ||
| node_modules/ | ||
| package.json | ||
| package-lock.json | ||
|
|
||
| # Test helper libraries (installed during CI/local setup) | ||
| tests/test_helper/bats-support/ | ||
| tests/test_helper/bats-assert/ | ||
|
|
||
| # Test artifacts | ||
| headers.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| shell=bash | ||
| external-sources=true |
Uh oh!
There was an error while loading. Please reload this page.