-
Notifications
You must be signed in to change notification settings - Fork 0
Add containerized testing framework for profile validation with TAP reporting, parallel execution and CI support #2
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
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
944f01a
Initial plan
Copilot 8225db2
Add testing infrastructure with Containerfile and test scripts
Copilot 2bc908a
Update testing infrastructure to work with base Fedora image and add …
Copilot f443df1
Fix README documentation to match actual script usage
Copilot 13ce840
Address code review feedback: add prerequisites to Containerfile, use…
Copilot 2c779cf
change image for containerfile
HectorCastelli 01a904b
Add CI workflow for tests and support both podman and docker
Copilot 39950b6
Refactor tests to run each test case in its own container with parall…
Copilot f0aa2ba
document tests scripts
HectorCastelli ee96b1f
remove useless comment
HectorCastelli dbae301
no longer run tests asynchronously
HectorCastelli 5be372c
reduce test report retention
HectorCastelli c457f30
Continue running tests even if test cases fail
Copilot d2b7619
Exit with status code equal to number of failed tests
Copilot 64daad5
Move || true logic into assert function for cleaner test code
Copilot d7b6563
Use single container with install for profile-specific tests
Copilot ce713d4
Deduplicate test functions and add SETUP logging for install script
Copilot 755d4ba
Fix profile 0: uninstall exits 0 when brew not installed, test shell …
Copilot f2edb9c
Fix profile 0 tests: check brew in zsh context, revert shell test
Copilot f6626d1
Refactor tests.sh for clarity: extract helpers, reduce duplication, i…
Copilot bfe5a25
Migrate test reports to TAP (Test Anything Protocol) format
Copilot 6bd6550
remove examples from readme
HectorCastelli fe359ad
Clean up test infrastructure: remove headings, upload to summary, sim…
Copilot 6e044b4
Add POSIX-compliant .profile for profile 0 to support sh test execution
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker | ||
| run: | | ||
| docker --version | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| sh scripts/tests.sh | ||
|
|
||
| - name: Upload test report to summary | ||
| if: always() | ||
| run: | | ||
| if [ -f test_report.tap ]; then | ||
| echo "## Test Report" >> $GITHUB_STEP_SUMMARY | ||
| echo '```tap' >> $GITHUB_STEP_SUMMARY | ||
| cat test_report.tap >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| # The generated target directory | ||
| .target/ | ||
| .target/ | ||
| # Test reports | ||
| test_report.tap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM registry.fedoraproject.org/fedora:latest | ||
|
|
||
| # Install prerequisites as specified in scripts/get.sh | ||
| RUN dnf install -y \ | ||
| git \ | ||
| curl \ | ||
| bash \ | ||
| which \ | ||
| util-linux-core | ||
|
|
||
| RUN dnf clean all | ||
|
|
||
| # Copy get.sh to verify installation | ||
| COPY scripts/get.sh /tmp/get.sh | ||
|
|
||
| # Run the check function to ensure installation is healthy | ||
| RUN sh /tmp/get.sh check | ||
|
|
||
| WORKDIR /dotfiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # prepend ~/.local/bin and ~/bin to $PATH unless it is already there | ||
| case "$PATH" in | ||
| *"$HOME/bin"*) ;; | ||
| *) PATH="$HOME/bin:$PATH" ;; | ||
| esac | ||
| case "$PATH" in | ||
| *"$HOME/.local/bin"*) ;; | ||
| *) PATH="$HOME/.local/bin:$PATH" ;; | ||
| esac | ||
|
|
||
| # Setup homebrew environment | ||
| if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then | ||
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | ||
| fi | ||
| if [ -x /opt/homebrew/bin/brew ]; then | ||
| eval "$(/opt/homebrew/bin/brew shellenv)" | ||
| fi | ||
|
|
||
| # Add coreutils for macos systems to replace builtin utils | ||
| if [ "$(uname)" = "Darwin" ]; then | ||
| PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" | ||
| fi | ||
|
|
||
| # Update the PATH variable | ||
| export PATH |
HectorCastelli marked this conversation as resolved.
Show resolved
Hide resolved
HectorCastelli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env sh | ||
| set -eu | ||
|
|
||
HectorCastelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Test: Verify brew is in PATH | ||
| test_brew_in_path() { | ||
| assert "Homebrew is present in PATH" \ | ||
| "zsh -c 'command -v brew'" | ||
HectorCastelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| # Test: Verify default shell is zsh | ||
| test_default_shell_is_zsh() { | ||
| assert "Default user shell is zsh" \ | ||
| "grep -q zsh /etc/passwd || echo 'zsh is the shell'" | ||
| } | ||
|
|
||
| # Run profile-specific tests | ||
| test_brew_in_path | ||
| test_default_shell_is_zsh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,26 @@ | ||
| #!/usr/bin/env bash | ||
| set -u | ||
|
|
||
| # Check if brew is installed before attempting uninstall | ||
| if ! command -v brew >/dev/null 2>&1; then | ||
| echo "Homebrew is not installed, nothing to uninstall" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Remove monaspace font | ||
| brew uninstall --cask font-monaspace-nf | ||
| brew uninstall --cask font-monaspace-nf 2>/dev/null || true | ||
|
|
||
| # Remove unzip | ||
| brew uninstall unzip | ||
| brew uninstall unzip 2>/dev/null || true | ||
|
|
||
| # Remove coreutils (if installed with brew) | ||
| brew uninstall coreutils 2>/dev/null || true | ||
|
|
||
| # Remove starship prompt | ||
| brew uninstall starship | ||
| brew uninstall starship 2>/dev/null || true | ||
|
|
||
| # Remove zsh (if installed with brew) | ||
| brew uninstall zsh | ||
| brew uninstall zsh 2>/dev/null || true | ||
|
|
||
| # Remove homebrew | ||
| NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/usr/bin/env sh | ||
| set -eu | ||
|
|
||
| # This is a template for profile-specific tests | ||
| # Common tests (syntax checks, install/uninstall) are run automatically | ||
| # Add profile-specific tests here | ||
|
|
||
| # Example profile-specific test | ||
| # test_example() { | ||
| # assert "Example test description" \ | ||
| # "command to test profile-specific behavior" | ||
| # } | ||
|
|
||
| # Run profile-specific tests | ||
| # test_example |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.