Skip to content

Commit bf55eca

Browse files
committed
feat: complete type coverage and enhance CI PostgreSQL setup
- Add @SPEC annotations to all remaining private functions for 100% type coverage - orchestrator/config.ex: get_htdag_config, default_config, validate_* - workflow_supervisor.ex: ensure_registry_started, default_workflow_name, resolve_repo, repo_from_app - orchestrator/repository.ex: maybe_filter_by_workflow, maybe_filter_by_date_range - orchestrator.ex: build_task_graph, calculate_task_depths, convert_tasks_to_steps, generate_goal_id - Fix unused variable warnings (prefix with _) - Remove duplicate @SPEC annotations - Enhance CI workflows with PostgreSQL setup: - Create main CI workflow (ci.yml) with PostgreSQL 17 + pgmq - Add pgmq extension verification to all workflows - Ensure proper database setup and health checks - Achieve zero compilation warnings and errors - 100% type coverage across all modules
1 parent e18a21c commit bf55eca

35 files changed

Lines changed: 3421 additions & 465 deletions

.github/workflows/ci.yml

Lines changed: 78 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
name: "Copilot Setup Steps"
1+
name: CI
22

3-
# Automatically run the setup steps when they are changed to allow for easy validation, and
4-
# allow manual testing through the repository's "Actions" tab
53
on:
6-
workflow_dispatch:
74
push:
8-
paths:
9-
- .github/workflows/copilot-setup-steps.yml
5+
branches: [main, develop]
106
pull_request:
11-
paths:
12-
- .github/workflows/copilot-setup-steps.yml
7+
branches: [main, develop]
8+
workflow_dispatch:
139

1410
jobs:
15-
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16-
copilot-setup-steps:
11+
test:
12+
name: Test Suite
1713
runs-on: ubuntu-latest
1814

19-
# Set the permissions to the lowest permissions possible needed for your steps.
20-
# Copilot will be given its own token for its operations.
21-
permissions:
22-
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
23-
contents: read
24-
2515
services:
2616
postgres:
2717
# Use official pgmq image with PostgreSQL 17 and pgmq pre-installed
@@ -39,8 +29,6 @@ jobs:
3929
ports:
4030
- 5432:5432
4131

42-
# You can define any steps you want, and they will run before the agent starts.
43-
# If you do not check out your code, Copilot will do this for you.
4432
steps:
4533
- name: Checkout code
4634
uses: actions/checkout@v4
@@ -51,24 +39,37 @@ jobs:
5139
elixir-version: '1.19'
5240
otp-version: '28'
5341

54-
- name: Restore Elixir dependencies cache
42+
- name: Cache Mix dependencies
5543
uses: actions/cache@v4
5644
with:
5745
path: deps
58-
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
59-
restore-keys: ${{ runner.os }}-mix-
46+
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-mix-deps-
6049
61-
- name: Install Elixir dependencies
50+
- name: Install dependencies
6251
run: mix deps.get
6352

64-
- name: Wait for PostgreSQL and create test database
53+
- name: Compile
54+
run: mix compile --warnings-as-errors
55+
56+
- name: Wait for PostgreSQL
57+
run: |
58+
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do echo "Waiting for PostgreSQL..."; sleep 1; done'
59+
env:
60+
PGPASSWORD: postgres
61+
62+
- name: Create test database
6563
run: |
66-
# Wait for PostgreSQL to be ready
67-
timeout 30 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do echo "Waiting for postgres..."; sleep 1; done'
68-
sleep 1
64+
psql -h localhost -p 5432 -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'singularity_workflow_test'" | grep -q 1 || \
65+
psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE singularity_workflow_test;"
66+
env:
67+
PGPASSWORD: postgres
6968

70-
# Create test database idempotently
71-
psql -h localhost -p 5432 -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'singularity_workflow_test'" | grep -q 1 || psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE singularity_workflow_test;"
69+
- name: Verify pgmq extension
70+
run: |
71+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
72+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'pgmq';"
7273
env:
7374
PGPASSWORD: postgres
7475

@@ -77,3 +78,52 @@ jobs:
7778
env:
7879
MIX_ENV: test
7980
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/singularity_workflow_test"
81+
82+
- name: Run tests
83+
run: mix test
84+
env:
85+
MIX_ENV: test
86+
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/singularity_workflow_test"
87+
88+
quality:
89+
name: Code Quality
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v4
95+
96+
- name: Set up Elixir
97+
uses: erlef/setup-beam@v1
98+
with:
99+
elixir-version: '1.19'
100+
otp-version: '28'
101+
102+
- name: Cache Mix dependencies
103+
uses: actions/cache@v4
104+
with:
105+
path: deps
106+
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
107+
restore-keys: |
108+
${{ runner.os }}-mix-deps-
109+
110+
- name: Install dependencies
111+
run: mix deps.get
112+
113+
- name: Compile
114+
run: mix compile --warnings-as-errors
115+
116+
- name: Check formatting
117+
run: mix format --check-formatted
118+
119+
- name: Run Credo
120+
run: mix credo --strict
121+
122+
- name: Run Dialyzer
123+
run: mix dialyzer --format github
124+
125+
- name: Run Sobelow
126+
run: mix sobelow --exit-on-warning --skip
127+
128+
- name: Audit dependencies
129+
run: mix deps.audit

.github/workflows/comprehensive-ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ jobs:
8989
env:
9090
PGPASSWORD: postgres
9191

92+
- name: Verify pgmq extension
93+
run: |
94+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
95+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'pgmq';"
96+
env:
97+
PGPASSWORD: postgres
98+
9299
- name: Run migrations
93100
run: mix ecto.migrate
94101
env:

.github/workflows/copilot-setup-steps.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ jobs:
9797
env:
9898
PGPASSWORD: postgres
9999

100+
- name: Verify pgmq extension
101+
run: |
102+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
103+
psql -h localhost -p 5432 -U postgres -d singularity_workflow_test -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'pgmq';"
104+
env:
105+
PGPASSWORD: postgres
106+
100107
- name: Run migrations
101108
run: |
102109
export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/singularity_workflow_test"

0 commit comments

Comments
 (0)