Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 86b1762

Browse files
committed
fixing-travis
1 parent 5e9b5fb commit 86b1762

9 files changed

Lines changed: 25 additions & 45 deletions

File tree

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
language: node_js
22

3+
sudo: true
4+
35
node_js:
46
- 8
57
- 10
68

79
before_install:
8-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.28.4
10+
- ssh-keygen -t rsa -N "" -f ${TRAVIS_HOME}/.ssh/id_rsa
11+
- cat ${TRAVIS_HOME}/.ssh/id_rsa.pub | tee -a ${TRAVIS_HOME}/.ssh/authorized_keys
12+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s
913
- export PATH="$HOME/.yarn/bin:$PATH"
14+
- yarn
1015

1116
script:
12-
- chmod 700 ssh && chmod 644 ssh/id_rsa.pub && chmod 600 ssh/id_rsa
1317
- yarn ci
1418

1519
notifications:
@@ -22,4 +26,7 @@ cache:
2226
- 'node_modules'
2327

2428
addons:
25-
ssh_known_hosts: test.shipitjs.com
29+
ssh_known_hosts:
30+
- 127.0.0.1
31+
- 0.0.0.0
32+
- localhost

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"license": "MIT",
33
"private": true,
44
"scripts": {
5-
"postinstall": "chmod 400 ./ssh/id_rsa ./ssh/id_rsa.pub",
65
"build": "lerna run build",
76
"ci": "yarn build && yarn lint && yarn test --ci --coverage && codecov",
87
"dev": "lerna run build --parallel -- --watch",

packages/shipit-cli/tests/integration.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ describe('shipit-cli', () => {
2121
stdout = stdout.trim();
2222

2323
expect(stdout).toMatch(/Running 'remoteUser' task.../)
24-
expect(stdout).toMatch(/Running "echo \$USER" on host "test.shipitjs.com"./)
25-
expect(stdout).toMatch(/@test.shipitjs.com deploy/)
24+
expect(stdout).toMatch(/Running "echo \$USER" on host "localhost"./)
25+
expect(stdout).toMatch(/@localhost travis/)
2626
expect(stdout).toMatch(/Finished 'remoteUser' after/)
2727
}, 10000)
2828

2929
it('should work with "~"', async () => {
3030
const { stdout } = await exec(
3131
`${babelNode} ${shipitCli} --shipitfile ${shipitFile} test cwdSsh`,
3232
)
33-
expect(stdout).toMatch(/@test.shipitjs.com \/home\/deploy\/\.ssh/)
33+
expect(stdout).toMatch(/@localhost \/home\/travis\/\.ssh/)
3434
}, 10000)
3535
})

packages/shipit-cli/tests/sandbox/shipitfile.babel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
export default shipit => {
44
shipit.initConfig({
55
default: {
6-
key: './ssh/id_rsa',
6+
key: '/home/travis/.ssh/id_rsa',
77
},
88
test: {
9-
servers: 'deploy@test.shipitjs.com',
9+
servers: 'travis@localhost',
1010
},
1111
})
1212

packages/shipit-deploy/tests/integration.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ describe('shipit-cli', () => {
2525

2626
const latestRelease = lsReleases
2727
.split('\n')
28-
.reverse()[2]
28+
.filter(s => s.match(/^@localhost/))
29+
.reverse()[0]
2930
.match(/\d{14}/)[0]
3031

3132
const { stdout: lsCurrent } = await exec(
3233
`${babelNode} ${shipitCli} --shipitfile ${shipitFile} test ls-current`,
3334
)
3435

3536
const currentRelease = lsCurrent
36-
.split('\n')[3]
37+
.split('\n')
38+
.filter(s => s.match(/^@localhost/))[0]
3739
.match(/releases\/(\d{14})/)[1]
3840

3941
expect(latestRelease).toBe(currentRelease)

packages/shipit-deploy/tests/sandbox/shipitfile.babel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ export default shipit => {
66

77
shipit.initConfig({
88
default: {
9-
key: './ssh/id_rsa',
9+
key: '/home/travis/.ssh/id_rsa',
1010
workspace: '/tmp/shipit-workspace',
1111
deployTo: '/tmp/shipit',
1212
repositoryUrl: 'https://github.com/shipitjs/shipit.git',
1313
ignores: ['.git', 'node_modules'],
1414
shallowClone: true,
1515
},
1616
test: {
17-
servers: 'deploy@test.shipitjs.com',
17+
servers: 'travis@localhost',
1818
},
1919
})
2020

packages/ssh-pool/tests/integration.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ describe('ssh-pool', () => {
77
let pool
88

99
beforeEach(() => {
10-
pool = new sshPool.ConnectionPool(['deploy@test.shipitjs.com'], {
11-
key: resolve(__dirname, '../../../ssh/id_rsa'),
10+
pool = new sshPool.ConnectionPool(['travis@localhost'], {
11+
key: resolve(__dirname, '/home/travis/.ssh/id_rsa'),
1212
})
1313
})
1414

1515
it('should run a command remotely', async () => {
1616
const [{ stdout }] = await pool.run('hostname')
17-
expect(stdout).toBe('shipit-test\n')
17+
expect(stdout).toMatch(/travis-job-/)
1818
}, 10000)
1919

2020
it('should escape command properly', async () => {
2121
const [{ stdout: first }] = await pool.run('echo $USER')
22-
expect(first).toBe('deploy\n')
22+
expect(first).toBe('travis\n')
2323

2424
const [{ stdout: second }] = await pool.run("echo '$USER'")
2525
expect(second).toBe('$USER\n')

ssh/id_rsa

Lines changed: 0 additions & 27 deletions
This file was deleted.

ssh/id_rsa.pub

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)