CI: switch postgres service image to timescale/timescaledb-ha:pg17-all which bundles PostGIS, fixing the lidar migration failure in PR and production workflows. Tests: ~30 new test files / extensions, ~600+ new tests, taking total coverage from 70.42% to 73.4%. Targets included GraphQL resolver unauthenticated paths, SNMP context queries (mempools, processors, ip_addresses, neighbors, wireless_clients, arp_entries), worker routing/lifecycle (alert notification, alert digest, weather sync, job cleanup, cn_maestro, uisp, mikrotik backup, report worker), SNMP monitoring executors (storage, interface, processor) end-to-end via stub adapter, NetBox + Sonar sync integration paths, ConfigChanges listing and correlator, organizations membership query, and live-view smoke tests for org-scoped settings, integrations, maintenance, agent, device deep paths, schedules. Property tests used for query composition and pure helpers where natural.
105 lines
3 KiB
YAML
105 lines
3 KiB
YAML
name: Pull Request Tests
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches:
|
|
- main
|
|
- production
|
|
|
|
concurrency:
|
|
group: pr-tests-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
MIX_ENV: test
|
|
|
|
jobs:
|
|
test-exunit:
|
|
name: Run ExUnit Tests
|
|
runs-on: ubuntu-22.04
|
|
# Skip if PR is already merged
|
|
if: github.event.pull_request.merged == false
|
|
env:
|
|
DATABASE_URL: ecto://postgres:postgres@postgres/towerops_test
|
|
|
|
services:
|
|
postgres:
|
|
image: timescale/timescaledb-ha:pg17-all
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: towerops_test
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Set up Elixir
|
|
uses: https://github.com/erlef/setup-beam@v1
|
|
with:
|
|
version-type: strict
|
|
elixir-version: '1.18.1'
|
|
otp-version: '27.2'
|
|
|
|
- name: Cache Mix
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: ~/.mix
|
|
key: ${{ runner.os }}-mix-1.18.1-27.2
|
|
restore-keys: ${{ runner.os }}-mix-
|
|
|
|
- name: Cache deps
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: deps
|
|
key: ${{ runner.os }}-deps-${{ hashFiles('mix.lock') }}
|
|
restore-keys: ${{ runner.os }}-deps-
|
|
|
|
- name: Cache _build
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: _build
|
|
key: ${{ runner.os }}-build-v3-${{ hashFiles('lib/**/*.ex') }}-${{ hashFiles('mix.lock') }}
|
|
restore-keys: ${{ runner.os }}-build-v3-
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
. /etc/os-release
|
|
if [ "$ID" = "debian" ]; then
|
|
if [ -f /etc/apt/sources.list ] && grep -q "^deb " /etc/apt/sources.list; then
|
|
sed -i 's/ main$/ main contrib non-free non-free-firmware/' /etc/apt/sources.list
|
|
fi
|
|
for f in /etc/apt/sources.list.d/*.sources; do
|
|
[ -f "$f" ] || continue
|
|
sed -i 's/^Components: main$/Components: main contrib non-free non-free-firmware/' "$f"
|
|
done
|
|
fi
|
|
apt-get update
|
|
apt-get install -y libssl-dev libsnmp-dev snmp-mibs-downloader postgresql-client
|
|
|
|
- name: Install dependencies
|
|
run: mix deps.get
|
|
|
|
- name: Compile C NIF
|
|
run: make -C c_src
|
|
|
|
- name: Compile (warnings as errors)
|
|
run: mix compile --warnings-as-errors
|
|
|
|
- name: Run tests
|
|
run: mix test
|
|
|
|
- name: Test summary
|
|
if: always()
|
|
run: |
|
|
if [ ${{ job.status }} == 'success' ]; then
|
|
echo "### ✅ All tests passed" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "### ❌ Tests failed" >> $GITHUB_STEP_SUMMARY
|
|
fi
|