diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e51ec2e8..fd719d9b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,13 @@ -version: 2 +version: 2.1 jobs: + check-linear: + machine: + image: ubuntu-1604:201903-01 + steps: + - checkout + - run: + name: Check git history of branch is linear + command: tools/check-linear.sh build: machine: image: ubuntu-1604:201903-01 @@ -32,3 +40,21 @@ jobs: - run: name: Launch build with bazel command: echo "bazel build //upload --verbose_failures" | HOMEWORLD_CHROOT="$HOME/autobuild-chroot" USER="circleci" ./build-chroot/enter-ci.sh +workflows: + version: 2 + workflow: + jobs: + - check-linear: + filters: + branches: + ignore: + - staging + - trying + - master + - build: + filters: + branches: + only: + - staging + - trying + - master diff --git a/bors.toml b/bors.toml new file mode 100644 index 000000000..adb5c6e78 --- /dev/null +++ b/bors.toml @@ -0,0 +1,14 @@ +status = [ + "ci/circleci: build", + "continuous-integration/jenkins/branch", +] +pr_status = [ + "ci/circleci: check-linear", +] +required_approvals = 1 +timeout_sec = 10800 # three hour timeout +cut_body_after = "---" + +[committer] +name = "hyades-bors[bot]" +email = "sipb-hyades@mit.edu" diff --git a/docs/bors-ng-setup.txt b/docs/bors-ng-setup.txt new file mode 100644 index 000000000..b7566b33b --- /dev/null +++ b/docs/bors-ng-setup.txt @@ -0,0 +1,115 @@ +exit # this isn't quite a script; some parts are interactive. + +### Register Github App +# https://github.com/bors-ng/bors-ng#step-1-register-a-new-github-app +# Dashboard URL: https://hijinks.mit.edu:4002/ +# Generate and download a private key (.pem file) + + +### Install dependencies + +wget -q -O - https://packages.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - +echo 'deb https://packages.erlang-solutions.com/debian stretch contrib' >/etc/apt/sources.list.d/erlang-solutions.list + +wget -q -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +echo 'deb https://deb.nodesource.com/node_13.x stretch main' >/etc/apt/sources.list.d/nodesource.list + +apt-get update +apt-get install esl-erlang elixir postgresql nodejs + + +# use this command to generate random secrets when called for: +# borsng.service +[Unit] +Description=Bors-NG +After=network.target + +[Service] +Type=simple +User=borsng +WorkingDirectory=/home/borsng/bors-ng +EnvironmentFile=/home/borsng/bors-env +Restart=on-failure +ExecStart=/home/borsng/bors-ng/_build/prod/rel/bors/bin/bors start +ExecStop=/home/borsng/bors-ng/_build/prod/rel/bors/bin/bors stop + +[Install] +WantedBy=multi-user.target +EOF +ln -s "$(realpath borsng.service)" /etc/systemd/system +systemctl enable borsng + + +sudo -iu borsng # run all remaining commands as borsng +umask go= + +git clone https://github.com/bors-ng/bors-ng.git + +cd bors-ng +mix local.hex --force +mix deps.get --only prod +mix local.rebar --force + +pushd assets +npm install +popd +npm run deploy --prefix ./assets +MIX_ENV=prod mix phx.digest + +MIX_ENV=prod mix compile +MIX_ENV=prod mix release + + +cat >~/bors-env <>~bors-env # private key from github + +sh -ac '. ~/bors-env && POOL_SIZE=1 mix ecto.migrate' diff --git a/tools/check-linear.sh b/tools/check-linear.sh new file mode 100755 index 000000000..2d7f85c60 --- /dev/null +++ b/tools/check-linear.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -euo pipefail + +if [ 0 = "$(git rev-list --min-parents=2 --count "$(git merge-base origin/master HEAD)"..HEAD)" ] +then + echo 'git history is linear' +else + echo 'error: nonlinear branch git history' + echo 'merge commits:' + git rev-list --min-parents=2 "$(git merge-base origin/master HEAD)"..HEAD + exit 1 +fi