From 932837f7bbe60f42a9980b6d498515bce62bfa54 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 18 Dec 2018 12:26:10 +0100 Subject: [PATCH] Introduce CI stages (front / back), mix format runs in parallel --- .gitlab-ci.yml | 64 ++++++++++++++++++++++++++++------------- docker/tests/Dockerfile | 5 +++- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 554b8cfd..cd6d6ba8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ image: tcitworld/mobilizon-ci -services: - - name: mdillon/postgis:10 - alias: postgres +stages: + - front + - back variables: MIX_ENV: "test" @@ -12,24 +12,48 @@ variables: POSTGRES_HOST: postgres GEOLITE_CITIES_PATH: "/usr/share/GeoIP/GeoLite2-City.mmdb" -cache: - paths: - - deps - - _build - - .rebar3 - - ~/.mix - - ~/.hex - - js/node_modules +js: + stage: front + before_script: + - cd js + - npm install + script: + - npm run build + after_script: + - cd ../ + cache: + paths: + - js/node_modules + artifacts: + paths: + - priv/static + untracked: false + expire_in: 30 days -before_script: - - cd js && npm install && npm run build && cd ../ - - mix local.rebar --force - - mix local.hex --force - - mix deps.get - - MIX_ENV=test mix ecto.create - - MIX_ENV=test mix ecto.migrate +elixir_format: + stage: back + before_script: + - mix deps.get + script: + - mix format --check-formatted --dry-run + cache: + paths: + - deps mix: + stage: back + services: + - name: mdillon/postgis:10 + alias: postgres + dependencies: + - js + before_script: + - mix deps.get + - MIX_ENV=test mix ecto.create + - MIX_ENV=test mix ecto.migrate script: - - mix format --check-formatted --dry-run - - mix coveralls + - mix coveralls + cache: + paths: + - deps + - _build diff --git a/docker/tests/Dockerfile b/docker/tests/Dockerfile index 1b9e8b95..ed3e0ddc 100644 --- a/docker/tests/Dockerfile +++ b/docker/tests/Dockerfile @@ -1,6 +1,9 @@ FROM elixir:latest +LABEL maintainer="Thomas Citharel " +ENV REFRESHED_AT=2018-12-18 RUN apt-get update -yq && apt-get install -yq build-essential inotify-tools postgresql-client git curl gnupg -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash && apt-get install nodejs -yq +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash && apt-get install nodejs -yq RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mix local.hex --force && mix local.rebar --force RUN curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb /usr/share/GeoIP/GeoLite2-City.mmdb \ No newline at end of file