feat: auto-install VS Code on Ubuntu for spill-proof setup (#1437) #610
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
| name: Test General Dotfiles Setup (Pre-OS Installation) | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '**/*.sh' | |
| - '.github/workflows/*.yml' | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install shellcheck | |
| run: sudo apt-get install -y shellcheck | |
| - name: Run shellcheck setup.sh | |
| run: shellcheck -x setup.sh | |
| test-ubuntu: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Make script executable | |
| run: chmod +x setup.sh | |
| - name: Validate setup script | |
| run: | | |
| # Create a modified version of the script for testing | |
| cp setup.sh setup-test.sh | |
| # Modify the script to avoid actual installations and system changes | |
| sed -i 's/sudo apt/echo "Would run apt:"/g' setup-test.sh | |
| sed -i 's/sudo pacman/echo "Would run pacman:"/g' setup-test.sh | |
| sed -i 's/sudo dnf/echo "Would run dnf:"/g' setup-test.sh | |
| sed -i 's/brew install/echo "Would brew install:"/g' setup-test.sh | |
| # Mock the GitHub CLI token retrieval | |
| sed -i 's/GITHUB_TOKEN=$(gh auth token)/GITHUB_TOKEN="mock-github-token"/g' setup-test.sh | |
| # Run the modified script by sourcing it as required and capture output | |
| echo "Running setup script test..." | |
| if source setup-test.sh 2>&1 | tee setup-output.log; then | |
| echo "✅ Setup script ran without fatal errors" | |
| else | |
| echo "❌ Setup script encountered fatal errors" | |
| cat setup-output.log | |
| exit 1 | |
| fi | |
| # Check if the success message appears in the output | |
| if grep -q "Dotfiles setup complete" setup-output.log; then | |
| echo "✅ Setup script validation passed - found success message" | |
| else | |
| echo "⚠️ Setup script completed but success message not found (this may be expected in test environment)" | |
| echo "Script output:" | |
| cat setup-output.log | |
| fi | |
| test-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Make script executable | |
| run: chmod +x setup.sh | |
| - name: Validate setup script | |
| run: | | |
| # Create a modified version of the script for testing | |
| cp setup.sh setup-test.sh | |
| # Modify the script to avoid actual installations and system changes | |
| sed -i '' 's/sudo apt/echo "Would run apt:"/g' setup-test.sh | |
| sed -i '' 's/sudo pacman/echo "Would run pacman:"/g' setup-test.sh | |
| sed -i '' 's/sudo dnf/echo "Would run dnf:"/g' setup-test.sh | |
| sed -i '' 's/brew install/echo "Would brew install:"/g' setup-test.sh | |
| # Mock the GitHub CLI token retrieval | |
| sed -i '' 's/GITHUB_TOKEN=$(gh auth token)/GITHUB_TOKEN="mock-github-token"/g' setup-test.sh | |
| # Run the modified script by sourcing it as required and capture output | |
| echo "Running setup script test..." | |
| if source setup-test.sh 2>&1 | tee setup-output.log; then | |
| echo "✅ Setup script ran without fatal errors" | |
| else | |
| echo "❌ Setup script encountered fatal errors" | |
| cat setup-output.log | |
| exit 1 | |
| fi | |
| # Check if the success message appears in the output | |
| if grep -q "Dotfiles setup complete" setup-output.log; then | |
| echo "✅ Setup script validation passed - found success message" | |
| else | |
| echo "⚠️ Setup script completed but success message not found (this may be expected in test environment)" | |
| echo "Script output:" | |
| cat setup-output.log | |
| fi |