Skip to content

Commit f21f1c2

Browse files
committed
add workflow files
1 parent 8d34e96 commit f21f1c2

File tree

2 files changed

+45
-42
lines changed

2 files changed

+45
-42
lines changed

.github/workflows/check-migrations-generated.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
if: steps.check_models.outputs.models_changed == 'true'
5454
run: |
5555
# Check if migration files changed in this PR
56-
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "taco/internal/query/migration/atlas/migrations/"; then
56+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "taco/migrations/"; then
5757
echo "migrations_changed=true" >> $GITHUB_OUTPUT
5858
echo "✅ Migration files were updated"
5959
else
@@ -72,7 +72,7 @@ jobs:
7272
if: steps.check_models.outputs.models_changed == 'true'
7373
working-directory: taco
7474
run: |
75-
if ! git diff --exit-code internal/query/migration/atlas/migrations/; then
75+
if ! git diff --exit-code migrations/; then
7676
echo ""
7777
echo "❌ ERROR: Model changes detected but migrations were not generated!"
7878
echo ""

.github/workflows/test-migrations.yml

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,22 @@ jobs:
5656
curl -sSf https://atlasgo.sh | sh
5757
atlas version
5858
59-
- name: Download Atlas binary for embedding
59+
- name: Apply migrations manually (simulating entrypoint.sh)
6060
working-directory: taco
61+
env:
62+
POSTGRES_URL: postgres://postgres:postgres@localhost:5432/opentaco_test?sslmode=disable
6163
run: |
62-
make atlas-download-binary
64+
echo "Applying PostgreSQL migrations..."
65+
atlas migrate apply \
66+
--url "$POSTGRES_URL" \
67+
--dir "file://migrations/postgres"
6368
64-
- name: Build statesman binary (with embedded Atlas)
69+
- name: Build statesman binary
6570
working-directory: taco
6671
run: |
6772
go build -o statesman ./cmd/statesman
6873
69-
- name: Test migrations with binary
74+
- name: Test statesman starts successfully
7075
working-directory: taco
7176
env:
7277
OPENTACO_BACKEND: postgres
@@ -79,29 +84,24 @@ jobs:
7984
OPENTACO_AUTH_DISABLE: true
8085
OPENTACO_JWT_SECRET: test-secret-key-for-ci
8186
run: |
82-
# Check Atlas is available
83-
echo "Checking for Atlas CLI..."
84-
which atlas || echo "Atlas not in PATH!"
85-
atlas version || echo "Atlas command failed!"
86-
8787
# Run binary and capture output
8888
echo "Starting statesman binary..."
8989
timeout 30s ./statesman --port 8080 --auth-disable --storage memory > statesman.log 2>&1 || true
9090
9191
echo "Binary output:"
9292
cat statesman.log
9393
94-
# Give it time to apply migrations
94+
# Give it time to start
9595
sleep 5
9696
97-
- name: Verify migrations applied
97+
- name: Verify statesman started successfully
9898
working-directory: taco
9999
run: |
100-
# Check if migrations applied successfully from binary output
101-
if grep -i "migrations applied successfully\|migrations already up to date" statesman.log; then
102-
echo "✅ Postgres migrations verified from binary output"
100+
# Check if statesman started successfully
101+
if grep -i "server listening\|starting.*server" statesman.log; then
102+
echo "✅ Postgres: Statesman started successfully after migrations"
103103
else
104-
echo "❌ Migration success message not found in binary output"
104+
echo "❌ Statesman did not start successfully"
105105
cat statesman.log
106106
exit 1
107107
fi
@@ -143,17 +143,22 @@ jobs:
143143
curl -sSf https://atlasgo.sh | sh
144144
atlas version
145145
146-
- name: Download Atlas binary for embedding
146+
- name: Apply migrations manually (simulating entrypoint.sh)
147147
working-directory: taco
148+
env:
149+
MYSQL_URL: mysql://mysql:mysql@localhost:3306/opentaco_test
148150
run: |
149-
make atlas-download-binary
151+
echo "Applying MySQL migrations..."
152+
atlas migrate apply \
153+
--url "$MYSQL_URL" \
154+
--dir "file://migrations/mysql"
150155
151-
- name: Build statesman binary (with embedded Atlas)
156+
- name: Build statesman binary
152157
working-directory: taco
153158
run: |
154159
go build -o statesman ./cmd/statesman
155160
156-
- name: Test migrations with binary
161+
- name: Test statesman starts successfully
157162
working-directory: taco
158163
env:
159164
OPENTACO_BACKEND: mysql
@@ -165,29 +170,24 @@ jobs:
165170
OPENTACO_AUTH_DISABLE: true
166171
OPENTACO_JWT_SECRET: test-secret-key-for-ci
167172
run: |
168-
# Check Atlas is available
169-
echo "Checking for Atlas CLI..."
170-
which atlas || echo "Atlas not in PATH!"
171-
atlas version || echo "Atlas command failed!"
172-
173173
# Run binary and capture output
174174
echo "Starting statesman binary..."
175175
timeout 30s ./statesman --port 8080 --auth-disable --storage memory > statesman.log 2>&1 || true
176176
177177
echo "Binary output:"
178178
cat statesman.log
179179
180-
# Give it time to apply migrations
180+
# Give it time to start
181181
sleep 5
182182
183-
- name: Verify migrations applied
183+
- name: Verify statesman started successfully
184184
working-directory: taco
185185
run: |
186-
# Check if migrations applied successfully from binary output
187-
if grep -i "migrations applied successfully\|migrations already up to date" statesman.log; then
188-
echo "✅ MySQL migrations verified from binary output"
186+
# Check if statesman started successfully
187+
if grep -i "server listening\|starting.*server" statesman.log; then
188+
echo "✅ MySQL: Statesman started successfully after migrations"
189189
else
190-
echo "❌ Migration success message not found in binary output"
190+
echo "❌ Statesman did not start successfully"
191191
cat statesman.log
192192
exit 1
193193
fi
@@ -213,17 +213,20 @@ jobs:
213213
curl -sSf https://atlasgo.sh | sh
214214
atlas version
215215
216-
- name: Download Atlas binary for embedding
216+
- name: Apply migrations manually (simulating entrypoint.sh)
217217
working-directory: taco
218218
run: |
219-
make atlas-download-binary
219+
echo "Applying SQLite migrations..."
220+
atlas migrate apply \
221+
--url "sqlite://test.db" \
222+
--dir "file://migrations/sqlite"
220223
221-
- name: Build statesman binary (with embedded Atlas)
224+
- name: Build statesman binary
222225
working-directory: taco
223226
run: |
224227
go build -o statesman ./cmd/statesman
225228
226-
- name: Test migrations with binary
229+
- name: Test statesman starts successfully
227230
working-directory: taco
228231
env:
229232
OPENTACO_BACKEND: sqlite
@@ -238,17 +241,17 @@ jobs:
238241
echo "Binary output:"
239242
cat statesman.log
240243
241-
# Give it time to apply migrations
244+
# Give it time to start
242245
sleep 5
243246
244-
- name: Verify migrations applied
247+
- name: Verify statesman started successfully
245248
working-directory: taco
246249
run: |
247-
# Check if migrations applied successfully from binary output
248-
if grep -i "migrations applied successfully\|migrations already up to date" statesman.log; then
249-
echo "✅ SQLite migrations verified from binary output"
250+
# Check if statesman started successfully
251+
if grep -i "server listening\|starting.*server" statesman.log; then
252+
echo "✅ SQLite: Statesman started successfully after migrations"
250253
else
251-
echo "❌ Migration success message not found in binary output"
254+
echo "❌ Statesman did not start successfully"
252255
cat statesman.log
253256
exit 1
254257
fi

0 commit comments

Comments
 (0)