Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Enmeshed tests on CI #548

Merged
merged 17 commits into from
Aug 17, 2023
35 changes: 29 additions & 6 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
---
# see https://docs.mergify.com/configuration/
pull_request_rules:
- name: "Update out-of-date ready PRs"
# see https://docs.mergify.com/

pull_request_rules:
- name: "Update out-of-date approved PRs"
conditions:
# those rules are implicit
# those rules are implicit for the update action:
# - "#commits-behind > 0"
# - "-closed"

- "-conflict"
- "-draft"
- "-locked"
- "-merged"
- "author != dependabot[bot]"
- "base = main"
- "branch-protection-review-decision = APPROVED"
- "label != 'not ready'"

actions:
update:

- name: "Assign PRs"
conditions:
- "-closed"
- "#assignee = 0"
actions:
assign:
add_users: ["{{ author }}"]

- name: "Add label on conflicts"
conditions:
- "conflict"
actions:
comment:
message: "@{{author}} this pull request has merge conflicts."
label:
add: [conflict]

- name: "Remove label when conflicts were resolved"
conditions:
- "-conflict"
actions:
label:
remove: [conflict]
65 changes: 65 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
# https://github.com/repository-settings/app

repository:
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true

# https://docs.github.com/en/rest/issues/labels
labels:
- name: badly estimated
color: "#FF3333"
description: Scope, difficulty and/or clarify were different

- name: code/chore
color: "#E99695"
description: Dance tool code or tests configuration maintenance improvements

- name: code/enhancement
color: "#FBCA04"
description: Some dance tool feature or tests configuration could work better

- name: code/feature
color: "#0E8A16"
description: Some dance tool feature or tests configuration is not implemented yet

- name: conflict
color: "#FF0000"
description: PRs that have merge conflicts

- name: deps
color: "#D4C5F9"
description: PRs that update dependencies

- name: do not merge
color: "#0052CC"
description: PRs that should not be merged

- name: documentation
color: "#0052CC"
description: Something is badly or not documented

- name: good first issue
color: "#5319E7"
description: Good issues for new external contributors

- name: help wanted
color: "#006B75"
description: Issues that require extra attention

- name: not ready
color: "#000000"
description: Issues that are not ready to be worked on; PRs that should skip CI

# https://hacktoberfest.com/participation/#spam
- name: spam
color: "#C5DEF5"
description: Spam issues and PRs

- name: trust
color: "#00FF00"
description: PRs that can access Actions secrets
AlekSi marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .github/workflows/conform-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ env:
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFORM_TOKEN: ${{ secrets.CONFORM_TOKEN }} # repo-scoped GITHUB_TOKEN is not enough to query org-level projects

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/dance-trust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
submodules: true

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/dance.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
name: Dance
on:
push:
branches:
- main
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild
- opened
- reopened
- synchronize
push:
branches:
- main
schedule:
- cron: "12 3 * * *" # after FerretDB's Docker workflow

Expand All @@ -19,6 +19,7 @@ env:
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local

jobs:
dance:
Expand Down Expand Up @@ -47,31 +48,25 @@ jobs:
- dotnet-example-auth
- java-example
- java-example-auth
- python-example
- python-example-auth
- mongo
- mongo-go-driver
- mongo-tools
- python-example
- python-example-auth
- ycsb-workloada
- ycsb-workloadc

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
submodules: true

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: dance

# set up Python build environment
- name: Install Python dependencies
run: |
pip3 install pymongo

- name: Install Task
run: go generate -x
working-directory: tools
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local

jobs:
linters:
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
path = tests/dotnet-example
url = https://github.com/FerretDB/dotnet-example.git
branch = main
[submodule "enmeshed-runtime"]
path = tests/enmeshed-runtime
url = https://github.com/nmshd/cns-runtime.git
branch = main
[submodule "java-example"]
path = tests/java-example
url = https://github.com/FerretDB/java-example.git
Expand All @@ -22,7 +26,3 @@
path = tests/python-example
url = https://github.com/FerretDB/python-example.git
branch = main
[submodule "enmeshed-runtime"]
path = tests/enmeshed-runtime
url = https://github.com/nmshd/cns-runtime.git
branch = main
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.12.0
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691
golang.org/x/sys v0.10.0
go.mongodb.org/mongo-driver v1.12.1
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
golang.org/x/sys v0.11.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 h1:/yRP+0AN7mf5DkD3BAI6TOFnd51gEoDEb8o35jIFtgw=
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand All @@ -45,8 +45,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
9 changes: 2 additions & 7 deletions internal/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ import (
// It runs a command with arguments in a directory and returns the combined output as is.
// If the command exits with a non-zero exit code, the test fails.
func Run(ctx context.Context, dir string, args []string) (*internal.TestResults, error) {
bin, err := exec.LookPath(args[0])
if err != nil {
return nil, err
}

cmd := exec.CommandContext(ctx, bin, args[1:]...)
cmd := exec.CommandContext(ctx, args[0], args[1:]...)
cmd.Dir = dir
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand All @@ -49,7 +44,7 @@ func Run(ctx context.Context, dir string, args []string) (*internal.TestResults,
},
}

if err = cmd.Run(); err != nil {
if err := cmd.Run(); err != nil {
res.TestResults[dir] = internal.TestResult{
Status: internal.Fail,
Output: err.Error(),
Expand Down
1 change: 0 additions & 1 deletion tests/dotnet-example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
runner: command
dir: dotnet-example
args:
- dotnet
- run
Expand Down
7 changes: 7 additions & 0 deletions tests/enmeshed-runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -ex

npm ci

env CONNECTION_STRING=mongodb://localhost:27017 npx jest -i
3 changes: 1 addition & 2 deletions tests/enmeshed-runtime.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
runner: command
dir: enmeshed-runtime
args: ["sh", "-c", "npm i && CONNECTION_STRING=mongodb://localhost:27017 npx jest -i"]
args: [../enmeshed-runtime.sh]
AlekSi marked this conversation as resolved.
Show resolved Hide resolved

results:
common:
Expand Down
9 changes: 9 additions & 0 deletions tests/java-example-auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -ex

# enables Maven exceptions
export MAVEN_OPTS='-ea'

mvn compile exec:java -Dexec.mainClass=com.start.Connection \
-Dexec.args="mongodb://user:password@localhost:27017/?authMechanism=PLAIN"
7 changes: 1 addition & 6 deletions tests/java-example-auth.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
---
runner: command
dir: java-example/java
args:
- mvn
- compile
- exec:java
- -Dexec.mainClass=com.start.Connection
- -Dexec.args="mongodb://user:password@localhost:27017/?authMechanism=PLAIN"
args: [../../java-example-auth.sh]

results:
ferretdb:
Expand Down
9 changes: 9 additions & 0 deletions tests/java-example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -ex

# enables Maven exceptions
export MAVEN_OPTS='-ea'

mvn compile exec:java -Dexec.mainClass=com.start.Connection \
-Dexec.args="mongodb://localhost:27017/"
7 changes: 1 addition & 6 deletions tests/java-example.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
---
runner: command
dir: java-example/java
args:
- mvn
- compile
- exec:java
- -Dexec.mainClass=com.start.Connection
- -Dexec.args="mongodb://localhost:27017/"
args: [../../java-example.sh]

results:
common:
Expand Down
7 changes: 7 additions & 0 deletions tests/python-example-auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -ex

pip3 install pymongo

python3 pymongo_test.py mongodb://user:password@localhost:27017/?authMechanism=PLAIN
5 changes: 1 addition & 4 deletions tests/python-example-auth.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
runner: command
dir: python-example
args:
- python3
- pymongo_test.py
- mongodb://user:password@localhost:27017/?authMechanism=PLAIN
args: [../python-example-auth.sh]

results:
ferretdb:
Expand Down
7 changes: 7 additions & 0 deletions tests/python-example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -ex

pip3 install pymongo

python3 pymongo_test.py mongodb://localhost:27017/
Loading