CI updates: Speed up register / login, minimize Windows tests, and add Mac tests (#2784)

* Upgrade npm in build-ubuntu

* npm i -S moment

* Don't upgrade npm

* macos-latest on build-mac

* Update dev-release.yml

* Add CI for macOS

* Lower password hash during unit tests

* Add comment

* Only integration tests on Windows

* Tweak TestCreateRecurringTask timings

* Fix server-test-mini-sqlite
This commit is contained in:
Chen-I Lim 2022-04-13 15:36:20 -07:00 committed by GitHub
parent bc37e97ae9
commit 5b423d6647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 13 deletions

View file

@ -24,20 +24,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: npm ci
run: cd webapp; npm ci
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Build Linux server
run: make server-linux-package
- name: Copy server binary for Cypress
run: cp bin/linux/focalboard-server bin/
- name: "Test server: ${{matrix['db']}}"
run: make server-test-${{matrix['db']}}
@ -85,6 +76,26 @@ jobs:
ci-windows-server:
runs-on: windows-2022
strategy:
matrix:
db:
- sqlite
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: "Test server (minimum): ${{matrix['db']}}"
run: make server-test-mini-${{matrix['db']}}
ci-mac-server:
runs-on: macos-11
strategy:
matrix:
db:

View file

@ -36,7 +36,7 @@ ci: server-test
cd webapp; npm run cypress:ci
templates-archive: ## Build templates archive file
cd server/assets/build-template-archive; go run -tags '$(BUILD_TAGS)' main.go --dir="../templates-boardarchive" --out="../templates.boardarchive"
cd server/assets/build-template-archive; go run -tags '$(BUILD_TAGS)' main.go --dir="../templates-boardarchive" --out="../templates.boardarchive"
server: templates-archive ## Build server for local environment.
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=dev")
@ -120,6 +120,11 @@ server-test-sqlite: export FB_UNIT_TESTING=1
server-test-sqlite: templates-archive ## Run server tests using sqlite
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
server-test-mini-sqlite: export FB_UNIT_TESTING=1
server-test-mini-sqlite: templates-archive ## Run server tests using sqlite
cd server/integrationtests; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
server-test-mysql: export FB_UNIT_TESTING=1
server-test-mysql: export FB_STORE_TEST_DB_TYPE=mysql
server-test-mysql: export FB_STORE_TEST_DOCKER_PORT=44445

View file

@ -11,6 +11,7 @@ import (
"github.com/mattermost/focalboard/server/client"
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/server"
"github.com/mattermost/focalboard/server/services/auth"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/permissions/localpermissions"
"github.com/mattermost/focalboard/server/services/permissions/mmpermissions"
@ -262,6 +263,9 @@ func (th *TestHelper) Start() *TestHelper {
// InitBasic starts the test server and initializes the clients of the
// helper, registering them and logging them into the system.
func (th *TestHelper) InitBasic() *TestHelper {
// Reduce password has strength for unit tests to dramatically speed up account creation and login
auth.PasswordHashStrength = 4
th.Start()
// user1

View file

@ -23,9 +23,11 @@ const (
InvalidSymbolPassword = "symbol"
)
var PasswordHashStrength = 10
// HashPassword generates a hash using the bcrypt.GenerateFromPassword.
func HashPassword(password string) string {
hash, err := bcrypt.GenerateFromPassword([]byte(password), 10)
hash, err := bcrypt.GenerateFromPassword([]byte(password), PasswordHashStrength)
if err != nil {
panic(err)
}

View file

@ -35,8 +35,8 @@ func TestCreateTask(t *testing.T) {
func TestCreateRecurringTask(t *testing.T) {
taskName := "Test Recurring Task"
taskTime := time.Millisecond * 200
taskWait := time.Millisecond * 100
taskTime := time.Millisecond * 500
taskWait := time.Millisecond * 200
executionCount := new(int32)
testFunc := func() {