Skip to content

Commit

Permalink
Merge branch 'main' into chore/utility-bar-icons-animation
Browse files Browse the repository at this point in the history
  • Loading branch information
rashidakanchwala authored Jul 6, 2022
2 parents 565e9a8 + 21f4534 commit 360ccc1
Show file tree
Hide file tree
Showing 4 changed files with 395 additions and 372 deletions.
384 changes: 14 additions & 370 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,377 +1,21 @@
version: 2.1

# add parameters
setup: true

orbs:
win: circleci/[email protected]

# No windows executor is listed here since windows builds use win/default and modify
# the Python version through the conda environment.
executors:
docker:
parameters:
python_version:
type: string
docker:
- image: cimg/python:<<parameters.python_version>>-node
working_directory: ~/repo

commands:
setup_python_env:
steps:
- run:
name: Install Python dependencies
command: |
pip install git+https://github.com/kedro-org/kedro@main
pip install -r package/test_requirements.txt -U
- run:
name: Echo package versions
command: |
python -V
pip freeze
install_node_dependencies:
steps:
- run:
name: Install Node dependencies
command: npm install

npm_build:
steps:
- run:
name: Build React application
command: make build

python_package:
steps:
- run:
name: Make Python package
command: make package

win_setup_python_env:
# Miniconda3 is pre-installed on the machine:
# https://circleci.com/docs/2.0/hello-world-windows/
parameters:
python_version:
type: string
steps:
- run:
name: Initialize conda
command: conda init powershell
- run:
name: Create 'kedro-viz' conda environment
command: conda create --name kedro-viz python=<<parameters.python_version>> -y
- run:
name: Install Kedro-Viz dependencies
command: |
conda activate kedro-viz
pip install git+https://github.com/kedro-org/kedro@main
pip install -r package/test_requirements.txt -U
- run:
name: Echo package versions
command: |
conda activate kedro-viz
python -V
pip freeze
- run:
name: Install 'make' command
command: choco install make

setup:
steps:
- checkout
- setup_python_env
- install_node_dependencies
- npm_build

win_setup:
parameters:
python_version:
type: string
executor:
steps:
- checkout
- win_setup_python_env:
python_version: <<parameters.python_version>>
- install_node_dependencies
- npm_build

jobs:
e2e_tests:
parameters:
python_version:
type: string
executor:
name: docker
python_version: <<parameters.python_version>>
steps:
- setup
- run:
name: Run all end to end tests
command: make e2e-tests

win_e2e_tests:
parameters:
python_version:
type: string
executor: win/default
steps:
- win_setup:
python_version: <<parameters.python_version>>
- run:
name: Run all end to end tests on Windows
command: conda activate kedro-viz; make e2e-tests

unit_tests:
parameters:
python_version:
type: string
executor:
name: docker
python_version: <<parameters.python_version>>
steps:
- setup
- run:
name: Run Python tests
command: make pytest

win_unit_tests:
parameters:
python_version:
type: string
executor: win/default
steps:
- win_setup:
python_version: <<parameters.python_version>>
- run:
name: Run Python tests on Windows
command: conda activate kedro-viz; make pytest

lint:
parameters:
python_version:
type: string
executor:
name: docker
python_version: <<parameters.python_version>>
steps:
- checkout
- setup_python_env
- run:
name: Run Python formatters and linters
command: make format-check lint-check

javascript_lint_and_tests:
executor:
name: docker
python_version: '3.8'
steps:
- checkout
- install_node_dependencies
- run:
name: Test lib transpilation
command: npm run lib
- run:
name: Test JS library imports
command: |
npm run lib-test:setup
cd tools/test-lib/react-app
npm run test:ci
- run:
name: Run Eslint
command: npm run lint
- run:
name: Run JavaScript tests
command: npm run build:css && npm run test:ci

build_app:
executor:
name: docker
python_version: '3.8'
steps:
- setup
- run:
name: Run secret scan
command: make secret-scan
- run:
name: Run security scan
command: make security-scan
- python_package

release_to_npm:
executor:
name: docker
python_version: '3.8'
steps:
- checkout
- install_node_dependencies
- npm_build
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run:
name: Publish to npm
command: npm publish

release_to_pypi:
executor:
name: docker
python_version: '3.8'
steps:
- checkout
- setup_python_env
- install_node_dependencies
- python_package
- run:
name: Install twine
command: python -m pip install -U twine
- run:
name: Publish to PyPI
command: python -m twine upload package/dist/*

deploy_demo:
executor:
name: docker
python_version: '3.8'
steps:
- checkout
- setup_remote_docker
- run:
name: Setup environment
command: |
cd demo-project
echo "AWS_ECR_URL=public.ecr.aws/g0x0s3o2/kedro-viz-live-demo" >> $BASH_ENV
echo "KEDRO_VIZ_VERSION=$(cat .version)" >> $BASH_ENV
echo "cd demo-project" >> $BASH_ENV
- run:
name: Install AWS CLI
command: pip3 install awscli
- run:
name: Build demo container image
command: |
echo "kedro_viz==$KEDRO_VIZ_VERSION" >> src/docker_requirements.txt
docker build -t $AWS_ECR_URL:$KEDRO_VIZ_VERSION .
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
docker push $AWS_ECR_URL:$KEDRO_VIZ_VERSION
- run:
name: Create a new lightsail deployment
command: |
# install lightsail cli
# run https://docs.aws.amazon.com/cli/latest/reference/lightsail/create-container-service-deployment.html#create-container-service-deployment
aws lightsail create-container-service-deployment --region eu-west-2 --cli-input-json file://./lightsail.json
all_circleci_checks_succeeded:
docker:
- image: circleci/python # any light-weight image
steps:
- run:
name: Success!
command: echo "All checks passed"

release_filter: &release_filter
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
branches:
ignore: /.*/
path-filtering: circleci/[email protected]

workflows:
version: 2.1
build:
jobs:
- e2e_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- win_e2e_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
filters:
branches:
only:
- main
- demo
- unit_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- win_unit_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
filters:
branches:
only:
- main
- demo
- lint:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- javascript_lint_and_tests
- build_app
- deploy_demo:
context:
- kedro-ecr-publish
requires:
- e2e_tests
- win_e2e_tests
- unit_tests
- win_unit_tests
- lint
- javascript_lint_and_tests
- build_app
filters:
branches:
only: demo
- all_circleci_checks_succeeded:
requires:
- e2e_tests
- unit_tests
- lint
- javascript_lint_and_tests
- build_app

release:
jobs:
- build_app:
<<: *release_filter
- release_to_npm:
<<: *release_filter
- release_to_pypi:
<<: *release_filter
requires:
- build_app

daily:
triggers:
- schedule:
cron: '0 1 * * *'
filters:
branches:
only:
- main
regular:
jobs:
- e2e_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- win_e2e_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- unit_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- win_unit_tests:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- lint:
matrix:
parameters:
python_version: ['3.7', '3.8', '3.9', '3.10']
- javascript_lint_and_tests
- build_app
# the path-filtering/filter job determines which pipeline
# parameters to update, i.e. which builds to run.
- path-filtering/filter:
name: check-updated-files
base-revision: main
config-path: .circleci/continue_config.yml
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
mapping: |
package/.* backend_change true
.circleci/.* ci_change true
^((?!package/).)*$ frontend_change true
Loading

0 comments on commit 360ccc1

Please sign in to comment.