Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1fe85ca
Merge pull request #18 from phovea/release-2.2.0
thinkh Aug 27, 2019
f51d3f1
changes for version v2.2.0
steiner-anita Aug 29, 2019
9c71b9c
Update node-sass to ^4.12.0
rumersdorfer Nov 15, 2019
4c8b008
Update node-sass to ^4.12.0 (#20)
thinkh Nov 15, 2019
5254438
Add TS compiler flags for i18n to tsconfig.json
rumersdorfer Dec 12, 2019
6fe97cb
Using generator-phovea v3.0.0
thinkh Dec 12, 2019
0c2288b
Add TS compiler flags for i18n to tsconfig.json (#21)
thinkh Dec 17, 2019
35f8d5c
Ignore package-lock.json
rumersdorfer Jan 7, 2020
5b0705b
Merge pull request #24 from phovea/rumersdorfer-patch-1
Jan 9, 2020
8bf812b
Merge branch 'thinkh/22_update-dependencies' into python_3.7
dvvanessastoiber Jan 9, 2020
1e80751
update requirements for python 3.7
dvvanessastoiber Jan 9, 2020
0763065
use `circleci/python:3.7-buster-node-browsers` as
dvvanessastoiber Jan 9, 2020
608a430
Replace python tests with `py37`in_tox.ini_
dvvanessastoiber Jan 9, 2020
a58c966
Update python setup.py classifiers to Python 3.7
dvvanessastoiber Jan 9, 2020
c2ad735
Remove `.encode('ascii')` from _setup.py_
dvvanessastoiber Jan 9, 2020
86025b0
use `destination` instead of removed `prefix`
dvvanessastoiber Jan 9, 2020
bc913d1
Use python:3.7 as base Docker image in Dockerfile
dvvanessastoiber Jan 9, 2020
48821e5
update `TOXENV` in _.travis.yml_
dvvanessastoiber Jan 9, 2020
3108a8c
use lib2to3 to convert to new syntax
dvvanessastoiber Jan 9, 2020
7992d73
Merge branch 'develop' into python_3.7
Jan 9, 2020
c6850e9
Merge pull request #25 from phovea/python_3.7
Jan 9, 2020
d78eb6c
Update webpack.config.js
Jan 9, 2020
1aabb06
Merge pull request #26 from phovea/anita-steiner-patch-1
puehringer Jan 9, 2020
6278236
Prepare release 3.0.0
dvvanessastoiber Jan 13, 2020
696f208
Remove .travis.yml and .gitlab-ci.yml
dvvanessastoiber Jan 13, 2020
fb88d14
update celery version
dvvanessastoiber Jan 13, 2020
c18ee1d
fix flake8
dvvanessastoiber Jan 13, 2020
c1e9af8
update doc file
dvvanessastoiber Jan 13, 2020
1d104f9
update tslint and webpack config
dvvanessastoiber Jan 13, 2020
e9cc008
update npm scripts
dvvanessastoiber Jan 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
version: 2
jobs:
build:
working_directory: ~/phovea
docker:
- image: circleci/python:3.7-buster-node-browsers # for node version see Dockerfile on https://hub.docker.com/r/circleci/python
steps:
- checkout
- run:
name: Show Node.js and npm version
command: |
node -v
npm -v
- run:
name: Show Python and pip version
command: |
python --version
pip --version
- run:
name: Install Docker packages from docker_packages.txt
command: |
(!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs sudo apt-get install -y))
- restore_cache:
key: deps2-{{ .Branch }}-{{ checksum "package.json" }}
- run:
name: Install npm dependencies
command: npm install
- run:
name: Remove npm dependencies installed from git repositories (avoid caching of old commits)
command: |
(grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf
- save_cache:
key: deps2-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Install npm dependencies from git repositories (always get latest commit)
command: npm install
- run:
name: Show installed npm dependencies
command: npm list --depth=1 || true
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }}
- run:
name: Install pip requirements
command: |
virtualenv ~/venv
. ~/venv/bin/activate
pip install -r requirements_dev.txt
pip install -r requirements.txt
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }}
paths:
- ~/venv
- run:
name: Force an update of pip dependencies from git repositories # not sure if this is working ?
command: |
. ~/venv/bin/activate
pip install --upgrade --upgrade-strategy=only-if-needed -r requirements.txt
- run:
name: Show installed pip packages
command: pip list || true
- run:
name: Build
command: |
. ~/venv/bin/activate
npm run dist
- store_artifacts:
path: dist
destination: dist
workflows:
version: 2
# build-nightly:
# triggers:
# - schedule:
# cron: "15 1 * * 1-5" # "At 01:15 on every day-of-week from Monday through Friday.”, see: https://crontab.guru/#15_1_*_*_1-5
# filters:
# branches:
# only:
# - develop
# jobs:
# - build
build-branch:
jobs:
- build:
filters:
tags:
ignore: /^v.*/
build-tag:
jobs:
- build:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ node_modules/
/tests/**/*.js
*.map
*.css
/.cache-loader
package-lock.json
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
"unknown": {
"requirements": [],
"dockerPackages": []
},
"promptValues": {
"authorName": "The Caleydo Team",
"authorEmail": "contact@caleydo.org",
"authorUrl": "https://caleydo.org",
"githubAccount": "phovea"
}
}
}
29 changes: 13 additions & 16 deletions buildInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
* Created by sam on 13.11.2016.
*/


const spawnSync = require('child_process').spawnSync;
const path = require('path');
const resolve = path.resolve;
const fs = require('fs');


function dependencyGraph(cwd) {
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const r = spawnSync(npm, ['ls', '--prod', '--json'], {
Expand Down Expand Up @@ -37,7 +35,7 @@ function gitHead(cwd) {

function resolveModules() {
const reg = fs.readFileSync('../phovea_registry.js').toString();
const regex = /import '(.*)\/phovea_registry.js'/g;
const regex = /^import '(.*)\/phovea_registry.js'/gm;
const modules = [];
let r;
while ((r = regex.exec(reg)) !== null) {
Expand All @@ -55,19 +53,20 @@ function resolveWorkspace() {
const workspaceDeps = dependencyGraph('..').dependencies;
const modules = new Set(resolveModules());

let deps = null;
const resolveModule = (m) => {
console.log('resolve', m);
const pkg = require(`../${m}/package.json`);
const pkg = JSON.parse(fs.readFileSync(`../${m}/package.json`).toString());
const head = gitHead('../' + m);
const repo = pkg.repository.url;
return {
name: pkg.name,
version: pkg.version,
resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length-4) : repo}/commit/${head}` : pkg.version,
resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length - 4) : repo}/commit/${head}` : pkg.version,
dependencies: deps(pkg.dependencies)
};
};
const deps = (deps) => {
deps = (deps) => {
const r = {};
Object.keys(deps).forEach((d) => {
if (d in workspaceDeps) {
Expand Down Expand Up @@ -121,59 +120,57 @@ function generate() {
const isWorkspaceContext = fs.existsSync('../phovea_registry.js');
if (isWorkspaceContext) {
return resolveWorkspace();
} else {
return resolveSingle();
}
return resolveSingle();
}


const IS_WINDOWS = process.platform === 'win32';

function tmpdir() {
if (IS_WINDOWS) {
return process.env.TEMP || process.env.TMP ||
(process.env.SystemRoot || process.env.windir) + '\\temp';
} else {
return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp';
(process.env.SystemRoot || process.env.windir) + '\\temp';
}
return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp';
}

function resolveScreenshot() {
const f = resolve(__dirname, 'media/screenshot.png');
if (!fs.existsSync(f)) {
return null;
}
const buffer = new Buffer(fs.readFileSync(f)).toString('base64');
const buffer = Buffer.from(fs.readFileSync(f)).toString('base64');
return `data:image/png;base64,${buffer}`;
}

function metaData(pkg) {
pkg = pkg || require(`./package.json`);
return {
name: pkg.name,
displayName: pkg.displayName,
version: pkg.version,
repository: pkg.repository.url,
homepage: pkg.homepage,
description: pkg.description,
screenshot: resolveScreenshot()
};
}

module.exports.metaData = metaData;
module.exports.metaDataTmpFile = function(pkg) {
module.exports.metaDataTmpFile = function (pkg) {
const s = metaData(pkg);
const file = `${tmpdir()}/metaData${Math.random().toString(36).slice(-8)}.txt`;
fs.writeFileSync(file, JSON.stringify(s, null, ' '));
return file;
};
module.exports.generate = generate;
module.exports.tmpFile = function() {
module.exports.tmpFile = function () {
const s = generate();
const file = `${tmpdir()}/buildInfo${Math.random().toString(36).slice(-8)}.txt`;
fs.writeFileSync(file, JSON.stringify(s, null, ' '));
return file;
};


if (require.main === module) {
fs.writeFile('deps.json', JSON.stringify(generate(), null, ' '));
}
69 changes: 69 additions & 0 deletions buildPython.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Created by sam on 13.11.2016.
*/

const spawnSync = require('child_process').spawnSync;
const fs = require('fs');

function gitHead(cwd) {
const r = spawnSync('git', ['rev-parse', '--verify', 'HEAD'], {
cwd: cwd
});
if (!r.stdout) {
console.error(cwd, r.error);
return 'error';
}
return r.stdout.toString().trim();
}

function resolvePlugin(repo, version) {
if (fs.lstatSync('.git').isDirectory() && repo) {
if (repo.endsWith('.git')) {
repo = repo.slice(0, repo.length - 4);
return repo + '/commit/' + gitHead('.');
}
}
// not a git repo
return version;
}

function toVersion(v) {
const now = new Date().toISOString();
// %Y%m%d-%H%M%S
const fmt = now
.replace(/T/, ' ')
.replace(/\..+/, '')
.replace(/[-:]/, '')
.replace(' ', '-');
return v.replace('SNAPSHOT', fmt);
}

function _main() {
const pkg = require('./package.json');
const name = pkg.name;
const version = toVersion(pkg.version);
const resolved = resolvePlugin((pkg.repository || {}).url, version);

const buildInfo = {
name,
version,
resolved,
description: pkg.description,
homepage: pkg.homepage,
repository: (pkg.repository || {}).url
};

const l = ('build/source/' + name.toLowerCase()).split('/');
l.forEach((_, i) => {
const path = l.slice(0, i + 1).join('/');
if (!fs.existsSync(path)) {
fs.mkdirSync(path);
}
});

fs.writeFileSync('build/source/' + name.toLowerCase() + '/buildInfo.json', JSON.stringify(buildInfo, null, ' '));
}

if (require.main === module) {
_main();
}
14 changes: 9 additions & 5 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
FROM caleydo/phovea_python:v1.0
FROM python:3.7

MAINTAINER Samuel Gratzl <samuel.gratzl@datavisyn.io>
LABEL maintainer="contact@caleydo.org"
WORKDIR /phovea
RUN printf "from phovea_server import launch\nlaunch.run()\n" > ./launch.py
RUN printf "from phovea_server import launch\nlaunch.run()\n" > /phovea/launch.py

# install dependencies last step such that everything before can be cached
COPY requirements*.txt docker_packages.txt ./
RUN (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs apt-get install -y)) && pip install --no-cache-dir -r requirements.txt
COPY requirements*.txt docker_packages.txt docker_script*.sh ./
RUN (!(test -s docker_packages.txt) || (apt-get update && \
(cat docker_packages.txt | xargs apt-get install -y))) && \
(pip install --no-cache-dir -r requirements.txt)
RUN (!(test -f docker_script.sh) || (bash ./docker_script.sh))

COPY ./build/source ./

ENV PHOVEA_ENV=production
ENV PHOVEA_SERVICE=celery
ENV PHOVEA_CONFIG_PATH=config.json
CMD python launch.py --env ${PHOVEA_ENV} ${PHOVEA_SERVICE}
EXPOSE 80
11 changes: 7 additions & 4 deletions deploy/Dockerfile_dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM caleydo/phovea_python:v1.0-dev
FROM python:3.7

MAINTAINER Samuel Gratzl <samuel.gratzl@datavisyn.io>
LABEL maintainer="contact@caleydo.org"
WORKDIR /phovea

# install dependencies last step such that everything before can be cached
COPY requirements*.txt docker_packages.txt ./
RUN (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs apt-get install -y)) && pip install --no-cache-dir -r requirements.txt && (pip install --no-cache-dir -r requirements_dev.txt)
COPY requirements*.txt docker_packages.txt docker_script*.sh ./
RUN (!(test -f docker_packages.txt) || (apt-get -y update && cat docker_packages.txt | xargs apt-get install -y)) && \
pip install --no-cache-dir -r requirements.txt && \
(pip install --no-cache-dir -r requirements_dev.txt)
RUN (!(test -f docker_script.sh) || bash ./docker_script.sh)

ENV PHOVEA_ENV=dev
ENV PHOVEA_SERVICE=celery
Expand Down
Loading