ci: stabilize pipeline with PHP matrix, shellcheck, hadolint, and YAML/JSON/compose lint
This commit is contained in:
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master, main ]
|
branches: [ master, main ]
|
||||||
@@ -17,16 +18,21 @@ jobs:
|
|||||||
php: ['8.1', '8.2', '8.3']
|
php: ['8.1', '8.2', '8.3']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: shivammathur/setup-php@v2
|
|
||||||
|
- name: Setup PHP ${{ matrix.php }}
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
- name: Validate composer.json (if present)
|
- name: Validate composer.json (if present)
|
||||||
run: |
|
run: |
|
||||||
if [ -f composer.json ]; then composer validate --no-check-publish; fi
|
if [ -f composer.json ]; then composer validate --no-check-publish; fi
|
||||||
|
|
||||||
- name: Composer audit (if lock present)
|
- name: Composer audit (if lock present)
|
||||||
run: |
|
run: |
|
||||||
if [ -f composer.lock ]; then composer audit || true; fi
|
if [ -f composer.lock ]; then composer audit || true; fi
|
||||||
|
|
||||||
- name: PHP syntax check
|
- name: PHP syntax check
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -41,7 +47,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: sudo apt-get update && sudo apt-get install -y shellcheck
|
|
||||||
|
- name: Install ShellCheck
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y shellcheck
|
||||||
|
|
||||||
- name: ShellCheck all scripts
|
- name: ShellCheck all scripts
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -56,31 +65,58 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint Dockerfile with hadolint
|
- name: Lint Dockerfile with hadolint
|
||||||
uses: hadolint/hadolint-action@v3.1.0
|
uses: hadolint/hadolint-action@v3.1.0
|
||||||
with:
|
with:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
# Ignore apt pinning and multiple RUNs (acceptable for Ubuntu base & readability)
|
||||||
|
ignore: DL3008,DL3059
|
||||||
|
failure-threshold: error
|
||||||
|
|
||||||
sanity:
|
sanity:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: sudo apt-get update && sudo apt-get install -y jq yamllint
|
|
||||||
|
- name: Install linters
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y jq yamllint
|
||||||
|
|
||||||
- name: Lint JSON
|
- name: Lint JSON
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
mapfile -t jsons < <(git ls-files '*.json' ':!:vendor/**')
|
mapfile -t jsons < <(git ls-files '*.json' ':!:vendor/**')
|
||||||
if [ "${#jsons[@]}" -gt 0 ]; then
|
if [ "${#jsons[@]}" -gt 0 ]; then
|
||||||
for j in "${jsons[@]}"; do jq -e . "$j" >/dev/null; done
|
for j in "${jsons[@]}"; do
|
||||||
|
echo "Checking $j"
|
||||||
|
jq -e . "$j" >/dev/null
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo "No JSON files."
|
echo "No JSON files."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Lint YAML
|
- name: Lint YAML
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
mapfile -t yamls < <(git ls-files '*.yml' '*.yaml')
|
mapfile -t yamls < <(git ls-files '*.yml' '*.yaml')
|
||||||
if [ "${#yamls[@]}" -gt 0 ]; then
|
if [ "${#yamls[@]}" -gt 0 ]; then
|
||||||
yamllint -d "{extends: default, rules: {line-length: disable}}" "${yamls[@]}"
|
# Relax line-length to avoid noisy failures for README badges, etc.
|
||||||
|
yamllint -d "{extends: default, rules: {line-length: {max: 140}}}" "${yamls[@]}"
|
||||||
else
|
else
|
||||||
echo "No YAML files."
|
echo "No YAML files."
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Validate docker-compose.yml (if present)
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
if [ -f docker-compose.yml ]; then
|
||||||
|
if docker compose version >/dev/null 2>&1; then
|
||||||
|
docker compose -f docker-compose.yml config -q
|
||||||
|
elif command -v docker-compose >/dev/null 2>&1; then
|
||||||
|
docker-compose -f docker-compose.yml config -q
|
||||||
|
else
|
||||||
|
echo "Docker Compose not available; skipping compose validation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No docker-compose.yml found."
|
||||||
fi
|
fi
|
||||||
@@ -12,7 +12,7 @@ chore: set up CI, add compose, tighten ignores, refresh README
|
|||||||
node_modules, resources/, etc. to slim build context.
|
node_modules, resources/, etc. to slim build context.
|
||||||
- .gitignore: ignore .env, editor/system files, build caches, optional data/.
|
- .gitignore: ignore .env, editor/system files, build caches, optional data/.
|
||||||
- README: update badges (CI, release, license), inline demo creds, add quick
|
- README: update badges (CI, release, license), inline demo creds, add quick
|
||||||
links, tighten WebDAV section (Windows HTTPS note + wiki link), and star
|
links, tighten WebDAV section (Windows HTTPS note + wiki link), reduced length and star
|
||||||
history chart.
|
history chart.
|
||||||
|
|
||||||
## Changes 10/7/2025 (no new version)
|
## Changes 10/7/2025 (no new version)
|
||||||
|
|||||||
Reference in New Issue
Block a user