Skip to content

Commit 028e99d

Browse files
committed
chore: changed CI format
1 parent f29e5bc commit 028e99d

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: checks
22

33
on:
44
pull_request:
@@ -7,9 +7,12 @@ on:
77
- backend
88

99
jobs:
10-
tests:
11-
name: Tests
12-
runs-on: ubuntu-latest
10+
build_and_check:
11+
name: Build & Checks on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
1316

1417
steps:
1518
- name: Check out code
@@ -19,25 +22,21 @@ jobs:
1922
uses: actions/setup-go@v5
2023
with:
2124
go-version: '1.24.4'
25+
cache: true
26+
27+
- name: Check formatting
28+
run: |
29+
go fmt ./...
30+
git diff --exit-code
2231
2332
- name: Run unit tests
2433
run: go test ./... -cover
2534

26-
style:
27-
name: Style
28-
runs-on: ubuntu-latest
29-
30-
steps:
31-
- name: Check out code
32-
uses: actions/checkout@v4
33-
34-
- name: Set up Go
35-
uses: actions/setup-go@v5
36-
with:
37-
go-version: '1.24.4'
35+
- name: Install gosec
36+
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
3837

39-
- name: Check formatting
40-
run: test -z $(go fmt ./...)
38+
- name: Run gosec
39+
run: gosec ./...
4140

4241
- name: Install staticcheck
4342
run: go install honnef.co/go/tools/cmd/staticcheck@latest

internal/collections/collections_test.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,35 @@ package collections_test
33
import (
44
"context"
55
"database/sql"
6-
"os"
76
"testing"
87

98
"github.com/maniac-en/req/internal/collections"
109
"github.com/maniac-en/req/internal/database"
1110
_ "github.com/mattn/go-sqlite3"
1211
)
1312

13+
const schema = `
14+
CREATE TABLE collections (
15+
id INTEGER PRIMARY KEY AUTOINCREMENT,
16+
name TEXT NOT NULL,
17+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
18+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
19+
);
20+
CREATE TABLE endpoints (
21+
id INTEGER PRIMARY KEY AUTOINCREMENT,
22+
collection_id INTEGER NOT NULL,
23+
name TEXT NOT NULL,
24+
method TEXT NOT NULL,
25+
url TEXT NOT NULL,
26+
headers TEXT DEFAULT '{}' NOT NULL,
27+
query_params TEXT DEFAULT '{}' NOT NULL,
28+
request_body TEXT DEFAULT '' NOT NULL,
29+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
30+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
31+
FOREIGN KEY (collection_id) REFERENCES collections(id) ON DELETE CASCADE
32+
);
33+
`
34+
1435
func setupTestDB(t *testing.T) (*sql.DB, *database.Queries, func()) {
1536
t.Helper()
1637

@@ -19,10 +40,10 @@ func setupTestDB(t *testing.T) (*sql.DB, *database.Queries, func()) {
1940
t.Fatalf("failed to open test db: %v", err)
2041
}
2142

22-
schema, err := os.ReadFile("testdata/schema.sql")
23-
if err != nil {
24-
t.Fatalf("failed to read schema: %v", err)
25-
}
43+
// schema, err := os.ReadFile("testdata/schema.sql")
44+
// if err != nil {
45+
// t.Fatalf("failed to read schema: %v", err)
46+
// }
2647
_, err = db.Exec(string(schema))
2748
if err != nil {
2849
t.Fatalf("failed to execute schema: %v", err)

0 commit comments

Comments
 (0)