当运行我的圈子CI测试的干净生成凤凰的项目,我得到:凤凰:**(混合)找不到迁移目录“私法/回购/迁移”
$ mix test
==> connection
Compiling 1 file (.ex)
Generated connection app
==> gettext
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
===> Compiling ranch
==> poolboy (compile)
==> decimal
Compiling 1 file (.ex)
Generated decimal app
==> poison
Compiling 4 files (.ex)
warning: HashDict.size/1 is deprecated, use maps and the Map module instead
lib/poison/encoder.ex:283
Generated poison app
==> db_connection
Compiling 23 files (.ex)
warning: module attribute @regulator was set but never used
lib/db_connection/sojourn.ex:39
Generated db_connection app
==> phoenix_pubsub
Compiling 12 files (.ex)
Generated phoenix_pubsub app
===> Compiling cowlib
===> Compiling cowboy
==> mime
Compiling 1 file (.ex)
Generated mime app
==> plug
Compiling 44 files (.ex)
Generated plug app
==> phoenix_html
Compiling 8 files (.ex)
Generated phoenix_html app
==> phoenix
Compiling 60 files (.ex)
Generated phoenix app
==> postgrex
Compiling 61 files (.ex)
Generated postgrex app
==> ecto
Compiling 69 files (.ex)
Compiling lib/ecto/query/builder/lock.ex (it's taking more than 10s)
Compiling lib/ecto/repo/queryable.ex (it's taking more than 10s)
Compiling lib/ecto/query/builder/filter.ex (it's taking more than 10s)
Compiling lib/ecto/repo/preloader.ex (it's taking more than 10s)
Compiling lib/ecto/migration/runner.ex (it's taking more than 10s)
Compiling lib/ecto/repo/schema.ex (it's taking more than 10s)
Compiling lib/ecto/migration/schema_migration.ex (it's taking more than 10s)
Compiling lib/ecto/adapters/postgres/connection.ex (it's taking more than 10s)
Compiling lib/ecto/changeset.ex (it's taking more than 10s)
Generated ecto app
==> phoenix_ecto
Compiling 4 files (.ex)
Generated phoenix_ecto app
==> martinffx
Compiling 15 files (.ex)
Generated martinffx app
** (Mix) Could not find migrations directory "priv/repo/migrations"
for repo Martinffx.Repo.
This may be because you are in a new project and the
migration directory has not been created yet. Creating an
empty directory at the path above will fix this error.
If you expected existing migrations to be found, please
make sure your repository has been properly configured
and the configured path exists.
但在运行时相同命令在本地运行成功:
$ mix test
....
Finished in 0.1 seconds
4 tests, 0 failures
Randomized with seed 328700
为什么?我没有迁移运行?它在当地有效......发生了什么?
circle.yml
machine:
environment:
PATH: "$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"
dependencies:
cache_directories:
- ~/.asdf
- deps
- _build
pre:
- chmod +x ./circle_pre_build.sh
- ./circle_pre_build.sh
database:
override:
- psql -U ubuntu < ./db/init-test.sql
test:
override:
- elixir -v
- mix deps
- node -v
- npm -v
- mix test
circle_pre_build.sh
#!/bin/bash
# http://code.parent.co/phoenix-circleci-heroku/
# Ensure exit codes other than 0 fail the build
set -e
# Check for asdf
if [ ! asdf | grep version ]
then
git clone https://github.com/HashNuke/asdf.git ~/.asdf;
# Add plugins for asdf
asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git
asdf plugin-add elixir https://github.com/HashNuke/asdf-elixir.git
fi
# Install erlang/elixir
erlang_version=$(awk '/erlang/ { print $2 }' .tool-versions)
asdf install erlang $erlang_version
elixir_version=$(awk '/elixir/ { print $2 }' .tool-versions)
asdf install elixir $elixir_version
# Get dependencies
yes | mix deps.get
yes | mix deps.compile
# Exit successfully
exit 0
的init-TEST.SQL
DROP DATABASE martinffx_test;
DO $$
BEGIN
IF NOT EXISTS (
SELECT *
FROM pg_catalog.pg_user
WHERE usename = 'martinffx') THEN
CREATE ROLE martinffx LOGIN PASSWORD 'password';
ALTER USER martinffx CREATEDB;
END IF;
END
$$;
软件版本
$ elixir -v
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:32:2] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.4.0
$ mix deps
* connection 1.0.4 (Hex package) (mix)
locked at 1.0.4 (connection) a1cae722
ok
* fs 0.9.1 (Hex package) (rebar)
locked at 0.9.2 (fs) ed17036c
ok
* gettext 0.13.1 (Hex package) (mix)
locked at 0.13.1 (gettext) 5e0daf4e
ok
* ranch 1.3.2 (Hex package) (rebar3)
locked at 1.3.2 (ranch) e4965a14
ok
* poolboy 1.5.1 (Hex package) (rebar)
locked at 1.5.1 (poolboy) 6b461639
ok
* decimal 1.3.1 (Hex package) (mix)
locked at 1.3.1 (decimal) 157b3ced
ok
* poison 2.2.0 (Hex package) (mix)
locked at 2.2.0 (poison) 4763b69a
ok
* db_connection 1.1.0 (Hex package) (mix)
locked at 1.1.0 (db_connection) b2b88db6
ok
* phoenix_pubsub 1.0.1 (Hex package) (mix)
locked at 1.0.1 (phoenix_pubsub) c10ddf62
ok
* cowlib 1.0.2 (Hex package) (rebar3)
locked at 1.0.2 (cowlib) 9d769a1d
ok
* cowboy 1.1.2 (Hex package) (rebar3)
locked at 1.1.2 (cowboy) 61ac29ea
ok
* mime 1.0.1 (Hex package) (mix)
locked at 1.0.1 (mime) 05c39385
ok
* plug 1.3.0 (Hex package) (mix)
locked at 1.3.0 (plug) 6e2b01af
ok
* phoenix_html 2.9.3 (Hex package) (mix)
locked at 2.9.3 (phoenix_html) 1b5a2122
ok
* phoenix 1.2.1 (Hex package) (mix)
locked at 1.2.1 (phoenix) 6dc59224
ok
* phoenix_live_reload 1.0.8 (Hex package) (mix)
locked at 1.0.8 (phoenix_live_reload) 4333f9c7
ok
* postgrex 0.13.0 (Hex package) (mix)
locked at 0.13.0 (postgrex) e101ab47
ok
* ecto 2.1.3 (Hex package) (mix)
locked at 2.1.3 (ecto) ffb24e15
ok
* phoenix_ecto 3.2.1 (Hex package) (mix)
locked at 3.2.1 (phoenix_ecto) 6cf11d59
ok
$ node -v
v4.2.6
$ npm -v
2.14.12
你可以试试这个:创建'私法/回购虚设空文件/ migrations'(例如'priv/repo/migrations/.gitkeep'),提交新文件,然后尝试在Circle CI上测试? – Dogbert
谢谢,这解决了symtom,但我真的很想找到原因。为什么这只会显示在CI服务器上,而不是在我的开发环境中? – Martinffx
发布了一个解释和替代修复@Martinffx的答案。感谢你, – Dogbert