diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml new file mode 100644 index 000000000..9f44877fe --- /dev/null +++ b/.buildkite/pipeline.yaml @@ -0,0 +1,50 @@ +steps: + - command: + - "go build ./cmd/..." + label: ":hammer-and-wrench: Build / :go: 1.11" + env: + GOGC: "400" + DENDRITE_LINT_DISABLE_GC: "1" + plugins: + - docker#v3.0.1: + image: "golang:1.11-alpine" + + - command: + - "go test ./..." + label: ":female-scientist: Unit tests / :go: 1.11" + env: + GOGC: "400" + DENDRITE_LINT_DISABLE_GC: "1" + plugins: + - docker#v3.0.1: + image: "golang:1.11-alpine" + + - command: + - "go build ./cmd/..." + label: ":hammer-and-wrench: Build / :go: 1.12" + env: + GOGC: "400" + DENDRITE_LINT_DISABLE_GC: "1" + plugins: + - docker#v3.0.1: + image: "golang:1.12-alpine" + + - command: + - "go test ./..." + label: ":female-scientist: Unit tests / :go: 1.12" + env: + GOGC: "400" + DENDRITE_LINT_DISABLE_GC: "1" + plugins: + - docker#v3.0.1: + image: "golang:1.12-alpine" + + - command: + - "./scripts/find-lint.sh" + label: ":lower_left_crayon: Lint / :go: 1.12" + env: + GOGC: "400" + DENDRITE_LINT_DISABLE_GC: "1" + plugins: + - docker#v3.0.1: + image: "golang:1.12-alpine" diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..8b6f4db02 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,32 @@ +version: 2 +jobs: + dendrite: + docker: + - image: matrixdotorg/sytest-dendrite + working_directory: /src + steps: + - checkout + + # Set up dendrite + - run: + name: Build Dendrite + command: ./build.sh + - run: + name: Copy dummy keys to root + command: | + mv .circleci/matrix_key.pem . + mv .circleci/server.key . + - run: + name: Run sytest with whitelisted tests + command: /dendrite_sytest.sh + + - store_artifacts: + path: /logs + destination: logs + - store_test_results: + path: /logs +workflows: + version: 2 + build: + jobs: + - dendrite diff --git a/.circleci/matrix_key.pem b/.circleci/matrix_key.pem new file mode 100644 index 000000000..6691c74af --- /dev/null +++ b/.circleci/matrix_key.pem @@ -0,0 +1,5 @@ +-----BEGIN MATRIX PRIVATE KEY----- +Key-ID: ed25519:zXtB + +jDyHsx0EXbAfvM32yBEKQfIy1FHrmwtB1uMAbm5INBg= +-----END MATRIX PRIVATE KEY----- diff --git a/.circleci/server.key b/.circleci/server.key new file mode 100644 index 000000000..a5c485079 --- /dev/null +++ b/.circleci/server.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCanRCqP11MLIQh +nC26+A1oyBsFfH7auZ3pqE/WFDrCCIoc7ek7cF3fZU7q8OYI+Q9L5V8fobuLb6FB +iXD5zZ6pBAI0VNjAS8yi8VluXIv6pJKsVY3k2hGiU7xRoEhkzckZBaEiruspQbcX +ziNoWoueVBB1a4Eproqzy225cTcoprHsJIPXj0HpW/jKcmahmlM/OrqRAxTwxpb/ +moI6MWIeN4n7h55N6dU1ScVvBS7gZpZQ28d8akuvG3m8kE8q1OPFYGvrNeowD4sp +qDPFijhbygwpzDQlAWriPcqV9KhuGRnYRGTGvuluOttmpgNhNFVxVAlwZJuMVAMU +Jhek66ntKsxWkF5LsO8ls20hmHyyAsL7+rb2ZjuRtEwE8SwOstU2AIIXoSTtqXjX +zC8Ew0VB9MCInJoJC/+iKTLoDqXRZeDKGFx1A2F3Y+Er+Z41HcwgqKRsPqZ066yR +6iKAb5rzJutnEARtbSrNipy9nHE5hIgKJzgOnggcegypcAj3nqbfFFCZA2CFNXoG +XFkmBHEpz38pPLI5z6HpeZRRySoIyahk9IfSwM3aB1aUi//8CcpAodGvYGNQkQ3W +HkrZmM4MtC25I5RyMpYJQWKFpx1cOVPf2ASqaJ+IX1JJTv9dSdYHY/rxsxaiXiry ++uI7UITRvUKgAOrExfSAXco73bgUFwIDAQABAoICAQCP9QX7PhxEPH6aPKxnlWYG +1aozJYOHa6QYVlpfXV6IIyNVZD7w1OLSiaU9IydL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fADAfVIMxB5 ++9paWeEfnYC/o377FTJIJ9hHJWIaWSoiJZLYDBmoYdxmk8DSHAJCeWsjYDzPybsH +7RyMPIa1u7lVdgOPEOBi1OIg7ASLxGKiHQtrYHq99GcaVvU/UxoNRMcSnPfY3G8R +pGah+EndSCb2F20ouDyvlKfOylAltH2BeNc3B4PeP7ZhlVr7bfyOAfC2Z7FNDm3J ++yaBExKfroZjsksctNAcAbgpuvhLLG8= +-----END PRIVATE KEY----- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a53931f49..f4724c31f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,5 +2,5 @@ -* [ ] I have made sure any new dependencies have been checked into the `vendor/` directory +* [ ] I have added any new tests that need to pass to `testfile` as specified in [docs/sytest.md](https://github.com/matrix-org/dendrite/blob/master/docs/sytest.md) * [ ] Pull request includes a [sign off](https://github.com/matrix-org/dendrite/blob/master/CONTRIBUTING.md#sign-off) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d5c3a137..000000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: go -go: - - 1.11.x - - 1.12.x - -env: -- TEST_SUITE="lint" -- TEST_SUITE="unit-test" -- TEST_SUITE="integ-test" - -sudo: false - -# Use trusty for postgres 9.5 support -dist: trusty - -addons: - postgresql: "9.5" - -services: - - postgresql - -cache: - directories: - - .downloads - -script: - - ./scripts/travis-test.sh - -# we only need the latest git commit -git: - depth: 1 diff --git a/README.md b/README.md index d8c4e9b7b..7ba64490f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dendrite [![Build Status](https://travis-ci.org/matrix-org/dendrite.svg?branch=master)](https://travis-ci.org/matrix-org/dendrite) [![Dendrite Dev on Matrix](https://img.shields.io/matrix/dendrite-dev:matrix.org.svg?label=%23dendrite-dev%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite-dev:matrix.org) [![Dendrite on Matrix](https://img.shields.io/matrix/dendrite:matrix.org.svg?label=%23dendrite%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite:matrix.org) +# Dendrite [![Build Status](https://travis-ci.org/matrix-org/dendrite.svg?branch=master)](https://travis-ci.org/matrix-org/dendrite) [![CircleCI](https://circleci.com/gh/matrix-org/dendrite.svg?style=svg)](https://circleci.com/gh/matrix-org/dendrite) [![Dendrite Dev on Matrix](https://img.shields.io/matrix/dendrite-dev:matrix.org.svg?label=%23dendrite-dev%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite-dev:matrix.org) [![Dendrite on Matrix](https://img.shields.io/matrix/dendrite:matrix.org.svg?label=%23dendrite%3Amatrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#dendrite:matrix.org) Dendrite will be a matrix homeserver written in go. diff --git a/docs/sytest.md b/docs/sytest.md new file mode 100644 index 000000000..a0f7d85c1 --- /dev/null +++ b/docs/sytest.md @@ -0,0 +1,8 @@ +# SyTest + +Dendrite uses [SyTest](https://github.com/matrix-org/sytest) for its +integration testing. When creating a new PR, add the test IDs that your PR +should allow to pass to `testfile` in dendrite's root directory. Not all PRs +need to make new tests pass. If we find your PR should be making a test pass we +may ask you to add to that file, as generally Dendrite's progress can be +tracked through the amount of SyTest tests it passes. diff --git a/scripts/travis-test.sh b/scripts/travis-test.sh deleted file mode 100755 index c2a5f221f..000000000 --- a/scripts/travis-test.sh +++ /dev/null @@ -1,86 +0,0 @@ -#! /bin/bash - -# The entry point for travis tests -# -# TEST_SUITE env var can be set to "lint", "unit-test" or "integ-test", in -# which case only the linting, unit tests or integration tests will be run -# respectively. If not specified or null all tests are run. - -set -eu - -# Tune the GC to use more memory to reduce the number of garbage collections -export GOGC=400 -export DENDRITE_LINT_DISABLE_GC=1 - -export GO111MODULE=on - -# starts a travis fold section. The first argument is the name of the fold -# section (which appears on the RHS) and may contain no spaces. Remaining -# arguments are echoed in yellow on the LHS as the header line of the fold -# section. -travis_sections=() -function travis_start { - name="$1" - shift - echo -en "travis_fold:start:$name\r" - travis_sections+=($name) - - # yellow/bold - echo -en "\e[33;1m" - echo "$@" - # normal - echo -en "\e[0m" -} - -# ends a travis fold section -function travis_end { - name=${travis_sections[-1]} - unset 'travis_sections[-1]' - echo -en "travis_fold:end:$name\r" -} - -function kill_kafka { - echo "killing kafka" - # sometimes kafka doesn't die on a SIGTERM so we SIGKILL it. - killall -9 -v java -} - -if [ "${TEST_SUITE:-lint}" == "lint" ]; then - ./scripts/find-lint.sh -fi - -if [ "${TEST_SUITE:-unit-test}" == "unit-test" ]; then - go test ./... -fi - -if [ "${TEST_SUITE:-integ-test}" == "integ-test" ]; then - travis_start go-build "Building dendrite and integ tests" - go install ./cmd/... - travis_end - - # Check that all the packages can build. - # When `go build` is given multiple packages it won't output anything, and just - # checks that everything builds. - go build ./cmd/... - - # Create necessary certificates and keys to run dendrite - travis_start certs "Building SSL certs" - openssl req -x509 -newkey rsa:512 -keyout server.key -out server.crt -days 365 -nodes -subj /CN=localhost - travis_end - - travis_start kafka "Installing kafka" - ./scripts/install-local-kafka.sh - travis_end - - # make sure we kill off zookeeper/kafka on exit, because it stops the - # travis container being cleaned up (cf - # https://github.com/travis-ci/travis-ci/issues/8082) - trap kill_kafka EXIT - - # Run the integration tests - for i in roomserver syncserver mediaapi; do - travis_start "$i-integration-tests" "Running integration tests for $i" - $i-integration-tests - travis_end - done -fi diff --git a/testfile b/testfile new file mode 100644 index 000000000..d90a9458c --- /dev/null +++ b/testfile @@ -0,0 +1,4 @@ +GET /register yields a set of flows +POST /register can create a user +POST /register downcases capitals in usernames +