Merge branch 'add_make_test' into 'master'
Add make test command See merge request framasoft/mobilizon!116
This commit is contained in:
commit
d87b8c989f
19
.dockerignore
Normal file
19
.dockerignore
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
_build
|
||||||
|
CONTRIBUTING.md
|
||||||
|
deps
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile
|
||||||
|
.elixir_ls
|
||||||
|
.formatter.exs
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitlab
|
||||||
|
.gitlab-ci.yml
|
||||||
|
.graphqlconfig.yaml
|
||||||
|
LICENSE
|
||||||
|
Makefile
|
||||||
|
README.md
|
||||||
|
SECURITY.md
|
||||||
|
ssh_match_hostname
|
||||||
|
support
|
||||||
|
.js/package-lock.json
|
@ -1,6 +1,6 @@
|
|||||||
FROM elixir:1.7
|
FROM bitwalker/alpine-elixir:latest
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y build-essential inotify-tools postgresql-client
|
RUN apk add inotify-tools postgresql-client yarn
|
||||||
|
|
||||||
RUN mix local.hex --force && mix local.rebar --force
|
RUN mix local.hex --force && mix local.rebar --force
|
||||||
|
|
||||||
|
7
Makefile
7
Makefile
@ -10,5 +10,12 @@ stop:
|
|||||||
@bash docker/message.sh "stopping MobiliZon"
|
@bash docker/message.sh "stopping MobiliZon"
|
||||||
docker-compose down
|
docker-compose down
|
||||||
@bash docker/message.sh "stopped"
|
@bash docker/message.sh "stopped"
|
||||||
|
test: stop
|
||||||
|
@bash docker/message.sh "Building front"
|
||||||
|
docker-compose -f docker-compose.yml -f docker-compose.test.yml run front yarn run build
|
||||||
|
@bash docker/message.sh "Front built"
|
||||||
|
@bash docker/message.sh "Running tests"
|
||||||
|
docker-compose -f docker-compose.yml -f docker-compose.test.yml run api mix test
|
||||||
|
@bash docker/message.sh "Tests runned"
|
||||||
|
|
||||||
target: init
|
target: init
|
||||||
|
18
docker-compose.test.yml
Normal file
18
docker-compose.test.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
restart: "no"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: mobilizon_test
|
||||||
|
front:
|
||||||
|
restart: "no"
|
||||||
|
api:
|
||||||
|
restart: "no"
|
||||||
|
environment:
|
||||||
|
MIX_ENV: "test"
|
||||||
|
MOBILIZON_DATABASE_DBNAME: mobilizon_test
|
||||||
|
command: "mix test"
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
|
.:
|
@ -1,7 +1,6 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
container_name: mobilizon_db
|
container_name: mobilizon_db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@ -9,16 +8,19 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
POSTGRES_DB: mobilizon_dev
|
POSTGRES_DB: mobilizon_dev
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
|
||||||
front:
|
front:
|
||||||
container_name: mobilizon_front
|
container_name: mobilizon_front
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build: ./js
|
build: ./js
|
||||||
volumes:
|
volumes:
|
||||||
- './js:/app/js'
|
- '.:/app'
|
||||||
ports:
|
ports:
|
||||||
- "8888:8080"
|
- "8888:8080"
|
||||||
entrypoint: entrypoint
|
command: yarn run dev
|
||||||
|
|
||||||
api:
|
api:
|
||||||
container_name: mobilizon_api
|
container_name: mobilizon_api
|
||||||
@ -30,10 +32,9 @@ services:
|
|||||||
- "4000:4001"
|
- "4000:4001"
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
- front
|
||||||
environment:
|
environment:
|
||||||
# Environment: Prod when ready
|
MIX_ENV: "dev"
|
||||||
MIX_ENV: dev
|
|
||||||
# Instance
|
|
||||||
MOBILIZON_INSTANCE_NAME: My Mobilizon Instance
|
MOBILIZON_INSTANCE_NAME: My Mobilizon Instance
|
||||||
MOBILIZON_INSTANCE_HOST: mobilizon.me
|
MOBILIZON_INSTANCE_HOST: mobilizon.me
|
||||||
MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me
|
MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me
|
||||||
@ -42,4 +43,7 @@ services:
|
|||||||
MOBILIZON_DATABASE_USERNAME: postgres
|
MOBILIZON_DATABASE_USERNAME: postgres
|
||||||
MOBILIZON_DATABASE_DBNAME: mobilizon_dev
|
MOBILIZON_DATABASE_DBNAME: mobilizon_dev
|
||||||
MOBILIZON_DATABASE_HOST: postgres
|
MOBILIZON_DATABASE_HOST: postgres
|
||||||
entrypoint: entrypoint
|
command: "mix phx.migrate_serve"
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
|
.:
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
mix deps.get
|
|
||||||
|
|
||||||
# Wait for Postgres to become available.
|
|
||||||
until PGPASSWORD=$MOBILIZON_DATABASE_PASSWORD psql -h $MOBILIZON_DATABASE_HOST -U $MOBILIZON_DATABASE_USERNAME -c '\q' 2>/dev/null; do
|
|
||||||
>&2 echo "Postgres is unavailable - sleeping"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "\nPostgres is available: continuing with database setup..."
|
|
||||||
|
|
||||||
# Potentially Set up the database
|
|
||||||
mix ecto.create
|
|
||||||
mix ecto.migrate
|
|
||||||
|
|
||||||
echo "\nTesting the installation..."
|
|
||||||
# "Proove" that install was successful by running the tests
|
|
||||||
mix test
|
|
||||||
|
|
||||||
echo "\n Launching Phoenix web server..."
|
|
||||||
iex -S mix phx.server
|
|
@ -2,7 +2,8 @@ FROM node:10
|
|||||||
|
|
||||||
LABEL maintainer="tcit"
|
LABEL maintainer="tcit"
|
||||||
|
|
||||||
COPY docker/entrypoint.sh /bin/entrypoint
|
RUN yarn install
|
||||||
|
RUN yarn upgrade node-sass
|
||||||
|
|
||||||
WORKDIR /app/js
|
WORKDIR /app/js
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
yan install
|
|
||||||
yarn rebuild node-sass
|
|
||||||
yarn run dev
|
|
5
mix.exs
5
mix.exs
@ -7,7 +7,7 @@ defmodule Mobilizon.Mixfile do
|
|||||||
[
|
[
|
||||||
app: :mobilizon,
|
app: :mobilizon,
|
||||||
version: @version,
|
version: @version,
|
||||||
elixir: "~> 1.4",
|
elixir: "~> 1.8",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||||
start_permanent: Mix.env() == :prod,
|
start_permanent: Mix.env() == :prod,
|
||||||
@ -116,7 +116,8 @@ defmodule Mobilizon.Mixfile do
|
|||||||
[
|
[
|
||||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||||
test: ["ecto.create --quiet", "ecto.migrate", "test"]
|
test: ["ecto.create --quiet", "ecto.migrate", "test"],
|
||||||
|
"phx.migrate_serve": ["ecto.create --quiet", "ecto.migrate", "phx.server"]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user