[chore] Fiddle with CI tests; use wasmsqlite3 for CI tests (#2966)

* [chore] Update CI test stuff

* don't bother with ldflags

* use wasmsqlite3
This commit is contained in:
tobi 2024-06-05 21:40:08 +02:00 committed by GitHub
parent 45fe295caa
commit 9caf29bed2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 67 additions and 24 deletions

View file

@ -34,11 +34,20 @@ steps:
path: /root/.cache/go-build path: /root/.cache/go-build
- name: go-src - name: go-src
path: /go path: /go
environment:
CGO_ENABLED: "0"
commands: commands:
- apk update --no-cache && apk add git - apk update --no-cache && apk add git
- CGO_ENABLED=0 GTS_DB_TYPE="sqlite" GTS_DB_ADDRESS=":memory:" go test ./... - >-
- CGO_ENABLED=0 ./test/envparsing.sh go test
- CGO_ENABLED=0 ./test/swagger.sh -failfast
-timeout=20m
-tags "wasmsqlite3 netgo osusergo static_build kvformat timetzdata"
./...
- ./test/envparsing.sh
- ./test/swagger.sh
depends_on:
- lint
when: when:
event: event:
include: include:
@ -46,38 +55,40 @@ steps:
- name: web-setup - name: web-setup
image: node:18-alpine image: node:18-alpine
when:
event:
include:
- pull_request
volumes: volumes:
- name: yarn_cache - name: yarn_cache
path: /tmp/cache path: /tmp/cache
commands: commands:
- yarn --cwd ./web/source install --frozen-lockfile --cache-folder /tmp/cache - yarn --cwd ./web/source install --frozen-lockfile --cache-folder /tmp/cache
- yarn --cwd ./web/source ts-patch install # https://typia.io/docs/setup/#manual-setup - yarn --cwd ./web/source ts-patch install # https://typia.io/docs/setup/#manual-setup
depends_on:
- test
when:
event:
include:
- pull_request
- name: web-lint - name: web-lint
image: node:18-alpine image: node:18-alpine
commands:
- yarn --cwd ./web/source lint
depends_on:
- web-setup
when: when:
event: event:
include: include:
- pull_request - pull_request
depends_on:
- web-setup
commands:
- yarn --cwd ./web/source lint
- name: web-build - name: web-build
image: node:18-alpine image: node:18-alpine
commands:
- yarn --cwd ./web/source build
depends_on:
- web-setup
when: when:
event: event:
include: include:
- pull_request - pull_request
depends_on:
- web-setup
commands:
- yarn --cwd ./web/source build
- name: snapshot - name: snapshot
image: superseriousbusiness/gotosocial-drone-build:0.6.0 # https://github.com/superseriousbusiness/gotosocial-drone-build image: superseriousbusiness/gotosocial-drone-build:0.6.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
@ -193,6 +204,6 @@ steps:
--- ---
kind: signature kind: signature
hmac: c07f32c63cbb8180c1a37e46ff1362c1c45586819b52c6de67366ae3504314e4 hmac: 2e74313f4192b3e6daf6d1d00a7c3796019d93da7ce7e0a77208ccc3c37089b0
... ...

View file

@ -20,12 +20,12 @@ package bundb_test
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtscontext"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"
@ -78,7 +78,7 @@ func (suite *NotificationTestSuite) spamNotifs() {
} }
} }
fmt.Printf("\n\n\nput %d notifs in the db\n\n\n", notifCount) suite.T().Logf("put %d notifs in the db\n", notifCount)
} }
type NotificationTestSuite struct { type NotificationTestSuite struct {
@ -89,10 +89,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {
suite.spamNotifs() suite.spamNotifs()
testAccount := suite.testAccounts["local_account_1"] testAccount := suite.testAccounts["local_account_1"]
before := time.Now() before := time.Now()
notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) notifications, err := suite.db.GetAccountNotifications(
gtscontext.SetBarebones(context.Background()),
testAccount.ID,
id.Highest,
id.Lowest,
"",
20,
nil,
)
suite.NoError(err) suite.NoError(err)
timeTaken := time.Since(before) timeTaken := time.Since(before)
fmt.Printf("\n\n\n withSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken) suite.T().Logf("withSpam: got %d notifications in %s\n", len(notifications), timeTaken)
suite.NotNil(notifications) suite.NotNil(notifications)
for _, n := range notifications { for _, n := range notifications {
@ -103,10 +111,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {
func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() { func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() {
testAccount := suite.testAccounts["local_account_1"] testAccount := suite.testAccounts["local_account_1"]
before := time.Now() before := time.Now()
notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) notifications, err := suite.db.GetAccountNotifications(
gtscontext.SetBarebones(context.Background()),
testAccount.ID,
id.Highest,
id.Lowest,
"",
20,
nil,
)
suite.NoError(err) suite.NoError(err)
timeTaken := time.Since(before) timeTaken := time.Since(before)
fmt.Printf("\n\n\n withoutSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken) suite.T().Logf("withoutSpam: got %d notifications in %s\n", len(notifications), timeTaken)
suite.NotNil(notifications) suite.NotNil(notifications)
for _, n := range notifications { for _, n := range notifications {
@ -120,7 +136,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() {
err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "") err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")
suite.NoError(err) suite.NoError(err)
notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) notifications, err := suite.db.GetAccountNotifications(
gtscontext.SetBarebones(context.Background()),
testAccount.ID,
id.Highest,
id.Lowest,
"",
20,
nil,
)
suite.NoError(err) suite.NoError(err)
suite.Nil(notifications) suite.Nil(notifications)
suite.Empty(notifications) suite.Empty(notifications)
@ -132,7 +156,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithTwoAccounts() {
err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "") err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")
suite.NoError(err) suite.NoError(err)
notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) notifications, err := suite.db.GetAccountNotifications(
gtscontext.SetBarebones(context.Background()),
testAccount.ID,
id.Highest,
id.Lowest,
"",
20,
nil,
)
suite.NoError(err) suite.NoError(err)
suite.Nil(notifications) suite.Nil(notifications)
suite.Empty(notifications) suite.Empty(notifications)