From 3e19fe1fe243ce1383d62b3a6685fcfe3faad502 Mon Sep 17 00:00:00 2001 From: prichier Date: Mon, 26 Oct 2020 00:12:54 +0100 Subject: [PATCH] Get back original root Dockerfile & gitlab-ci --- Dockerfile | 11 ++++- gitlab-ci.yml | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-) mode change 120000 => 100644 Dockerfile create mode 100644 gitlab-ci.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 120000 index 27f3d3ac7..000000000 --- a/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -./docker/production/Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..9c73fff55 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM bitwalker/alpine-elixir:latest + +RUN apk add inotify-tools postgresql-client yarn file +RUN apk add --no-cache make gcc libc-dev argon2 imagemagick + +RUN mix local.hex --force && mix local.rebar --force + +WORKDIR /app + +EXPOSE 4000 diff --git a/gitlab-ci.yml b/gitlab-ci.yml new file mode 100644 index 000000000..4a6efdf2f --- /dev/null +++ b/gitlab-ci.yml @@ -0,0 +1,123 @@ +image: tcitworld/mobilizon-ci + +stages: + - check + - test + - deploy + +variables: + MIX_ENV: "test" + # DB Variables for Postgres / Postgis + POSTGRES_DB: mobilizon_test + POSTGRES_USER: postgres + POSTGRES_PASSWORD: "" + POSTGRES_HOST: postgres + # DB Variables for Mobilizon + MOBILIZON_DATABASE_USERNAME: $POSTGRES_USER + MOBILIZON_DATABASE_PASSWORD: $POSTGRES_PASSWORD + MOBILIZON_DATABASE_DBNAME: $POSTGRES_DB + MOBILIZON_DATABASE_HOST: $POSTGRES_HOST + GEOLITE_CITIES_PATH: "/usr/share/GeoIP/GeoLite2-City.mmdb" + MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true" + +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - ~/.cache/Cypress + - _build/ + - deps/ + - js/node_modules + - cache/Cypress + +lint: + stage: check + script: + - export EXITVALUE=0 + - mix deps.get + - mix credo --strict -a || export EXITVALUE=1 + - mix format --check-formatted --dry-run || export EXITVALUE=1 + - cd js + - yarn install + #- yarn run lint || export EXITVALUE=1 + - yarn run prettier --ignore-path="src/i18n/*" -c . || export EXITVALUE=1 + - yarn run build + - cd ../ + - exit $EXITVALUE + artifacts: + expire_in: 1 day + when: on_success + paths: + - priv/static + +deps: + stage: check + script: + - export EXITVALUE=0 + - mix deps.get + - mix hex.outdated || export EXITVALUE=1 + - cd js + - yarn outdated || export EXITVALUE=1 + - exit $EXITVALUE + allow_failure: true + +exunit: + stage: test + services: + - name: mdillon/postgis:11 + alias: postgres + before_script: + - cd js + - yarn install + - yarn run build + - cd ../ + - mix deps.get + - MIX_ENV=test mix ecto.create + - MIX_ENV=test mix ecto.migrate + dependencies: + - lint + script: + - mix coveralls +# cypress: +# stage: test +# services: +# - name: mdillon/postgis:11 +# alias: postgres +# script: +# - mix deps.get +# - cd js +# - yarn install +# - npx cypress install # just to be sure +# - yarn run build +# - cd ../ +# - MIX_ENV=e2e mix ecto.create +# - MIX_ENV=e2e mix ecto.migrate +# - MIX_ENV=e2e mix run priv/repo/e2e.seed.exs +# - MIX_ENV=e2e mix phx.server & +# - cd js +# - npx wait-on http://localhost:4000 +# - if [ -z "$CYPRESS_KEY" ]; then npx cypress run; else npx cypress run --record --parallel --key $CYPRESS_KEY; fi +# artifacts: +# expire_in: 2 day +# paths: +# - js/tests/e2e/screenshots/**/*.png +# - js/tests/e2e/videos/**/*.mp4 + +# pages: +# stage: deploy +# script: +# # - mkdir public +# # Mobilizon documentation is now on https://framagit.org/framasoft/joinmobilizon/documentation +# # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172 +# # - mix deps.get +# # - mix docs +# # - mv doc public/backend +# #- cd js +# #- yarn install +# #- yarn run styleguide:build +# #- mv styleguide ../public/frontend +# only: +# - master +# artifacts: +# expire_in: 1 hour +# paths: +# - public