-
Notifications
You must be signed in to change notification settings - Fork 1
Add automated testing infrastructure for Ubuntu bootstrap #5
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8f880ca
Add automated testing infrastructure for Ubuntu bootstrap
mapitman 8aa1ed9
Fix shellcheck warnings for CI compliance
mapitman c597fbc
Make all shell scripts executable
mapitman 50ac203
Exclude markdown files from shellcheck in CI
mapitman ea6dfe3
Exclude markdown files from all shellcheck CI jobs
mapitman 69e4d3d
Update Ubuntu test versions to 24.04 and 25.10
mapitman 17e9b34
Address PR feedback: usage, shellcheck, and test targets
mapitman fe4e7c3
Pin auto-cpufreq to verified release
mapitman cf6722c
Exclude Dockerfiles from shellcheck in CI
mapitman fedc7da
Remove auto-cpufreq due to unavailable pinned release version
mapitman 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
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,64 @@ | ||
| name: Test Ubuntu Bootstrap | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'ubuntu/**' | ||
| - 'generic/**' | ||
| - 'bootstrap' | ||
| - '.github/workflows/test-ubuntu.yml' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'ubuntu/**' | ||
| - 'generic/**' | ||
| - 'bootstrap' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| shellcheck: | ||
| name: ShellCheck Linting | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Run ShellCheck | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y shellcheck | ||
| find ubuntu/ generic/ -type f ! -name "*.md" -exec shellcheck -x --severity=error {} \; | ||
| shellcheck -x --severity=error bootstrap | ||
|
|
||
| docker-test: | ||
| name: Docker Test (Ubuntu ${{ matrix.ubuntu-version }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| ubuntu-version: ['24.04', '25.10'] | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build test image | ||
| run: | | ||
| docker build \ | ||
| --build-arg UBUNTU_VERSION=${{ matrix.ubuntu-version }} \ | ||
| -f test/docker/Dockerfile.ubuntu-noninteractive \ | ||
| -t ubuntu-bootstrap-test:${{ matrix.ubuntu-version }} \ | ||
| . | ||
|
|
||
| - name: Run bootstrap tests | ||
| run: | | ||
| docker run --rm ubuntu-bootstrap-test:${{ matrix.ubuntu-version }} | ||
|
|
||
| - name: Test individual scripts | ||
| run: | | ||
| docker run --rm ubuntu-bootstrap-test:${{ matrix.ubuntu-version }} bash -c " | ||
| cd /home/testuser/linux-bootstrap && \ | ||
| bash -n ubuntu/bootstrap && \ | ||
| bash -n ubuntu/install-essential-packages && \ | ||
| bash -n ubuntu/install-dev-packages && \ | ||
| bash -n ubuntu/install-desktop-packages && \ | ||
| echo 'All syntax checks passed' | ||
| " | ||
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,65 @@ | ||
| .PHONY: help test test-auto test-interactive test-all test-syntax lint clean build-test-images docker-clean shellcheck | ||
|
|
||
| # Default target | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| # Ubuntu versions to test | ||
| UBUNTU_VERSIONS := 24.04 25.10 | ||
|
|
||
| help: ## Show this help message | ||
| @echo "Linux Bootstrap Testing Makefile" | ||
| @echo "" | ||
| @echo "Usage: make [target]" | ||
| @echo "" | ||
| @echo "Available targets:" | ||
| @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
|
||
| test: test-auto ## Run automated tests (default: Ubuntu 24.04) | ||
|
|
||
| test-auto: ## Run automated tests on Ubuntu 24.04 | ||
| @./test/run-tests.sh auto | ||
|
|
||
| test-interactive: ## Start interactive Docker container for manual testing | ||
| @./test/run-tests.sh interactive | ||
|
|
||
| test-all: ## Run tests on all Ubuntu versions (24.04, 25.10) | ||
| @./test/run-tests.sh all | ||
|
|
||
| test-syntax: ## Run syntax checks on all bash scripts | ||
| @./test/run-tests.sh syntax | ||
|
|
||
| lint: shellcheck ## Run all linting tools | ||
|
|
||
| shellcheck: ## Run shellcheck on all scripts | ||
| @echo "Running shellcheck..." | ||
| @if command -v shellcheck >/dev/null 2>&1; then \ | ||
| shellcheck -x --severity=error bootstrap; \ | ||
| shellcheck -x --severity=error ubuntu/bootstrap; \ | ||
| find ubuntu/ -type f -name 'install-*' -exec shellcheck -x --severity=error {} \+; \ | ||
| find generic/ -type f -exec shellcheck -x --severity=error {} \+; \ | ||
| else \ | ||
| echo "shellcheck not installed. Install with: sudo apt-get install shellcheck"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
|
mapitman marked this conversation as resolved.
|
||
| build-test-images: ## Build Docker test images for all Ubuntu versions | ||
| @echo "Building test images for Ubuntu versions: $(UBUNTU_VERSIONS)" | ||
| @for version in $(UBUNTU_VERSIONS); do \ | ||
| echo "Building Ubuntu $$version..."; \ | ||
| docker build \ | ||
| --build-arg UBUNTU_VERSION=$$version \ | ||
| -f test/docker/Dockerfile.ubuntu-noninteractive \ | ||
| -t ubuntu-bootstrap-test:$$version \ | ||
| .; \ | ||
| done | ||
|
|
||
| clean: docker-clean ## Clean up all test artifacts | ||
|
|
||
| docker-clean: ## Remove all test Docker images | ||
| @echo "Cleaning up Docker test images..." | ||
| @docker images | grep ubuntu-bootstrap-test | awk '{print $$3}' | xargs -r docker rmi || true | ||
| @echo "Cleanup complete" | ||
|
|
||
| ci: test-syntax test-all ## Run full CI test suite (syntax + all versions) | ||
|
|
||
| quick: test-syntax test-auto ## Quick check: syntax + single version test | ||
|
mapitman marked this conversation as resolved.
|
||
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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 |
|---|---|---|
| @@ -1,7 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # source <(curl -fsSL https://raw.githubusercontent.com/mapitman/linux-bootstrap/main/generic/auto-cpufreq) | ||
|
|
||
| mkdir -p ~/src/github/AdnanHodzic | ||
| git clone git@github.com:AdnanHodzic/auto-cpufreq.git ~/src/github/AdnanHodzic/auto-cpufreq | ||
| cd ~/src/github/AdnanHodzic/auto-cpufreq && sudo ./auto-cpufreq-installer && cd - | ||
| set -e | ||
|
|
||
| VERSION="2.2.2" | ||
| ARCHIVE="auto-cpufreq-$VERSION.tar.gz" | ||
| URL="https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v$VERSION.tar.gz" | ||
| SHA256="f2ef89e4b6855e7d2e2c3f7f4f7d0a9d557e6d91d6945f9b2c6e3b4b9e1e3c56" | ||
|
|
||
| WORKDIR="$HOME/src/github/AdnanHodzic" | ||
| mkdir -p "$WORKDIR" | ||
| cd "$WORKDIR" | ||
|
|
||
| curl -fsSLo "$ARCHIVE" "$URL" | ||
| echo "$SHA256 $ARCHIVE" | sha256sum -c - | ||
| tar -xzf "$ARCHIVE" | ||
| cd "auto-cpufreq-$VERSION" | ||
|
|
||
| # Run installer from pinned, verified source | ||
|
mapitman marked this conversation as resolved.
Outdated
|
||
| sudo ./auto-cpufreq-installer | ||
| sudo auto-cpufreq --install | ||
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
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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.