Skip to content

Commit

Permalink
Automated builds (#6)
Browse files Browse the repository at this point in the history
* Automated builds

* Switched to Javascript Standard Style

* Reverted Dockerfile changes
  • Loading branch information
austinpray authored and Algram committed Sep 23, 2018
1 parent 1ddf886 commit 7782ce3
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: generic
services: docker

before_script:
- docker build -t $DOCKER_TAG .

script:
- docker run -d -p 3000:3000 --name ytdl $DOCKER_TAG
- sleep 10; ./test/e2e.js

deploy:
provider: script
script: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && docker push $DOCKER_TAG
on:
branch: master
45 changes: 45 additions & 0 deletions test/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env node

const http = require('http')
const querystring = require('querystring')

const postData = querystring.stringify({
'url': 'https://www.youtube.com/watch?v=qNf9nzvnd1k'
})

const req = http.request(
{
host: 'localhost',
port: '3000',
path: '/download',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
},
(res) => {
const { statusCode } = res

res.on('data', (chunk) => {
console.log(`BODY: ${chunk}`)
})

res.on('end', () => {
console.log('No more data in response.')

if (statusCode !== 200) {
console.log(`Got status ${statusCode}`)
process.exit(1)
}

console.log('Yay it works')
})
}
).on('error', (e) => {
console.error(`Got error: ${e.message}`)
process.exit(1)
})

req.write(postData)
req.end()

0 comments on commit 7782ce3

Please sign in to comment.