Skip to content

Enhance dashboard export and import scripts with improved error handl… #46

Enhance dashboard export and import scripts with improved error handl…

Enhance dashboard export and import scripts with improved error handl… #46

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: 'bin'
format: gcc
severity: error
formatting:
name: Code Formatting Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install shfmt
run: |
wget -q -O shfmt https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64
chmod +x shfmt
sudo mv shfmt /usr/local/bin/
- name: Check bash formatting with shfmt
run: |
echo "Checking bash code formatting..."
find bin -name "*.sh" -type f -exec shfmt -d -i 1 -sr -bn {} \;
- name: Install SQLFluff
run: |
sudo apt-get update
sudo apt-get install -y sqlfluff || pip3 install sqlfluff
- name: Check SQL formatting
continue-on-error: true
run: |
if command -v sqlfluff &> /dev/null; then
find sql -name "*.sql" -type f -exec sqlfluff lint {} \; || echo "SQL formatting issues found (non-blocking)"
fi
- name: Setup Node.js for Prettier
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Prettier
run: npm install -g prettier
- name: Check formatting with Prettier
continue-on-error: true
run: |
prettier --check "**/*.{md,json,yaml,yml,css,html}" --ignore-path .prettierignore 2>/dev/null || echo "Prettier formatting issues found (non-blocking)"
test:
name: Run Tests
runs-on: ubuntu-latest
needs: [shellcheck, formatting]
timeout-minutes: 50
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: osm_notes_monitoring_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Bash
run: |
bash --version
echo "Bash is ready"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y bc
git clone https://github.com/bats-core/bats-core.git /tmp/bats
sudo /tmp/bats/install.sh /usr/local
- name: Set up test database
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: osm_notes_monitoring_test
run: |
psql -d osm_notes_monitoring_test -f sql/init.sql
- name: Run unit tests
timeout-minutes: 40
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: osm_notes_monitoring_test
DBHOST: localhost
DBPORT: 5432
DBUSER: postgres
DBPASSWORD: postgres
DBNAME: osm_notes_monitoring_test
run: |
if [ -f tests/run_unit_tests.sh ]; then
timeout 2400 ./tests/run_unit_tests.sh || { echo "Unit tests timed out or failed"; exit 1; }
else
echo "Unit tests not yet implemented"
fi
- name: Run integration tests
timeout-minutes: 10
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: osm_notes_monitoring_test
run: |
if [ -f tests/run_integration_tests.sh ]; then
timeout 600 ./tests/run_integration_tests.sh || { echo "Integration tests timed out or failed"; exit 1; }
else
echo "Integration tests not yet implemented"
fi
documentation:
name: Check Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check markdown files
run: |
# Check for broken links (if markdown-link-check is available)
echo "Documentation check placeholder"
# Add markdown linting if needed