Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-laj committed Apr 7, 2023
0 parents commit 7d74515
Show file tree
Hide file tree
Showing 42 changed files with 18,630 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/repo_meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# point_of_contact: the owner of this repository, can be a GitHub user or
# GitHub team
point_of_contact: sfc-gh-kbregula

# production: whether this repository meets the criteria for being
# "production",
# for ciriteria, see:
# https://snowflakecomputing.atlassian.net/wiki/spaces/CLO/pages/2239988967/Production+Repository+Criteria
production: true

# distributed: whether any source code in this repository is distributed
# directly to customers (e.g. driver and frontend software)
distributed: true

# modified: whether any open source dependencies in this repository have
# been modified
modified: false

# release_branches: list of release branch patterns, exact matches or
# regex is acceptable
release_branches:
- main

# code_owners_file_present: whether there is a CODEOWNERS file in
# this repository
code_owners_file_present: false

# jira_project_issue_type: the jira issuetype used to raise issues
# related to this repository in the SNOW Jira project
jira_project_issue_type: Bug

# jira_area: the jira area that raised issues should use
jira_area: Orphaned

# audit_in_scope: whether this repository is included in
# scope for audits or certifications (SOX, SOC, ISO, Fedramp etc.)
audit_in_scope: false
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Continuous Integration

on: # yamllint disable-line rule:truthy
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
FORCE_COLOR: true

jobs:
build:

runs-on: ubuntu-latest

env:
PYTHON_VERSION: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: |
setup.*
pyproject.toml
dev-requirements.txt
.pre-commit-config.yaml
- name: Set up Node
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.nvmrc'
cache-dependency-path: frontend/yarn.lock

- name: Create development environment
run: |
./dev.py py-create-venv
source ./venv/bin/activate
echo "PATH=$PATH" >> "$GITHUB_ENV"
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> "$GITHUB_ENV"
echo "Installed dependencies:"
pip freeze
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files

- name: Test javascript code
run: ./dev.py js-test

- name: Test python code
run: ./dev.py py-test

- name: Ensure browsers are installed
run: playwright install chromium --with-deps

- name: Build frontend
run: ./dev.py js-build

- name: Run e2e tests
run: pytest e2e

- name: Upload snapshots
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: Snapshots
path: e2e/__snapshots__
if-no-files-found: error

- name: Build package
run: ./dev.py package

- name: Verify package
run: tar -tvf dist/streamlit_ketcher-*.tar.gz | grep NOTICES

- run: mkdir -p "$(yarn cache dir)"

- name: Upload WHL file
uses: actions/upload-artifact@v3
with:
name: WHL file
path: dist/*.whl
if-no-files-found: error
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Byte-compiled files
__pycache__/

# Distribution / packaging
streamlit_ketcher/frontend
build/
dist/

# Python Environment
venv/
*.egg-info/

# Jetbrain IDE
.idea
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.15.0
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
default_stages: [commit, push]
default_language_version:
python: python3
node: 18.6.0
minimum_pre_commit_version: '2.0.0'
repos:
- repo: meta
hooks:
- id: check-hooks-apply
name: Check if all hooks apply to the repository
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
name: Run black (Python formatter)
args: [--config=./pyproject.toml]
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.256'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
name: Check that merge conflicts are not being committed
- id: debug-statements
name: Detect accidentally committed debug statements
- id: check-builtin-literals
name: Require literal syntax when initializing Python builtin types
- id: end-of-file-fixer
name: Make sure that there is an empty line at the end
exclude: ^NOTICES$
- id: mixed-line-ending
name: Detect if mixed line ending is used (\r vs. \r\n)
- id: check-executables-have-shebangs
name: Check that executables have shebang
- id: trailing-whitespace
name: Remove trailing whitespace at end of line
exclude: ^NOTICES$
- id: pretty-format-json
name: Format JSON files
args:
- --autofix
- --no-sort-keys
- --indent
- "2"
- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
hooks:
- id: yamllint
name: Check YAML files with yamllint
entry: yamllint --strict
types: [yaml]
- repo: local
hooks:
- id: yarn-format
name: Run formatted for frontend code
entry: ./dev.py js-format
language: system
files: ^frontend/src\/.+\.([jt]sx?|s?css)$
require_serial: true
- id: license-disclaimer
name: Generate NOTICES
language: system
entry: bash -c "cd frontend; yarn license-disclaimer"
files: '(package\.json|yarn\.lock)$'
pass_filenames: false
Loading

0 comments on commit 7d74515

Please sign in to comment.