Skip to content

Commit cc25b4f

Browse files
authored
Merge pull request #3 from 0xdps/develop
merge develop to trunk
2 parents d483b78 + 144baa9 commit cc25b4f

23 files changed

+2898
-43
lines changed

.github/workflows/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Test Database Workflows
2+
3+
## Centralized Test Schema
4+
5+
The database integration tests use a centralized schema to ensure consistency across all supported databases.
6+
7+
### Schema File
8+
9+
**`test-schema.json`** - Contains the complete test schema with:
10+
- **84 columns** covering all generator types
11+
- **83 generator fields** (excluding auto-increment ID)
12+
- All categories: Personal, Location, Network, Financial, Time, Localization, Product, Files, Media, Animals, Food, Vehicles, Identifiers, Text, and App data
13+
14+
### How It Works
15+
16+
Each database test job:
17+
1. Merges the centralized schema with database-specific configuration using `jq`
18+
2. Validates that exactly 83 generator fields are present
19+
3. Creates and populates the test table
20+
4. Verifies the row count
21+
22+
### Benefits
23+
24+
**Single Source of Truth** - All generator fields defined once
25+
**Consistency** - Same tests across all 6 databases
26+
**Easy Updates** - Add new generators in one place
27+
**Validation** - Automatic field count verification
28+
**Reduced Duplication** - 71 lines vs 569 lines per database
29+
30+
### Supported Databases
31+
32+
1. **MySQL** 8.0
33+
2. **MariaDB** 10.11
34+
3. **PostgreSQL** 14
35+
4. **SQLite** 3.x
36+
5. **MS SQL Server** 2022
37+
6. **CockroachDB** Latest
38+
39+
### Adding New Generators
40+
41+
To add a new generator to all database tests:
42+
43+
1. Add the column to `test-schema.json` in the `tables[0].columns` array
44+
2. Add the generator field to `test-schema.json` in the `populate[0].fields` array
45+
3. Update the field count validation in `test-databases.yml` (increment the `83` in all 6 tests)
46+
47+
Example:
48+
```json
49+
// In tables[0].columns:
50+
{"name": "new_field", "type": {"name": "string", "args": {"length": 50}}}
51+
52+
// In populate[0].fields:
53+
{"name": "new_field", "generator": "new_generator"}
54+
```
55+
56+
### Schema Validation
57+
58+
Each test automatically validates:
59+
```bash
60+
FIELD_COUNT=$(jq '.populate[0].fields | length' test-schema.json)
61+
[ "$FIELD_COUNT" -eq 83 ] || (echo "❌ Expected 83 fields, got $FIELD_COUNT" && exit 1)
62+
```
63+
64+
This ensures no fields are accidentally omitted during schema merging.

.github/workflows/publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ jobs:
5151
if [ "${{ github.event_name }}" = "push" ]; then
5252
REF="${{ github.ref }}"
5353
TAG_VERSION="${REF#refs/tags/}"
54-
else
54+
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
5555
TAG_VERSION="${{ inputs.tag }}"
56+
else
57+
echo "❌ Unexpected event type: ${{ github.event_name }}"
58+
exit 1
5659
fi
5760
5861
VERSION=$(echo "$TAG_VERSION" | sed 's/^v//')
@@ -408,7 +411,8 @@ jobs:
408411
409412
### Homebrew (macOS/Linux)
410413
```bash
411-
brew install 0xdps/tap/fakestack
414+
brew tap 0xdps/packages
415+
brew install fakestack
412416
```
413417
414418
### Go
@@ -469,9 +473,9 @@ jobs:
469473
echo "linux_arm64=$(sha256sum binaries/fakestack-linux-arm64 | awk '{print $1}')" >> $GITHUB_OUTPUT
470474
echo "linux_amd64=$(sha256sum binaries/fakestack-linux-amd64 | awk '{print $1}')" >> $GITHUB_OUTPUT
471475
472-
- name: Clone homebrew-fakestack tap
476+
- name: Clone homebrew-packages tap
473477
run: |
474-
git clone https://github.com/0xdps/homebrew-fakestack.git tap
478+
git clone https://github.com/0xdps/homebrew-packages.git tap
475479
476480
- name: Update Homebrew formula
477481
run: |
@@ -494,11 +498,11 @@ jobs:
494498
495499
cat tap/Formula/fakestack.rb
496500
497-
- name: Push to homebrew-fakestack tap
501+
- name: Push to homebrew-packages tap
498502
working-directory: tap
499503
run: |
500504
git config user.name "github-actions[bot]"
501505
git config user.email "github-actions[bot]@users.noreply.github.com"
502506
git add Formula/fakestack.rb
503507
git commit -m "chore: update formula to ${GITHUB_REF#refs/tags/}"
504-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/0xdps/homebrew-fakestack.git main || echo "⚠️ Formula update failed, manual update needed"
508+
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/0xdps/homebrew-packages.git trunk || echo "⚠️ Formula update failed, manual update needed"

.github/workflows/test-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Build & Test
33
on:
44
push:
55
branches: [ trunk, develop ]
6+
tags:
7+
- 'v*'
68
paths-ignore:
79
- '**.md'
810
- 'docs/**'

0 commit comments

Comments
 (0)