Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CircleCI to Github actions migration for Kedro-Viz (test) #1846

Merged
merged 24 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7867912
CircleCI to Github actions migration for test
jitu5 Apr 5, 2024
db418b2
trufflehog-ignore updated
jitu5 Apr 5, 2024
ed92744
matrix for js removed
jitu5 Apr 9, 2024
94606c5
Matrix removed for js in frontend
jitu5 Apr 9, 2024
b58e8b6
Merge branch 'main' into feature/gha-test
jitu5 Apr 9, 2024
4a9ff80
build-frontend workflow merged with js-lint-test workflow
jitu5 Apr 9, 2024
181e8ce
Reusable action for tests created and kept node version and package p…
jitu5 Apr 11, 2024
b9a8757
action path fix
jitu5 Apr 11, 2024
ace8362
Action path fix in workflow
jitu5 Apr 11, 2024
c173949
action file correction setup_tests
jitu5 Apr 11, 2024
407a1a0
checkout moved from actions
jitu5 Apr 11, 2024
708d0fb
hashFiles format added
jitu5 Apr 11, 2024
f3001c7
name updated to install_kedro_and_python_dependencies
jitu5 Apr 11, 2024
da8b24e
Condition for PR to main with windows updated
jitu5 Apr 11, 2024
7a38aca
Code review fix added
jitu5 Apr 12, 2024
2abf154
Merge branch 'main' into feature/gha-test
jitu5 Apr 15, 2024
db942b7
Merge Gatekeeper added
jitu5 Apr 16, 2024
a4e043e
All CircleCI Pipeline name added to ignore list.
jitu5 Apr 16, 2024
316c237
ci/circleci pipeline renamed
jitu5 Apr 16, 2024
01ab121
Node version updated
jitu5 Apr 16, 2024
85f5f52
Merge branch 'main' into feature/gha-test
jitu5 Apr 16, 2024
5a3dba6
Windows run for PR to main is updated
jitu5 Apr 16, 2024
454b444
Merge branch 'main' into feature/gha-test
jitu5 Apr 22, 2024
4627340
Merge branch 'main' into feature/gha-test
jitu5 Apr 22, 2024
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
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
37 changes: 37 additions & 0 deletions .github/actions/install_node_dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Setup Node.js and Install Dependencies
description: Sets up a specific Node.js version, caches Node modules, and installs Node dependencies.

inputs:
node-version:
description: 'Node.js version'
required: false
default: '18.20.0'

package-path:
description: 'Path to package.json file'
required: false
default: '.'

runs:
using: composite
jitu5 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: ${{ inputs.node-version }}

- name: Get NPM Cache Directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Node.js packages
uses: actions/cache@v2
with:
path: "${{ steps.npm-cache-dir.outputs.dir }}"
key: "${{ runner.os }}-node-${{ hashFiles(format('{0}/package-lock.json', inputs.package-path)) }}"
restore-keys: "${{ runner.os }}-node-"

- name: Install Node Dependencies
run: npm install
shell: bash
46 changes: 46 additions & 0 deletions .github/actions/setup_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Setup Tests
ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved
description: Sets up the testing environment by setting up Python and Node.js, caching Python packages, installing Kedro and other Python dependencies, and building the React application.

inputs:
os:
description: 'Operating system'
required: false
default: 'ubuntu-latest'
python-version:
description: 'Python version'
required: false
default: '3.9'

runs:
using: "composite"
steps:
- 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_kedro_and_python_dependencies"

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

- name: Build React application
run: |-
node -v
make build
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/all-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run all checks on Kedro-Viz
# Runs end-to-end tests, unit tests, linting and JavaScript
# linting & tests on Kedro-Viz for different
# operating systems and Python versions.

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 ]
jitu5 marked this conversation as resolved.
Show resolved Hide resolved
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:
uses: ./.github/workflows/javascript-lint-and-tests.yml
44 changes: 44 additions & 0 deletions .github/workflows/build-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build backend
# Runs end-to-end tests, unit tests, and linting on the backend code
# for different operating systems and Python versions.

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 }}
39 changes: 39 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run e2e tests on Kedro-Viz
# Runs end-to-end tests on Kedro-Viz for different
# operating systems and Python versions.

on:
workflow_call:
inputs:
os:
type: string
python-version:
type: string
jobs:
e2e_tests:
runs-on: ${{ inputs.os }}

# below condition checks if the operating system is Ubuntu, or
# if the operating system is Windows and the branch is main/demo
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: Setup Tests
uses: "./.github/actions/setup_tests"
with:
os: ${{ inputs.os }}
python-version: ${{ inputs.python-version }}

- name: Run all end to end tests
run: make e2e-tests
61 changes: 61 additions & 0 deletions .github/workflows/javascript-lint-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run javascript linters and tests on Kedro-Viz
# Runs JavaScript linting, unit tests, and end-to-end tests on
# Kedro-Viz for ubuntu-latest operating systems and Python 3.9.

on:
push:
paths-ignore:
- 'package/**'
pull_request:
paths-ignore:
- 'package/**'
workflow_dispatch:
workflow_call:

jobs:
javascript_lint_and_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python "3.9"
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Cache python packages for Linux
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ubuntu-latest-python-3.9

- name: Install Kedro and other Python Dependencies
uses: "./.github/actions/install_kedro_and_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
45 changes: 45 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run linters on Kedro-Viz
# Runs secret scan, security scan, GraphQL schema check,
# and Python formatters and linters on Kedro-Viz for
# different operating systems and Python versions.

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_kedro_and_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
26 changes: 26 additions & 0 deletions .github/workflows/merge-gatekeeper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Merge Gatekeeper
ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
branches:
- main

jobs:
merge-gatekeeper:
runs-on: ubuntu-latest
# Restrict permissions of the GITHUB_TOKEN.
# Docs: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
checks: read
statuses: read
steps:
- name: Run Merge Gatekeeper
# NOTE: v1 is updated to reflect the latest v1.x.y. Please use any tag/branch that suits your needs:
# https://github.com/upsidr/merge-gatekeeper/tags
# https://github.com/upsidr/merge-gatekeeper/branches
uses: upsidr/merge-gatekeeper@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
timeout: 3600
interval: 30
ignored: 'ci/circleci: win_unit_tests-3.9,ci/circleci: win_unit_tests-3.10,ci/circleci: win_unit_tests-3.8,ci/circleci: unit_tests-3.10,ci/circleci: unit_tests-3.8,ci/circleci: unit_tests-3.9,ci/circleci: win_e2e_tests-3.10,ci/circleci: win_e2e_tests-3.9,ci/circleci: win_e2e_tests-3.8,ci/circleci: e2e_tests-3.8,ci/circleci: e2e_tests-3.9,ci/circleci: e2e_tests-3.10,ci/circleci: lint-3.8,ci/circleci: lint-3.9,ci/circleci: lint-3.10,ci/circleci: javascript_lint_and_tests,ci/circleci: check-updated-files,ci/circleci: all_circleci_checks_succeeded'
Loading
Loading