-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from cortex-lab/py_ci
Python CI
- Loading branch information
Showing
31 changed files
with
63,411 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea/* | ||
.DS_Store | ||
node_modules/* | ||
.env | ||
.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: node_js | ||
node_js: 12 | ||
env: | ||
- NODE_ENV=test | ||
branches: | ||
only: | ||
- master | ||
jobs: | ||
include: | ||
- name: "windows" | ||
os: windows | ||
env: NODE_ENV=test DOTENV_CONFIG_PATH=.\\test\\fixtures\\.env.test | ||
- name: "linux" | ||
os: linux | ||
env: NODE_ENV=test DOTENV_CONFIG_PATH=./test/fixtures/.env.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const userSettings = require('./settings.json') || {}; // User settings | ||
const path = require('path'); | ||
env = process.env.NODE_ENV || 'production'; | ||
const appdata = process.env.APPDATA || process.env.HOME; | ||
const dataPath = process.env.APPDATA? path.join(appdata, 'CI') : path.join(appdata, '.ci'); | ||
const fixtureDir = path.resolve(__dirname, '..', 'test', 'fixtures'); | ||
const dbFilename = '.db.json'; | ||
let settings; | ||
|
||
// Defaults for when there's no user file; will almost certainly fail | ||
defaults = { | ||
setup_function: null, | ||
test_function: null, | ||
listen_port: 3000, | ||
timeout: 8*60000, | ||
program: "python", | ||
strict_coverage: false, | ||
events: { | ||
push: { | ||
checks: null, | ||
ref_ignore: ["documentation", "gh-pages"] | ||
}, | ||
pull_request: { | ||
checks: ["continuous-integration", "coverage"], | ||
actions: ["opened", "synchronize", "reopen"], | ||
ref_ignore: ["documentation", "gh-pages"] | ||
} | ||
}, | ||
dataPath: dataPath, | ||
dbFile: path.join(dataPath, dbFilename) | ||
} | ||
|
||
// Settings for the tests | ||
testing = { | ||
listen_port: 3000, | ||
timeout: 60000, | ||
setup_function: 'prep_env.BAT', | ||
test_function: "run_tests.BAT", | ||
events: { | ||
push: { | ||
checks: "continuous-integration", | ||
ref_ignore: "documentation" | ||
}, | ||
pull_request: { | ||
checks: ["coverage", "continuous-integration"], | ||
actions: ["opened", "synchronize"], | ||
ref_ignore: ["documentation", "gh-pages"] | ||
} | ||
}, | ||
dataPath: fixtureDir, | ||
dbFile: path.join(fixtureDir, dbFilename) // cache of test results | ||
} | ||
|
||
// Pick the settings to return | ||
if (env.startsWith('test')) { | ||
settings = testing; | ||
} else if (userSettings) { | ||
settings = userSettings; | ||
if (!('dbFile' in settings)) { | ||
settings.dbFile = path.join(dataPath, dbFilename) | ||
} | ||
if (!('dataPath' in settings)) { | ||
settings.dataPath = dataPath; | ||
} | ||
} else { | ||
settings = defaults; | ||
} | ||
|
||
// Check ENV set up correctly | ||
required = ['GITHUB_PRIVATE_KEY', 'GITHUB_APP_IDENTIFIER', 'GITHUB_WEBHOOK_SECRET', | ||
'WEBHOOK_PROXY_URL', 'REPO_PATH', 'REPO_NAME', 'REPO_OWNER', 'TUNNEL_HOST', | ||
'TUNNEL_SUBDOMAIN']; | ||
missing = required.filter(o => { return !process.env[o] }); | ||
if (missing.length > 0) { | ||
errMsg = `Env not set correctly; the following variables not found: \n${missing.join(', ')}` | ||
throw ReferenceError(errMsg) | ||
} | ||
|
||
module.exports = { settings } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"setup_function": "prep_env.BAT", | ||
"test_function": "run_tests.BAT", | ||
"listen_port": 3000, | ||
"timeout": 480000, | ||
"program": "python", | ||
"strict_coverage": false, | ||
"events": { | ||
"push": { | ||
"checks": null, | ||
"ref_ignore": ["documentation", "gh-pages"] | ||
}, | ||
"pull_request": { | ||
"checks": ["continuous-integration", "coverage"], | ||
"actions": ["opened", "synchronize", "reopened"], | ||
"ref_ignore": ["documentation", "gh-pages"] | ||
} | ||
} | ||
} |
Oops, something went wrong.