CircleCI

CircleCI is a fast CI solution with a great interface. They allow unlimited public repositories and have reasonable prices for private repositories.

Create an account at https://circleci.com/

Now would be a good time to also create a repository on GitHub for your project (if you haven't already) and commit/push your project.

git add -A
git commit -m "Server configs and eDeliver"
git push -u origin master

Go back to CircleCI and add your project.

  1. Click "Projects" in the left-nav
  2. Click "Add Project"
  3. Click on your account
  4. Find your repository and click "Build project"

You will see CircleCI booting a container and attempting to infer what kind of project you have. After a short while, it will fail because it does not have the requirements needed for a Phoenix project. Let's fix that!

Add a circle config to your project.

circle.yml

machine: environment: PATH: $HOME/.asdf/bin:$HOME/.asdf/shims:$PATH dependencies: cache_directories: - ~/.asdf override: - git clone https://github.com/HashNuke/asdf.git ~/.asdf || `:` - asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git || `:` - asdf plugin-add elixir https://github.com/HashNuke/asdf-elixir.git || `:` - asdf install erlang '19.0' - asdf install elixir '1.3.1' - asdf global erlang '19.0' - asdf global elixir '1.3.1' - mix local.hex --force - mix local.rebar --force - mix deps.get - mix deps.compile test: override: - mix test deployment: production: branch: master commands: - mix edeliver build release - mix edeliver deploy release to production - mix edeliver restart production - mix edeliver migrate production staging: branch: staging commands: - mix edeliver build release - mix edeliver deploy release - mix edeliver restart - mix edeliver migrate

Notice the deployment section. This configuration tells Circle to deploy to the production server on successful builds on the master branch, and deploy to the staging server on successful builds to the staging branch.

Later you may want to tailor this config a bit, but for now, commit and push to GitHub.

git add -A
git commit -m "Add CircleCI config"
git push origin master

CircleCI will pick this up right away and start work. This build will take a while because CircleCI will have to download and compile Erlang (just like you did on the build server). We add asdf to cache_directories so that this only has to be done once. Subsequent builds should be much faster!

results matching ""

    No results matching ""