Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/analytics-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: Docker CI


on:
push:
branches: [ main ]
pull_request:
push:
branches: [ main ]
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

steps:
- name: Build image (CI check)
run: |
docker buildx build \
--load \
-t myapp:ci \
.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Build image (CI check)
run: |
docker buildx build \
--load \
-t myapp:ci \
.
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Log in to GHCR
uses: docker/login-action@v3
Expand All @@ -37,5 +37,5 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Inspect builder
run: docker buildx inspect --bootstrap
- name: Inspect builder
run: docker buildx inspect --bootstrap
117 changes: 33 additions & 84 deletions .github/workflows/documentation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ jobs:
link-check:
name: Check Documentation Links
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install markdown-link-check
run: npm install -g markdown-link-check
Expand Down Expand Up @@ -69,105 +71,87 @@ jobs:
mkdir -p .github
if [ ! -f ".github/markdown-link-check-config.json" ]; then
cat > .github/markdown-link-check-config.json << 'EOF'
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^https://localhost"
}
],
"timeout": "10s",
"retryOn429": true,
"retryCount": 3,
"fallbackRetryDelay": "30s",
"aliveStatusCodes": [200, 206, 301, 302, 307, 308]
}
EOF
{
"ignorePatterns": [
{ "pattern": "^http://localhost" },
{ "pattern": "^https://localhost" }
],
"timeout": "10s",
"retryOn429": true,
"retryCount": 3,
"fallbackRetryDelay": "30s",
"aliveStatusCodes": [200, 206, 301, 302, 307, 308]
}
EOF
fi

structure-validation:
name: Validate Project Structure
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Verify documented directories exist
run: |
echo "Verifying project structure matches documentation..."
EXIT_CODE=0

# Expected directories
EXPECTED_DIRS="schema queries analytics validation admin scripts insights"

for dir in $EXPECTED_DIRS; do
if [ -d "$dir" ]; then
echo " $dir/ exists"
echo "checkmark $dir/ exists"
else
echo " $dir/ is missing but may be documented"
echo "X $dir/ is missing but may be documented"
EXIT_CODE=1
fi
done

exit $EXIT_CODE

- name: Check for undocumented directories
run: |
echo "Checking for directories that might need documentation..."

# Find directories not in standard ignore list
find . -maxdepth 1 -type d -not -path "./.*" -not -path "." | while read dir; do
find . -maxdepth 1 -type d -not -path "./.* " -not -path "." | while read dir; do
dir_name=$(basename "$dir")

# Check if directory is mentioned in README
if grep -q "$dir_name" README.md; then
echo " $dir_name is documented in README.md"
echo "checkmark $dir_name is documented in README.md"
else
echo " $dir_name might need documentation in README.md"
echo "warning $dir_name might need documentation in README.md"
fi
done

- name: Verify key files are documented
run: |
echo "Checking that key files are referenced in documentation..."

# Key files that should be mentioned
KEY_FILES="schema.sql kpi_dashboard.sql data_quality_checks.sql generate_data.py"

for file in $KEY_FILES; do
if find . -name "$file" -type f | grep -q .; then
if grep -r "$file" *.md; then
echo " $file is documented"
echo "checkmark $file is documented"
else
echo " $file exists but may not be documented"
echo "warning $file exists but may not be documented"
fi
fi
done

- name: Check documentation completeness
run: |
echo "Checking documentation files for completeness..."

# Check README sections
if grep -q "Installation\|Setup\|Getting Started" README.md; then
echo " README.md has setup instructions"
echo "checkmark README.md has setup instructions"
else
echo " README.md might need setup instructions"
echo "warning README.md might need setup instructions"
fi

if grep -q "Usage\|Examples\|Queries" README.md; then
echo " README.md has usage examples"
echo "checkmark README.md has usage examples"
else
echo " README.md might need usage examples"
echo "warning README.md might need usage examples"
fi

# Check ARCHITECTURE.md
if [ -f "ARCHITECTURE.md" ]; then
if grep -q "schema\|database\|structure" ARCHITECTURE.md; then
echo " ARCHITECTURE.md documents database structure"
echo "checkmark ARCHITECTURE.md documents database structure"
fi
fi

Expand All @@ -176,35 +160,9 @@ jobs:
run: |
cat > doc-validation-report.md << 'EOF'
# Documentation Validation Report

**Date**: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
**Branch**: ${{ github.ref_name }}

## Structure Validation

- README.md: $([ -f README.md ] && echo "✓ Present" || echo "❌ Missing")
- ARCHITECTURE.md: $([ -f ARCHITECTURE.md ] && echo "✓ Present" || echo "❌ Missing")
- SECURITY.md: $([ -f SECURITY.md ] && echo "✓ Present" || echo "❌ Missing")
- LICENSE: $([ -f LICENSE ] && echo "✓ Present" || echo "❌ Missing")
- insights/business_insights.md: $([ -f insights/business_insights.md ] && echo "✓ Present" || echo "⚠ Optional")

## Directory Structure

- schema/: $([ -d schema ] && echo "✓ Exists" || echo "❌ Missing")
- queries/: $([ -d queries ] && echo "✓ Exists" || echo "❌ Missing")
- analytics/: $([ -d analytics ] && echo "✓ Exists" || echo "❌ Missing")
- validation/: $([ -d validation ] && echo "✓ Exists" || echo "❌ Missing")
- admin/: $([ -d admin ] && echo "✓ Exists" || echo "❌ Missing")

## Recommendations

- Keep documentation up to date with code changes
- Ensure all directories have corresponding documentation
- Fix any broken links found in markdown files
- Document new features and queries as they are added
EOF

# Expand variables
eval "cat <<< \"$(cat doc-validation-report.md)\"" > doc-validation-final.md

- name: Upload documentation report
Expand All @@ -220,18 +178,9 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let body = '📝 **Documentation Validation**\n\n';

if (fs.existsSync('doc-validation-final.md')) {
body += fs.readFileSync('doc-validation-final.md', 'utf8');
} else {
body += 'Some documentation issues were detected. Please review the workflow logs.';
}

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
body: 'Documentation validation issues detected. Please review the workflow logs.'
});
80 changes: 45 additions & 35 deletions .github/workflows/policy-enforcement.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
name: policy-enforcement

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read
pull-requests: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Dependency vulnerability scan
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high

- name: Validate branch naming
run: |
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "Branch: $BRANCH"

if [[ ! "$BRANCH" =~ ^(main|release\/.+|feature\/.+|bugfix\/.+|hotfix\/.+)$ ]]; then
echo "❌ Invalid branch name"
exit 1
fi

- name: Verify signed commits
run: |
git log --format='%G?' origin/main..HEAD | grep -vq '^[GU]$' && {
echo "❌ Unsigned or unverified commits detected"
exit 1
} || echo "✅ All commits verified"

- name: Lint configuration files
run: |
yamllint .github

- name: CI policy summary
run: |
echo "✅ Policy enforcement passed"
jobs:
policy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Dependency vulnerability scan
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high

- name: Validate branch naming
run: |
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "Branch: $BRANCH"
if [[ ! "$BRANCH" =~ ^(main|release\/.+|feature\/.+|bugfix\/.+|hotfix\/.+)$ ]]; then
echo "Invalid branch name"
exit 1
fi

- name: Verify signed commits
run: |
git log --format='%G?' origin/main..HEAD | grep -vq '^[GU]$' && {
echo "Unsigned or unverified commits detected"
exit 1
} || echo "All commits verified"

- name: Lint configuration files
run: |
yamllint .github

- name: CI policy summary
run: |
echo "Policy enforcement passed"
Loading
Loading