Skip to content

Commit

Permalink
Merge pull request #14 from jitu5/tempDev
Browse files Browse the repository at this point in the history
Temp dev
  • Loading branch information
jitu5 authored Apr 4, 2024
2 parents df5a187 + 7a10588 commit d054c94
Show file tree
Hide file tree
Showing 13 changed files with 468 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/actions/install_node_dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Setup Node.js and Install Dependencies
description: Sets up a specific Node.js version, caches Node modules, and installs Node dependencies.

runs:
using: composite
steps:
- uses: actions/[email protected]
with:
node-version: 16.13.2

- id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v4
with:
path: "${{ steps.npm-cache-dir.outputs.dir }}"
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
restore-keys: "${{ runner.os }}-node-"

- run: npm ci
shell: bash
15 changes: 15 additions & 0 deletions .github/actions/install_python_dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Install Kedro and other Python Dependencies
description: Installs Kedro from the main branch and other Python dependencies, then prints the Python version and installed packages.
runs:
using: composite
steps:
- name: Install Python dependencies
run: |-
pip install git+https://github.com/kedro-org/kedro@main
pip install -r package/test_requirements.txt -r demo-project/src/docker_requirements.txt -U
shell: bash
- name: Echo package versions
run: |-
python -V
pip freeze
shell: bash
47 changes: 47 additions & 0 deletions .github/workflows/all-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Run all checks on Kedro-Viz
on:
workflow_call:
workflow_dispatch:
schedule:
# Run every day at 1:00 AM(UTC time)
- cron: 0 1 * * *
jobs:
e2e_tests:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/e2e-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

unit_tests:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/unit-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

lint:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/lint.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

javascript_lint_and_tests:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]
uses: ./.github/workflows/javascript-lint-and-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
41 changes: 41 additions & 0 deletions .github/workflows/build-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build backend
on:
push:
paths:
- 'package/**'
- '.github/**'
pull_request:
paths:
- 'package/**'
- '.github/**'
workflow_dispatch:
jobs:
e2e_tests:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/e2e-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

unit_tests:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/unit-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

lint:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
uses: ./.github/workflows/lint.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
19 changes: 19 additions & 0 deletions .github/workflows/build-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build frontend
on:
push:
paths-ignore:
- 'package/**'
pull_request:
paths-ignore:
- 'package/**'
workflow_dispatch:
jobs:
javascript_lint_and_tests:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]
uses: ./.github/workflows/javascript-lint-and-tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
16 changes: 12 additions & 4 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -36,15 +36,23 @@ jobs:
package_name: ${{ steps.version_check.outputs.package_name }}
package_version: ${{ steps.version_check.outputs.package_version }}

prepare-release:
needs: [check-version]
test-kedro-viz:
needs: check-version
if: ${{ needs.check-version.outputs.new_release == 'true' }}
uses: ./.github/workflows/all-checks.yml

prepare-release:
needs: [check-version, test-kedro-viz]
if: |
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.check-version.outputs.new_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy demo
on:
workflow_dispatch:
push:
branches:
- demo
jobs:
deploy_demo:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup environment
run: |-
cd demo-project
echo "AWS_ECR_URL=public.ecr.aws/h1b3x4b6/jitu5-kedro-viz" >> $GITHUB_ENV
echo "KEDRO_VIZ_VERSION=$(cat .version)" >> $GITHUB_ENV
- name: Install AWS CLI
run: pip3 install awscli

- name: Build demo container image
run: |-
cd demo-project
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
- name: Create a new lightsail deployment
run: |-
cd demo-project
# 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
49 changes: 49 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run e2e tests on Kedro-Viz

on:
workflow_call:
inputs:
os:
type: string
python-version:
type: string
jobs:
e2e_tests:
runs-on: ${{ inputs.os }}
if: inputs.os == 'ubuntu-latest' || ((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/demo') && inputs.os == 'windows-latest')
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{inputs.python-version}}
uses: actions/setup-python@v5
with:
python-version: ${{inputs.python-version}}

- name: Cache python packages for Linux
if: inputs.os == 'ubuntu-latest'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{inputs.os}}-python-${{inputs.python-version}}

- name: Cache python packages for Windows
if: inputs.os == 'windows-latest'
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{inputs.os}}-python-${{inputs.python-version}}

- name: Install Kedro and other Python Dependencies
uses: "./.github/actions/install_python_dependencies"

- name: Setup Node.js and Install Dependencies
uses: "./.github/actions/install_node_dependencies"

- name: Build React application
run: |-
node -v
make build
- name: Run Python tests
run: make e2e-tests
57 changes: 57 additions & 0 deletions .github/workflows/javascript-lint-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run javascript linters and tests on Kedro-Viz

on:
workflow_call:
inputs:
os:
type: string
python-version:
type: string
jobs:
javascript_lint_and_tests:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{inputs.python-version}}
uses: actions/setup-python@v5
with:
python-version: ${{inputs.python-version}}

- name: Cache python packages for Linux
if: inputs.os == 'ubuntu-latest'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{inputs.os}}-python-${{inputs.python-version}}

- name: Install Kedro and other Python Dependencies
uses: "./.github/actions/install_python_dependencies"

- name: Setup Node.js and Install Dependencies
uses: "./.github/actions/install_node_dependencies"

- name: Setup Cypress requirements
run: |-
sudo sed -i 's/archive.ubuntu.com/us-east-1.ec2.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Test lib transpilation
run: npm run lib

- name: Test JS library imports
run: |-
npm run lib-test:setup
cd tools/test-lib/react-app
npm run test:ci
- name: Run Eslint
run: npm run lint

- name: Run JavaScript tests
run: npm run test:ci

- name: Run Javascript end to end tests
run: npm run cy:ci
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run linters on Kedro-Viz

on:
workflow_call:
inputs:
os:
type: string
python-version:
type: string
jobs:
lint:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{inputs.python-version}}
uses: actions/setup-python@v5
with:
python-version: ${{inputs.python-version}}

- name: Cache python packages for Linux
if: inputs.os == 'ubuntu-latest'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{inputs.os}}-python-${{inputs.python-version}}

- name: Install Kedro and other Python Dependencies
uses: "./.github/actions/install_python_dependencies"

- name: Run secret scan
run: make secret-scan

- name: Run security scan
run: make security-scan

- name: Verify GraphQL schema is up to date
run: make schema-check

- name: Run Python formatters and linters
run: make format-check lint-check
Loading

0 comments on commit d054c94

Please sign in to comment.