This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit (internal network only) to import your old projects to the new GitLab platform 📥

Test a Phoenix application with GitLab CI/CD

This example demonstrates the integration of Gitlab CI with Phoenix, Elixir and Postgres.

Add .gitlab-ci.yml to project

The following .gitlab-ci.yml should be added in the root of your repository to trigger CI:

image: elixir:1.3

  - postgres:9.6

  MIX_ENV: "test"

  # Setup phoenix dependencies
  - apt-get update
  - apt-get install -y postgresql-client
  - mix local.hex --force
  - mix deps.get --only test
  - mix ecto.reset

    - mix test

The variables will set the Mix environment to "test". The before_script will install psql, some Phoenix dependencies, and will also run your migrations.

Finally, the test script will run your tests.

Update the Config Settings

In config/test.exs, update the database hostname:

config :my_app, MyApp.Repo,
  hostname: if(System.get_env("CI"), do: "postgres", else: "localhost"),

Add the Migrations Folder

If you do not have any migrations yet, you will need to create an empty .gitkeep file in priv/repo/migrations.