Macos 特拉维斯OSX测试研究生
如何在Travis CI OS X build中设置Postgres 我无法启动,我不知道如何设置这些:Macos 特拉维斯OSX测试研究生,macos,postgresql,travis-ci,Macos,Postgresql,Travis Ci,如何在Travis CI OS X build中设置Postgres 我无法启动,我不知道如何设置这些: --dbaddress localhost --dbport 5432 --dbname testDb --dbusername postgres 对于Travis CI OS X实例,环境与典型安装类似 以下是您可以配置的 可用的数据库服务包括: postgis版本2.1.3,postgresql版本9.3.5 与Linux不同,OSX中当前没有服务配置。您可以使用安装脚本并直接使用Po
--dbaddress localhost --dbport 5432 --dbname testDb --dbusername postgres
对于Travis CI OS X实例,环境与典型安装类似 以下是您可以配置的 可用的数据库服务包括: postgis版本2.1.3,postgresql版本9.3.5 与Linux不同,OSX中当前没有服务配置。您可以使用安装脚本并直接使用Postgresql工具启动数据库服务 例如.travis.yml如下所示:
addons:
postgresql: "9.4"
language:
- objective-c
os:
- osx
sudo:
- false
install:
- export PG_DATA=$(brew --prefix)/var/postgres
- pg_ctl -w start -l postgres.log --pgdata ${PG_DATA}
- createuser -s postgres
- psql -c 'create database testDb;' -U postgres
- cat postgres.log
那么它有什么作用呢
“附加组件”是选择特定的postgresql版本而不是默认版本
无法在Travis CI中执行“sudo”命令
“安装”包含我们需要运行的命令和您要添加的其他命令
pg_ctl命令需要一个数据目录,“pg_data”包含本地home brew安装的路径和存储数据库文件的目录
pg_ctl将启动现有服务并等待连接
必须创建unix用户/角色postgres,并在数据库“testDb”的最终创建脚本中使用
最后,postgres.log被发送到Travis CI日志
希望这能让您知道从哪里开始。对于Travis CI OS X实例,环境与典型安装类似 以下是您可以配置的 可用的数据库服务包括: postgis版本2.1.3,postgresql版本9.3.5 与Linux不同,OSX中当前没有服务配置。您可以使用安装脚本并直接使用Postgresql工具启动数据库服务 例如.travis.yml如下所示:
addons:
postgresql: "9.4"
language:
- objective-c
os:
- osx
sudo:
- false
install:
- export PG_DATA=$(brew --prefix)/var/postgres
- pg_ctl -w start -l postgres.log --pgdata ${PG_DATA}
- createuser -s postgres
- psql -c 'create database testDb;' -U postgres
- cat postgres.log
那么它有什么作用呢
“附加组件”是选择特定的postgresql版本而不是默认版本
无法在Travis CI中执行“sudo”命令
“安装”包含我们需要运行的命令和您要添加的其他命令
pg_ctl命令需要一个数据目录,“pg_data”包含本地home brew安装的路径和存储数据库文件的目录
pg_ctl将启动现有服务并等待连接
必须创建unix用户/角色postgres,并在数据库“testDb”的最终创建脚本中使用
最后,postgres.log被发送到Travis CI日志
希望这能让你知道从哪里开始。格里菲奥回答的其他信息: 与此同时,Travis正在运行PostgreSQL 9.5,即使使用插件PostgreSQL:9.4,我在启动时得到了以下日志输出:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.4, which is not compatible with this version 9.5.4.
首先创建一个新群集后,它开始工作:
install:
- export PG_DATA=$(brew --prefix)/var/postgres
- rm -rf $PG_DATA
- initdb $PG_DATA -E utf8
- pg_ctl -w start -l postgres.log --pgdata ${PG_DATA}
- createuser -s postgres
- psql -c 'create database testDb;' -U postgres
griffio回答的其他信息: 与此同时,Travis正在运行PostgreSQL 9.5,即使使用插件PostgreSQL:9.4,我在启动时得到了以下日志输出:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.4, which is not compatible with this version 9.5.4.
首先创建一个新群集后,它开始工作:
install:
- export PG_DATA=$(brew --prefix)/var/postgres
- rm -rf $PG_DATA
- initdb $PG_DATA -E utf8
- pg_ctl -w start -l postgres.log --pgdata ${PG_DATA}
- createuser -s postgres
- psql -c 'create database testDb;' -U postgres
谢谢你的帮助。我试过了,但有一个错误:$if[$TRAVIS_OS_NAME==osx];然后pg_ctl-w start-l postgres.log-pgdata${pg_DATA};fi pg_ctl:太多的命令行参数首先是-pgdata Try pg_ctl-help以获取更多信息。如果[[$TRAVIS_OS_NAME==osx]],则使用该命令;然后pg_ctl-w start-l postgres.log-pgdata${pg_DATA};fi失败,并在过程中以1退出。您的生成已停止。我已更新了答案,以在Travis CI中包含最低工作版本。也许您可以尝试看看它是否适用于您的案例?看起来该命令无效,因为您用破折号分隔了它们-,应该将它们分开,或者只使用&g.createuser-s postgres&&psql-c“create database travis_ci_test;”-U postgres&&cat postgres.log;目前,当使用Xcode 7或更高版本时,该错误正在发生。Xcode 6.4似乎启动了。你是对的,它在Xcode 6.4上工作。但这会导致未安装clang3.7。你知道怎么安装吗?我在谷歌上搜索过,但我只发现我需要使用更高版本的Xcode,但我不能。谢谢你的帮助。我试过了,但有一个错误:$if[$TRAVIS_OS_NAME==osx];然后pg_ctl-w start-l postgres.log-pgdata${pg_DATA};fi pg_ctl:太多的命令行参数首先是-pgdata Try pg_ctl-help以获取更多信息。如果[[$TRAVIS_OS_NAME==osx]],则使用该命令;然后pg_ctl-w start-l postgres.log-pgdata${pg_DATA};fi失败,并在过程中以1退出。您的生成已停止。我已更新了答案,以在Travis CI中包含最低工作版本。也许您可以尝试看看它是否适用于您的案例?看起来该命令无效,因为您用破折号分隔了它们-,应该将它们分开,或者只使用&g.createuser-s postgres&&psql-c“create database travis_ci_test;”-U postgres&&cat postgres.log;目前,当使用Xcode 7或更高版本时,该错误正在发生。Xcode 6.4似乎启动了。你是对的,它 适用于Xcode 6.4。但这会导致未安装clang3.7。你知道怎么安装吗?我在谷歌上搜索过,但我只发现我需要使用更高版本的Xcode,但我不能。