Skip to content

Commit

Permalink
Merge pull request #2634 from kbase/develop
Browse files Browse the repository at this point in the history
Merging up for 5.0.0 release
  • Loading branch information
briehl authored Dec 9, 2021
2 parents 52de0e2 + 57b8c3d commit 38fe8e1
Show file tree
Hide file tree
Showing 543 changed files with 85,812 additions and 73,482 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

8 changes: 5 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[flake8]
# https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/
ignore = E203, E266, E501, W503, F403, F401, E402, C901
# max-line-length = 79
# max-complexity = 15
select = B,C,E,F,W,T4,B9
exclude =
./test/selenium_scripts/
.git,
.github,
deployment,
docs,
node_modules
23 changes: 23 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: no

github_checks:
annotations: false
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* List any dependencies that are required for this change.

# Jira Ticket / Issue #
e.g. https://kbase-jira.atlassian.net/browse/DATAUP-X

Related Jira ticket: https://kbase-jira.atlassian.net/browse/DATAUP-X
- [ ] Added the Jira Ticket to the title of the PR (e.g. `DATAUP-69 Adds a PR template`)

# Testing Instructions
Expand All @@ -22,9 +23,9 @@ e.g. https://kbase-jira.atlassian.net/browse/DATAUP-X
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] (JavaScript) I have run Prettier and ESLint on changed code manually or with a git precommit hook
- [ ] (Python) I have run Black and Flake8 on changed Python code manually or with a git precommit hook
- [ ] Any dependent changes have been merged and published in downstream modules

# Updating Version and Release Notes (if applicable)

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ jobs:
auto-update-conda: true
condarc-file: test/condarc.yml

- name: Use Node JS 14.x
- name: Use Node JS 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 16.x

- name: Install JS dependencies
run: |
npm ci
npm install bower
./node_modules/bower/bin/bower install
npm run install-npm
- name: Install Narrative Application
shell: bash -l {0}
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ jobs:
auto-update-conda: true
condarc-file: test/condarc.yml

- name: Use Node JS 14.x
uses: actions/setup-node@v1
- name: Use Node JS 16.x
uses: actions/setup-node@v2.1.2
with:
node-version: 14.x
node-version: 16.x

- name: Install JS dependencies
run: |
npm ci
npm install bower
./node_modules/bower/bin/bower install
npm run install-npm
- name: Install Narrative Application
shell: bash -l {0}
Expand All @@ -37,25 +36,36 @@ jobs:
sed -i 's/{{ if ne .Env.CONFIG_ENV "prod" }} true {{- else }} false {{- end }}/true/' src/config.json
jupyter notebook --version
- name: Set up environment vars
run: |
echo "KBASE_TEST_TOKEN=${{ secrets.NARRATIVE_TEST_TOKEN }}" >> $GITHUB_ENV
- name: Run Narrative Backend Tests
id: test_backend
shell: bash -l {0}
run: make test-backend
continue-on-error: true

- name: Run Narrative Frontend Unit Tests
id: test_frontend
shell: bash -l {0}
run: make test-frontend-unit

- name: make test output available as artifact in case of failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: karma-result.json
path: karma-result.json
continue-on-error: true

- name: Send to Codecov
id: send_to_codecov
uses: codecov/[email protected]
continue-on-error: true
with:
file: |
./python-coverage/coverage.xml
./js-coverage/lcov/lcov.info
fail_ci_if_error: true

- name: outcome
if: steps.test_backend.outcome != 'success' || steps.test_frontend.outcome != 'success' || steps.send_to_codecov.outcome != 'success'
run: |
echo "backend tests: ${{ steps.test_backend.outcome }}"
echo "frontend tests: ${{ steps.test_frontend.outcome }}"
echo "upload coverage: ${{ steps.send_to_codecov.outcome }}"
exit 1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ my_narrative_venv/
narrative_venv/
new_narrative_env_2/
js-coverage
python-coverage/
cover
_attic

Expand Down Expand Up @@ -104,4 +105,4 @@ target/
.idea

# For yarn users
yarn.lock
yarn.lock
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run husky_msg && npx lint-staged && npm run compile_css
3 changes: 1 addition & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

#npm run husky_msg && npm run prettier_check
npx lint-staged
npm run update_browserslist
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ kbase-extension/static/ext_modules
kbase-extension/static/kbase/js/patched-components
node_modules
cover
venv
venv
41 changes: 41 additions & 0 deletions .stylelintrc.css.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-no-indistinguishable-colors",
"stylelint-color-format"
],
"rules": {
"color-named": "never",
"color-no-hex": true,
"color-format/format": {
"format": "rgb"
},
"color-function-notation": "modern",
"declaration-block-no-redundant-longhand-properties": true,
"font-family-name-quotes": "always-where-recommended",
"font-family-no-missing-generic-family-keyword": [
true,
{
"ignoreFontFamilies": ["FontAwesome", "Glyphicons Halflings", "kbase-icons"]
}
],
"length-zero-no-unit": true,
"no-descending-specificity": null,
"plugin/stylelint-no-indistinguishable-colors": false,
"selector-max-compound-selectors": 5,
"selector-max-class": 5,
"selector-no-qualifying-type": [
true,
{
"ignore": ["attribute", "class"]
}
],
"shorthand-property-no-redundant-values": true
},
"ignoreFiles": [
"kbase-extension/static/ext_components/**/*.css",
"kbase-extension/static/ext_packages/**/*.css",
"kbase-extension/static/kbase/js/patched-components/**/*.css",
"docs/**/*.css"
]
}
60 changes: 60 additions & 0 deletions .stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
extends:
- stylelint-config-standard
- stylelint-config-sass-guidelines

plugins:
- stylelint-color-format
- stylelint-scss
# - stylelint-no-indistinguishable-colors

ignoreFiles:
- kbase-extension/static/**/*.{less,scss,css}

rules:
color-named: never
color-no-hex: true
color-format/format:
format: rgb
color-function-notation: modern
declaration-block-no-redundant-longhand-properties: true
declaration-block-no-shorthand-property-overrides: true
font-family-no-missing-generic-family-keyword:
- true
- ignoreFontFamilies:
- FontAwesome
- "Glyphicons Halflings"
- kbase-icons
function-url-quotes: never
length-zero-no-unit: true
max-nesting-depth: 10
no-descending-specificity: null
# set to true to enable
# plugin/stylelint-no-indistinguishable-colors: false
selector-class-pattern: null
selector-max-compound-selectors: 5
selector-max-class: 5
selector-max-id: 1
selector-no-qualifying-type:
- true
- ignore:
- attribute
- class
shorthand-property-no-redundant-values: true
unit-allowed-list:
- [em, px, rem, "%"]
- ignoreProperties:
x:
- background-image
s:
- transition
deg:
- background
value-keyword-case:
- lower
- ignoreKeywords: [
/^\$/
]
- ignoreProperties: [
"/^font.*/",
url
]
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,22 @@ ARG SKIP_MINIFY

EXPOSE 8888

# install NodeJS 16.x (latest LTS until ~October 2022, https://nodejs.org/en/about/releases/)
RUN \
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && \
sudo apt-get install -y nodejs

# install pyopenssl cryptography idna and requests is the same as installing
# requests[security]
RUN source activate base && \
conda install -c conda-forge ndg-httpsclient==0.5.1 pyasn1==0.4.5 pyopenssl==19.0.0 cryptography==2.7 idna==2.8 requests==2.21.0 \
beautifulsoup4==4.8.1 html5lib==1.0.1
conda install -c conda-forge ndg-httpsclient==0.5.1 \
pyasn1==0.4.5 \
pyopenssl==19.0.0 \
cryptography==2.7 \
idna==2.8 \
requests==2.21.0 \
beautifulsoup4==4.8.1 \
html5lib==1.0.1

# Copy in the narrative repo
ADD ./ /kb/dev_container/narrative
Expand All @@ -40,8 +51,7 @@ RUN \
./src/scripts/kb-update-config -f src/config.json.templ -o /kb/deployment/ui-common/narrative_version && \
# install JS deps
npm install -g grunt-cli && \
npm install && \
./node_modules/.bin/bower install --allow-root --config.interactive=false && \
npm install && npm run install-npm && \
# Compile Javascript down into an itty-bitty ball unless SKIP_MINIFY is non-empty
echo Skip=$SKIP_MINIFY && \
[ -n "$SKIP_MINIFY" ] || npm run minify && \
Expand Down
40 changes: 39 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const crypto = require('crypto');

module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-regex-replace');
require('load-grunt-tasks')(grunt);

grunt.initConfig({
// This inserts the reference to the compiled, minified JS file into page.html at
Expand All @@ -23,5 +23,43 @@ module.exports = function (grunt) {
],
},
},

// Run CSS / SCSS-related tasks
// these files are modified in place
postcss: {
// autoprefix and minify the concatenated css files
concat: {
options: {
processors: [
// add vendor prefixes
require('autoprefixer')(),
// minify
require('cssnano')([
'default',
{
normalizeWhitespace: {
exclude: true,
},
},
]),
],
},
src: ['kbase-extension/static/kbase/css/all_concat.css'],
},
},

// runs the npm command to compile scss -> css and run autoprefixer on it
shell: {
compile_css: {
command: 'npm run compile_css',
},
},

// watch scss files for any changes
// when they change, regenerate the compiled css files
watch: {
files: 'kbase-extension/scss/**/*.scss',
tasks: ['shell:compile_css'],
},
});
};
Loading

0 comments on commit 38fe8e1

Please sign in to comment.