Skip to content

Commit 9fea056

Browse files
authored
Merge pull request #2 from gfx/example
Implement examples
2 parents 06e6c58 + 343f7a3 commit 9fea056

File tree

11 files changed

+1192
-1950
lines changed

11 files changed

+1192
-1950
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/* binary
2+

.github/workflows/ci.yaml

Lines changed: 3 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
branches: [main]
88

9+
permissions:
10+
contents: read
911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
@@ -15,7 +17,7 @@ jobs:
1517
uses: actions/checkout@v5
1618

1719
- name: Setup Node.js
18-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v5
1921
with:
2022
node-version: '24'
2123
cache: 'npm'
@@ -34,154 +36,3 @@ jobs:
3436

3537
- name: Package action
3638
run: npm run package
37-
38-
test-action:
39-
runs-on: ubuntu-latest
40-
41-
services:
42-
postgres:
43-
image: postgres:17
44-
env:
45-
POSTGRES_USER: postgres
46-
POSTGRES_PASSWORD: postgres
47-
POSTGRES_DB: testdb
48-
options: >-
49-
--health-cmd pg_isready
50-
--health-interval 10s
51-
--health-timeout 5s
52-
--health-retries 5
53-
ports:
54-
- 5432:5432
55-
56-
steps:
57-
- name: Checkout code
58-
uses: actions/checkout@v5
59-
60-
- name: Create test schema file
61-
run: |
62-
cat > schema.sql <<EOF
63-
CREATE TABLE IF NOT EXISTS users (
64-
id SERIAL PRIMARY KEY,
65-
username VARCHAR(50) UNIQUE NOT NULL,
66-
email VARCHAR(100) UNIQUE NOT NULL,
67-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
68-
);
69-
70-
CREATE TABLE IF NOT EXISTS posts (
71-
id SERIAL PRIMARY KEY,
72-
user_id INTEGER REFERENCES users(id),
73-
title VARCHAR(200) NOT NULL,
74-
content TEXT,
75-
published_at TIMESTAMP,
76-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
77-
);
78-
79-
CREATE INDEX IF NOT EXISTS idx_posts_user_id ON posts(user_id);
80-
CREATE INDEX IF NOT EXISTS idx_posts_published_at ON posts(published_at);
81-
EOF
82-
83-
- name: Test PostgreSQL action (dry-run)
84-
uses: ./
85-
with:
86-
command: psqldef
87-
version: latest
88-
schema-file: schema.sql
89-
pg-user: postgres
90-
pg-password: postgres
91-
pg-host: localhost
92-
pg-port: 5432
93-
pg-database: testdb
94-
95-
test-mysql:
96-
runs-on: ubuntu-latest
97-
98-
services:
99-
mysql:
100-
image: mysql:8.0
101-
env:
102-
MYSQL_ROOT_PASSWORD: root
103-
MYSQL_DATABASE: testdb
104-
options: >-
105-
--health-cmd="mysqladmin ping"
106-
--health-interval=10s
107-
--health-timeout=5s
108-
--health-retries=5
109-
ports:
110-
- 3306:3306
111-
112-
steps:
113-
- name: Checkout code
114-
uses: actions/checkout@v5
115-
116-
- name: Create MySQL test schema file
117-
run: |
118-
cat > schema.sql <<EOF
119-
CREATE TABLE IF NOT EXISTS users (
120-
id INT AUTO_INCREMENT PRIMARY KEY,
121-
username VARCHAR(50) UNIQUE NOT NULL,
122-
email VARCHAR(100) UNIQUE NOT NULL,
123-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
124-
);
125-
126-
CREATE TABLE IF NOT EXISTS posts (
127-
id INT AUTO_INCREMENT PRIMARY KEY,
128-
user_id INT,
129-
title VARCHAR(200) NOT NULL,
130-
content TEXT,
131-
published_at TIMESTAMP NULL,
132-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
133-
FOREIGN KEY (user_id) REFERENCES users(id),
134-
INDEX idx_posts_user_id (user_id),
135-
INDEX idx_posts_published_at (published_at)
136-
);
137-
EOF
138-
139-
- name: Test MySQL action
140-
uses: ./
141-
with:
142-
command: mysqldef
143-
version: latest
144-
schema-file: schema.sql
145-
mysql-user: root
146-
mysql-password: root
147-
mysql-host: 127.0.0.1
148-
mysql-port: 3306
149-
mysql-database: testdb
150-
151-
test-sqlite:
152-
runs-on: ubuntu-latest
153-
154-
steps:
155-
- name: Checkout code
156-
uses: actions/checkout@v5
157-
158-
- name: Create SQLite test schema file
159-
run: |
160-
cat > schema.sql <<EOF
161-
CREATE TABLE IF NOT EXISTS users (
162-
id INTEGER PRIMARY KEY AUTOINCREMENT,
163-
username TEXT UNIQUE NOT NULL,
164-
email TEXT UNIQUE NOT NULL,
165-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
166-
);
167-
168-
CREATE TABLE IF NOT EXISTS posts (
169-
id INTEGER PRIMARY KEY AUTOINCREMENT,
170-
user_id INTEGER REFERENCES users(id),
171-
title TEXT NOT NULL,
172-
content TEXT,
173-
published_at TIMESTAMP,
174-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
175-
);
176-
177-
CREATE INDEX IF NOT EXISTS idx_posts_user_id ON posts(user_id);
178-
CREATE INDEX IF NOT EXISTS idx_posts_published_at ON posts(published_at);
179-
EOF
180-
181-
- name: Test SQLite action
182-
uses: ./
183-
with:
184-
command: sqlite3def
185-
version: latest
186-
schema-file: schema.sql
187-
sqlite-database: test.db

0 commit comments

Comments
 (0)