Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
save builds to artifacts on appveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Blackman committed Sep 25, 2015
1 parent 73a4c0e commit 1c9231d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ coverage/
*.asar
*.log

download.txt
exit.code
test.coffee
test.sh
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ test_script:
- npm run appveyor
on_success:
- '.\\coveralls.bat'
- npm run build-artifact
artifacts:
- path: mocha.log
name: Mocha log
- path: download.txt
name: Download Build (link within text file)
# cache:
# - node_modules -> package.json
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "./node_modules/.bin/gulp test",
"appveyor": "./node_modules/.bin/gulp test --appveyor",
"build": "./node_modules/.bin/gulp build",
"postinstall": "./node_modules/.bin/gulp setup"
"postinstall": "./node_modules/.bin/gulp setup",
"build-artifact": "./node_modules/.bin/gulp build-artifact"
},
"repository": {
"type": "git",
Expand Down
53 changes: 53 additions & 0 deletions tasks/artifacts.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cheerio = require 'cheerio'
fs = require 'fs-extra'
glob = require 'glob'
gulp = require 'gulp'
request = require 'request'
runSequence = require 'run-sequence'
path = require 'path'

gulp.task 'build-artifact:osx', ->
runSequence(
'package-asar'
'compile:osx'
'zip:osx'
'upload-artifcat'
)

gulp.task 'build-artifact:win', ->
runSequence(
'package-asar'
'compile:win'
'zip:win'
'upload-artifcat'
)

gulp.task 'build-artifact', (cb) ->
if process.platform == 'win32'
return runSequence('build-artifact:win', cb)
else
return runSequence('build-artifact:osx', cb)

gulp.task 'upload-artifcat', (cb) ->
commit = process.env.APPVEYOR_REPO_COMMIT or process.env.TRAVIS_COMMIT or 'NO_COMMIT'
file = glob.sync('./releases/*.zip')[0]
file_name = "Championify-#{process.platform}-#{commit}.zip"

upload_file = path.join('./releases', file_name)
fs.move file, upload_file, ->
options = {
method: 'POST'
url: 'http://www92.zippyshare.com/upload'
headers: {
Referer: 'http://www.zippyshare.com/sites/index_old.jsp'
}
}

console.log('Uploading file...')
req = request options, (err, res, body) ->
$c = cheerio.load(body)
download_url = $c('.text_field').val()
fs.writeFile './download.txt', download_url, {encoding: 'utf8'}, cb

form = req.form()
form.append('file', fs.createReadStream(upload_file))
2 changes: 1 addition & 1 deletion tasks/tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mochaWindows = (cb) ->
options.env.NODE_ENV = 'test'
options.env.ELECTRON_PATH = "#{path.resolve('./node_modules/.bin/electron')}.cmd"
options.env.EXITCODE_PATH = path.join process.cwd(), 'exit.code'
options.env.MOCHA_LOG = path.join(__dirname, '..', 'mocha.log')
# options.env.MOCHA_LOG = path.join(__dirname, '..', 'mocha.log')

if _.contains(process.argv, '--appveyor')
console.log('Note: You can\'t see Mocha test results in AppVeyor due to how Windows spawns processes.')
Expand Down

0 comments on commit 1c9231d

Please sign in to comment.