-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (134 loc) · 4.25 KB
/
ci.yml
File metadata and controls
156 lines (134 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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