travis: use special pinafore user for postgres
This commit is contained in:
parent
30ee13146e
commit
c8b352d131
|
@ -45,7 +45,6 @@ before_install:
|
||||||
- node --version
|
- node --version
|
||||||
- postgres --version
|
- postgres --version
|
||||||
- redis-server --version
|
- redis-server --version
|
||||||
- psql -d template1 -c "CREATE USER nolan CREATEDB;"
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm run lint
|
- npm run lint
|
||||||
script: npm run test-browser
|
script: npm run test-browser
|
||||||
|
@ -53,8 +52,11 @@ env:
|
||||||
global:
|
global:
|
||||||
- PGPORT=5433
|
- PGPORT=5433
|
||||||
matrix:
|
matrix:
|
||||||
- BROWSER=chrome:headless
|
include:
|
||||||
- BROWSER=firefox:headless
|
- env: BROWSER=chrome:headless
|
||||||
|
- env: BROWSER=firefox:headless
|
||||||
|
allow_failures:
|
||||||
|
- env: BROWSER=firefox:headless
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
|
@ -45,8 +45,6 @@ Automatically fix most linting issues:
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
_**Note:** If you have a local `mastodon_development` Postgres database, this will erase it._
|
|
||||||
|
|
||||||
Run integration tests, using headless Chrome by default:
|
Run integration tests, using headless Chrome by default:
|
||||||
|
|
||||||
npm test
|
npm test
|
||||||
|
@ -62,8 +60,6 @@ Run tests for a particular browser:
|
||||||
|
|
||||||
## Testing in development mode
|
## Testing in development mode
|
||||||
|
|
||||||
_**Note:** If you have a local `mastodon_development` Postgres database, this will erase it._
|
|
||||||
|
|
||||||
In separate terminals:
|
In separate terminals:
|
||||||
|
|
||||||
1\. Run a Mastodon dev server:
|
1\. Run a Mastodon dev server:
|
||||||
|
|
|
@ -15,7 +15,9 @@ const dir = __dirname
|
||||||
|
|
||||||
const GIT_URL = 'https://github.com/nolanlawson/mastodon'
|
const GIT_URL = 'https://github.com/nolanlawson/mastodon'
|
||||||
const GIT_BRANCH = 'for-pinafore'
|
const GIT_BRANCH = 'for-pinafore'
|
||||||
const DB_USER = 'nolan'
|
|
||||||
|
const DB_NAME = 'pinafore_development'
|
||||||
|
const DB_USER = 'pinafore'
|
||||||
|
|
||||||
const envFile = `
|
const envFile = `
|
||||||
PAPERCLIP_SECRET=foo
|
PAPERCLIP_SECRET=foo
|
||||||
|
@ -24,6 +26,7 @@ OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=${process.env.PGPORT || 5432}
|
DB_PORT=${process.env.PGPORT || 5432}
|
||||||
DB_USER=${DB_USER}
|
DB_USER=${DB_USER}
|
||||||
|
DB_NAME=${DB_NAME}
|
||||||
`
|
`
|
||||||
|
|
||||||
const mastodonDir = path.join(dir, '../mastodon')
|
const mastodonDir = path.join(dir, '../mastodon')
|
||||||
|
@ -35,8 +38,7 @@ async function cloneMastodon () {
|
||||||
await stat(mastodonDir)
|
await stat(mastodonDir)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Cloning mastodon...')
|
console.log('Cloning mastodon...')
|
||||||
await exec(`git clone ${GIT_URL} "${mastodonDir}"`)
|
await exec(`git clone ${GIT_URL} --branch ${GIT_BRANCH} --single-branch --depth 1 "${mastodonDir}"`)
|
||||||
await exec(`git checkout ${GIT_BRANCH}`, {cwd: mastodonDir})
|
|
||||||
await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8')
|
await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,14 +46,15 @@ async function cloneMastodon () {
|
||||||
async function setupMastodonDatabase () {
|
async function setupMastodonDatabase () {
|
||||||
console.log('Setting up mastodon database...')
|
console.log('Setting up mastodon database...')
|
||||||
try {
|
try {
|
||||||
await exec(`dropdb -h 127.0.0.1 -U ${DB_USER} --no-password mastodon_development`, {cwd: mastodonDir})
|
await exec(`psql -d template1 -c "CREATE USER ${DB_USER} CREATEDB;"`, {cwd: mastodonDir})
|
||||||
} catch (e) { /* ignore */ }
|
} catch (e) { /* ignore */ }
|
||||||
await exec(`createdb -h 127.0.0.1 -U ${DB_USER} --no-password mastodon_development`, {cwd: mastodonDir})
|
try {
|
||||||
|
await exec(`dropdb -h 127.0.0.1 -U ${DB_USER} -w ${DB_NAME}`, {cwd: mastodonDir})
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
await exec(`createdb -h 127.0.0.1 -U ${DB_USER} -w ${DB_NAME}`, {cwd: mastodonDir})
|
||||||
|
|
||||||
let dumpFile = path.join(dir, '../fixtures/dump.sql')
|
let dumpFile = path.join(dir, '../fixtures/dump.sql')
|
||||||
await exec(`pg_restore -h 127.0.0.1 -U ${DB_USER} --no-password -Fc -d mastodon_development "${dumpFile}"`, {
|
await exec(`psql -h 127.0.0.1 -U ${DB_USER} -w -d ${DB_NAME} -f "${dumpFile}"`, {cwd: mastodonDir})
|
||||||
cwd: mastodonDir
|
|
||||||
})
|
|
||||||
|
|
||||||
let tgzFile = path.join(dir, '../fixtures/system.tgz')
|
let tgzFile = path.join(dir, '../fixtures/system.tgz')
|
||||||
let systemDir = path.join(mastodonDir, 'public/system')
|
let systemDir = path.join(mastodonDir, 'public/system')
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue