Skip to content

Switch to CircleCI #2603

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

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2.1

# Default actions to perform on each Emacs version
default: &default-steps
steps:
- checkout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need Lein at all?

Copy link
Contributor Author

@danielcompton danielcompton Mar 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cider-jack-in-clj&cljs requires lein to be around. See the test failure at https://circleci.com/gh/danielcompton/cider/11 when removing Leiningen from the build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look at the test. We don't do any real jack-ins anywhere in the tests, so probably something just needs to be stubbed.

- run: apt-get update && apt-get install make leiningen=2.8.1-6 -y
- run: make elpa
- run: emacs --version
- run: make test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have separate steps for the testing and linting, so that we would get nicer reports at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with this is that the majority of CI time is spent getting the image booted and into the right state to run the tests. The lint and test phases only take 6s and 3s. Given this is a free service, I wanted to try and minimise resource usage where practicable. If we wanted better errors from CircleCI we could look at producing JUnit XML reports which they can render.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. My only issue is that the linting produces a lot of (hard to read) output and this makes it hard to find the tests at least for me.

- run: make lint

jobs:
test-emacs-25:
docker:
- image: silex/emacs:25-dev
entrypoint: bash
<<: *default-steps

test-emacs-26:
docker:
- image: silex/emacs:26-dev
entrypoint: bash
<<: *default-steps

test-emacs-master:
docker:
- image: silex/emacs:master-dev
entrypoint: bash
<<: *default-steps

workflows:
version: 2
ci-test-matrix:
jobs:
- test-emacs-25
- test-emacs-26
- test-emacs-master
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

34 changes: 0 additions & 34 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
[![MELPA](http://melpa.org/packages/cider-badge.svg)](http://melpa.org/#/cider)
[![MELPA Stable](http://stable.melpa.org/packages/cider-badge.svg)](http://stable.melpa.org/#/cider)
[![Build Status](https://travis-ci.org/clojure-emacs/cider.png?branch=master)](https://travis-ci.org/clojure-emacs/cider)
[![CircleCI](https://circleci.com/gh/clojure-emacs/cider.svg?style=svg)](https://circleci.com/gh/clojure-emacs/cider)

CIDER is the **C**lojure(Script) **I**nteractive **D**evelopment **E**nvironment
that **R**ocks!
Expand Down
110 changes: 52 additions & 58 deletions doc/hacking_on_cider.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,76 +91,70 @@ You can also check for compliance with a variety of coding standards in batch mo
$ make lint
```

#### Running the tests in Travis CI
#### Running the tests in CircleCI

If you prefer to see the full Travis CI test suite run successfully, the easiest
If you prefer to see the full CircleCI CI test suite run successfully, the easiest
way to achieve that is to create your own personal account on
https://travis-ci.org. View your profile details on the Travis CI site, and
toggle the switch to enable builds on your fork of the cider project.
https://circleci.com. Fork CIDER on GitHub, and then add your fork on CircleCI to
start building. Every time you push code to a branch, CircleCI will build it.

Subsequent pushes to your fork will generate a Travis CI build you can monitor
Subsequent pushes to your fork will generate a CircleCI build you can monitor
for success or failure.

#### Simulating the Travis CI tests locally in Docker
#### Simulating the Circle CI tests locally in Docker

If you prefer not to wait for Travis CI all the time, or if you need to debug
something that fails in Travis CI but does not fail for you on your own machine,
then you can also run the Travis CI tests manually in Docker.
If you prefer not to wait for CircleCI all the time, or if you need to debug
something that fails in CircleCI but does not fail for you on your own machine,
then you can also run the CircleCI tests locally with the CircleCI CLI (that's
a mouthful!).

You will need to run some scripts to build and launch the Docker image.
To do this, first [install](https://circleci.com/docs/2.0/local-cli/#installation)
the CircleCI CLI, and [Docker](https://docs.docker.com/install/).

To build:
Currently the CircleCI CLI [doesn't support local builds with version 2.1](https://github.com/CircleCI-Public/circleci-cli/issues/79)
of the CircleCI config, so for now we need to convert it to the 2.0 format.
Make sure not to commit these changes to the `config.yml` file.

```
$ docker/build.sh
```

The build script uses a base image provided by the engineers at Travis CI.

*Note: The Travis docker image is currently more than 8GB, so be prepared with a
good internet connection and time to spare.*

The resulting docker image is tagged simply `cider-travis`. You can run this
image by hand, but there is a convenience script available:

```
$ docker/run.sh
```

This script launches a docker container and bind-mounts your cider project
directory as `/home/travis/cider` such that you can instantly see any code
changes reflected inside the docker environment.

For instance, first you can run tests on Emacs 25.3:

```
(emacs-25.3-travis) ~/cider$ make test
```

And then switch to Emacs 26.1 and test again:

```
(emacs-25.3-travis) ~/cider$ evm use Emacs-26-pretest-travis
(emacs-26.1-travis) ~/cider$ cask install
(emacs-26.1-travis) ~/cider$ make test
```

You can test byte compilation too

```
(emacs-26.1-travis) ~/cider$ make test-bytecomp
```shell
$ circleci config process .circleci/config.yml > .circleci/config.yml.tmp && \
mv .circleci/config.yml.tmp .circleci/config.yml
```

When you are done working in docker, just `exit` the bash prompt, and the docker
container will also exit. Note that `docker/run.sh` runs the container with
`--rm`, meaning any changes to the docker container are discarded when the
container exits.
Now, we're finally ready to
[run a CircleCI container on our machine](https://circleci.com/docs/2.0/local-cli/#run-a-job-in-a-container-on-your-machine).
Run `circleci local execute --job=<job>` where `<job>` is one of those listed
in `.circleci/config.yml`, e.g. `test-emacs-26`.

So for example, by default, the docker image pre-installs only the most recent
releases of Emacs 25, Emacs 26, and a recent snapshot of the Emacs git
repository. The `evm` tool is available should you need to install some other
specific build. However additional versions of Emacs will be discarded when
you exit the docker container.
```shell
$ circleci local execute --job=test-emacs-26
Docker image digest: sha256:65b2102646d5658f892e0ad8253b7912c676126c857c87c8c12460f0aa4f5aa1
====>> Spin up Environment
Build-agent version 1.0.8563-43047892 (2019-03-06T15:11:54+0000)
Starting container silex/emacs:26-dev
image cache not found on this host, downloading silex/emacs:26-dev
26-dev: Pulling from silex/emacs
6cf436f81810: Already exists
987088a85b96: Already exists
e58f362a948a: Waiting
...
====>> make elpa
#!/bin/bash -eo pipefail
make elpa
Compute dependencies
cask install
Loading package information... done
Package operations: 10 installs, 0 removals
...
Indenting region...
Indenting region...done
* Run indent-character
* Run trailing-whitespace
** ELISP-LINT: cider-overlays.el OK
Success!
```

This may take a while to download the CircleCI build agent and the build containers
the first time you run the tests locally.

## Hacking on cider-nrepl (Clojure)

Expand Down
4 changes: 0 additions & 4 deletions docker/build.sh

This file was deleted.

4 changes: 0 additions & 4 deletions docker/run.sh

This file was deleted.

35 changes: 0 additions & 35 deletions travis-ci/install-cask.sh

This file was deleted.

20 changes: 0 additions & 20 deletions travis-ci/install-evm.sh

This file was deleted.

1 change: 0 additions & 1 deletion travis-ci/prompt.sh

This file was deleted.

27 changes: 0 additions & 27 deletions travis-ci/retry.sh

This file was deleted.