Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Deploy hashed assets to EU and US
Browse files Browse the repository at this point in the history
 🐿 v2.5.16
  • Loading branch information
adgad committed Nov 21, 2017
1 parent 0d944a2 commit ccda05e
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 107 deletions.
198 changes: 99 additions & 99 deletions config/nightwatch.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
{
"src_folders": ["test/browser/tests"],
"output_folder": "./test/browser/reports",
"globals_path": "./node_modules/@financial-times/n-heroku-tools/config/nightwatch-globals.js",
"custom_commands_path": "./node_modules/@financial-times/n-heroku-tools/config/nightwatch-commands",
"test_workers": true,
"test_settings": {
"default": {
"end_session_on_fail": false,
"launch_url": "${TEST_URL}",
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"screenshots": {
"enabled": true,
"on_failure" : true,
"path": "./test/browser/screenshots"
},
"username": "${SAUCE_USER}",
"access_key": "${SAUCE_KEY}",
"desiredCapabilities": {
"browserName": "chrome",
"version": "latest",
"platform": "Windows 10"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"version": "latest",
"platform": "Windows 10"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"version": "latest",
"platform": "Windows 10"
}
},
"edge": {
"desiredCapabilities": {
"browserName": "MicrosoftEdge",
"version": "13.10586",
"platform": "Windows 10"
}
},
"ie11": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "11.0",
"platform": "Windows 8.1"
}
},
"ie10": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "10.0",
"platform": "Windows 8"
}
},
"ie9": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "9.0",
"platform": "Windows 7"
}
},
"ie8": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "8.0",
"platform": "Windows 7"
}
},
"safari": {
"desiredCapabilities": {
"browserName": "safari",
"version": "latest",
"platform": "OS X 10.11"
}
},
"iphone6_plus": {
"desiredCapabilities": {
"browserName": "Safari",
"deviceName": "iPhone 6 Plus",
"platformVersion": "9.3",
"platformName": "iOS",
"deviceOrientation": "portrait"
}
},
"Android_Nexus7HD": {
"desiredCapabilities": {
"browserName": "Browser",
"deviceName": "Google Nexus 7 HD Emulator",
"platformVersion": "4.4",
"platformName": "Android",
"deviceOrientation": "portrait"
}
}
}
"src_folders": ["test/browser/tests"],
"output_folder": "./test/browser/reports",
"globals_path": "./node_modules/@financial-times/n-heroku-tools/config/nightwatch-globals.js",
"custom_commands_path": "./node_modules/@financial-times/n-heroku-tools/config/nightwatch-commands",
"test_workers": true,
"test_settings": {
"default": {
"end_session_on_fail": false,
"launch_url": "${TEST_URL}",
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"screenshots": {
"enabled": true,
"on_failure" : true,
"path": "./test/browser/screenshots"
},
"username": "${SAUCE_USER}",
"access_key": "${SAUCE_KEY}",
"desiredCapabilities": {
"browserName": "chrome",
"version": "latest",
"platform": "Windows 10"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"version": "latest",
"platform": "Windows 10"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"version": "latest",
"platform": "Windows 10"
}
},
"edge": {
"desiredCapabilities": {
"browserName": "MicrosoftEdge",
"version": "13.10586",
"platform": "Windows 10"
}
},
"ie11": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "11.0",
"platform": "Windows 8.1"
}
},
"ie10": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "10.0",
"platform": "Windows 8"
}
},
"ie9": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "9.0",
"platform": "Windows 7"
}
},
"ie8": {
"desiredCapabilities": {
"browserName": "internet explorer",
"version": "8.0",
"platform": "Windows 7"
}
},
"safari": {
"desiredCapabilities": {
"browserName": "safari",
"version": "latest",
"platform": "OS X 10.11"
}
},
"iphone6_plus": {
"desiredCapabilities": {
"browserName": "Safari",
"deviceName": "iPhone 6 Plus",
"platformVersion": "9.3",
"platformName": "iOS",
"deviceOrientation": "portrait"
}
},
"Android_Nexus7HD": {
"desiredCapabilities": {
"browserName": "Browser",
"deviceName": "Google Nexus 7 HD Emulator",
"platformVersion": "4.4",
"platformName": "Android",
"deviceOrientation": "portrait"
}
}
}
}
4 changes: 2 additions & 2 deletions ft.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
owner:
github: wheresrhys
email: [email protected]
github: wheresrhys
email: [email protected]
17 changes: 11 additions & 6 deletions tasks/deploy-hashed-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ function task (opts) {
region
});

const s3bucket = new aws.S3({ params: { Bucket: bucket } });
const s3EUBucket = new aws.S3({ params: { Bucket: bucket } });
const s3USBucket = new aws.S3({ params: { Bucket: usBucket } });

function upload (params) {

function upload (bucket, params) {
return new Promise((resolve, reject) => {
return s3bucket.upload(params, (err, data) => {
return bucket.upload(params, (err, data) => {
if (err) {
console.error('Upload failed', err); // eslint-disable-line no-console
console.error(`Upload failed to ${bucket}`, err); // eslint-disable-line no-console
reject(err);
} else {
console.log('Upload success', data); // eslint-disable-line no-console
console.log(`Upload success to ${bucket}`, data); // eslint-disable-line no-console
resolve();
}
});
Expand Down Expand Up @@ -105,7 +107,10 @@ function task (opts) {
params.ContentType = 'text/css; charset=utf-8';
break;
}
return upload(params)
return Promise.all([
upload(s3EUBucket, params),
upload(s3USBucket, params)
])
.then(() => Promise.all([
waitForOk(`http://${bucket}.s3-website-${region}.amazonaws.com/${key}`),
waitForOk(`http://${usBucket}.s3-website-${usRegion}.amazonaws.com/${key}`),
Expand Down

0 comments on commit ccda05e

Please sign in to comment.