diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a849090 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + pull_request: + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install shellcheck + run: sudo apt-get update && sudo apt-get install -y shellcheck + - name: Run shellcheck on shell scripts + run: | + files=$(git ls-files '*.sh' || true) + if [ -z "$files" ]; then + echo "No shell scripts to check" + exit 0 + fi + echo "$files" + shellcheck $files + + syntax: + name: Syntax & EOL checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Fail on CRLF in scripts + run: | + CRLF_FILES=$(git ls-files '*.sh' | xargs -r grep -Il $'\r' || true) + if [ -n "$CRLF_FILES" ]; then + echo "CRLF found in the following files:"; echo "$CRLF_FILES"; + exit 1 + fi + echo "No CRLF in shell scripts" + - name: Bash syntax-check + run: | + for f in $(git ls-files '*.sh'); do + echo "Checking $f"; + bash -n "$f"; + done + + preview-runner: + name: Preview installer scripts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Bash syntax-check run_installers + run: bash -n run_installers.sh + - name: Preview run_installers (safe) + run: ./run_installers.sh --preview + + windows-preview: + name: PowerShell preview + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Preview PowerShell wrapper + shell: pwsh + run: | + ./run_installers.ps1 -Preview