Skip to content

Commit

Permalink
Merge pull request #82 from Riminder/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
the-forest-tree authored Sep 22, 2022
2 parents a1ca0bd + 41fc83f commit db671c3
Show file tree
Hide file tree
Showing 273 changed files with 12,893 additions and 57,588 deletions.
28 changes: 0 additions & 28 deletions .coveragerc

This file was deleted.

6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
max-line-length = 88
exclude = .pytest_cache,__pycache__
ignore = E731, W503, E203
per-file-ignores =
src/hrflow_connectors/core/templates.py: E501
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/data/** filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.github/ @Riminder/admin
150 changes: 150 additions & 0 deletions .github/workflows/hrflow_connectors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: HrFlow.ai Connectors

on:
pull_request_target:
types: [labeled, opened, synchronize, reopened]
branches:
- "master"

env:
PYTHON_VERSION: 3.10.5
POETRY_VERSION: 1.1.12

jobs:
core-tests:
runs-on: ubuntu-latest
steps:
- name: Check permissions for job
if: ${{ !(contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.pull_request.author_association) || contains(github.event.pull_request.labels.*.name, 'run tests for fork'))}}
uses: actions/github-script@v3
with:
script: |
core.setFailed("Not enough permissions to run Core Tests")
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
lfs: true

- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Load cached Poetry installation
id: cached-poetry-install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}

- name: Install poetry
if: steps.cached-poetry-install.outputs.cache-hit != 'true'
run: curl -sSL https://install.python-poetry.org | POETRY_VERSION=$POETRY_VERSION python3 -

- name: Add poetry to PATH
run: export PATH="$HOME/.local/bin:$PATH"

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}

- name: Install python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: POETRY_INSTALLER_PARALLEL=1 POETRY_VIRTUALENVS_IN_PROJECT=1 poetry install -E s3

- name: Run commit hooks
run: poetry run pre-commit run --hook-stage commit --all-files

- name: Check manifest is up to date
run: poetry run pre-commit run --hook-stage push --all-files hrflow_connectors_manifest

- name: Check documentation is up to date
run: poetry run pre-commit run --hook-stage push --all-files hrflow_connectors_docs

- name: Run Core tests
run: |
poetry run pytest
env:
HRFLOW_CONNECTORS_STORE_ENABLED: "1"
HRFLOW_CONNECTORS_LOCALJSON_DIR: "/tmp/"
S3_STORE_TEST_BUCKET: ${{ secrets.S3_STORE_TEST_BUCKET }}
S3_STORE_TEST_AWS_REGION: ${{ secrets.S3_STORE_TEST_AWS_REGION }}
S3_STORE_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_AWS_SECRET_ACCESS_KEY }}
S3_STORE_TEST_READ_ONLY_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_READ_ONLY_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_READ_ONLY_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_READ_ONLY_AWS_SECRET_ACCESS_KEY }}
S3_STORE_TEST_WRITE_ONLY_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_WRITE_ONLY_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_WRITE_ONLY_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_WRITE_ONLY_AWS_SECRET_ACCESS_KEY }}

connectors-integration-tests:
runs-on: ubuntu-latest
needs: core-tests
steps:
- name: Check permissions for job
if: ${{ !(contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.pull_request.author_association) || contains(github.event.pull_request.labels.*.name, 'run tests for fork'))}}
uses: actions/github-script@v3
with:
script: |
core.setFailed("Not enough permissions to run Integration Tests")
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
lfs: true

- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Load cached Poetry installation
id: cached-poetry-install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}

- name: Add poetry to PATH
run: export PATH="$HOME/.local/bin:$PATH"

- name: Run Connector tests
run: |
echo $ALL_SECRETS > src/hrflow_connectors/connectors/secrets.json
poetry run pytest --no-cov --ignore tests/core --allconnectors
env:
ALL_SECRETS: ${{ toJson(secrets) }}
HRFLOW_CONNECTORS_STORE_ENABLED: "1"
HRFLOW_CONNECTORS_LOCALJSON_DIR: "/tmp/"
S3_STORE_TEST_BUCKET: ${{ secrets.S3_STORE_TEST_BUCKET }}
S3_STORE_TEST_AWS_REGION: ${{ secrets.S3_STORE_TEST_AWS_REGION }}
S3_STORE_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_AWS_SECRET_ACCESS_KEY }}
S3_STORE_TEST_READ_ONLY_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_READ_ONLY_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_READ_ONLY_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_READ_ONLY_AWS_SECRET_ACCESS_KEY }}
S3_STORE_TEST_WRITE_ONLY_AWS_ACCESS_KEY_ID: ${{ secrets.S3_STORE_TEST_WRITE_ONLY_AWS_ACCESS_KEY_ID }}
S3_STORE_TEST_WRITE_ONLY_AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_STORE_TEST_WRITE_ONLY_AWS_SECRET_ACCESS_KEY }}

reset-labels:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [core-tests, connectors-integration-tests]
permissions:
issues: write
pull-requests: write
steps:
- name: Remove run tests for fork label
run: |
curl \
-X DELETE \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ github.token }}' \
'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/run%20tests%20for%20fork'
70 changes: 5 additions & 65 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,66 +1,6 @@
# Temporary and binary files
*~
*.py[cod]
*.so
*.env
*.cfg
!.isort.cfg
!setup.cfg
*.orig
*.log
*.pot
__pycache__/*
.cache/*
.*.swp
*/.ipynb_checkpoints/*
.ipynb_checkpoints
.DS_Store
*chromedriver*

# Project files
.ropeproject
.project
.pydevproject
.settings
.idea
.vscode
tags

# Package files
*.egg
*.eggs/
.installed.cfg
*.egg-info

# Unittest and coverage
htmlcov/*
.coverage
.coverage.*
.tox
junit*.xml
coverage.xml
.python-version
__pycache__/
.pytest_cache/
test.ipynb

# Build and docs folder/files
build/*
dist/*
sdist/*
docs/api/*
docs/_rst/*
docs/_build/*
cover/*
MANIFEST

# Per-project virtualenvs
.venv*/
.conda*/
.env

# Credentials
credentials
.credentials
credentials.json
credential
.credential
credential.json
.vscode/
.coverage
secrets.json
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-added-large-files
- repo: local
hooks:
- id: flake8
name: flake8
entry: poetry run flake8
language: system
types: [python]
args: [--config=.flake8]
stages: [commit]

- id: hrflow_connectors_manifest
name: hrflow_connectors_manifest
entry: poetry run python -c 'from hrflow_connectors import __CONNECTORS__, hrflow_connectors_manifest as m; m(connectors=__CONNECTORS__)'
language: system
stages: [push]
always_run: true
pass_filenames: false

- id: hrflow_connectors_docs
name: hrflow_connectors_docs
entry: poetry run python -c 'from hrflow_connectors import __CONNECTORS__, generate_docs as m; m(connectors=__CONNECTORS__)'
language: system
stages: [push]
always_run: true
pass_filenames: false
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ You will find here the list of people who contributed to the ***Hrflow.ai Connec
* Clement Négre <clement.negre@hrflow.ai>
* 🐧 Corentin Duchêne <corentin.duchene@hrflow.ai> / Nigiva <contact@nigiva.com>
* Limam Cheikh Mohamed Vadhel <limam.vadhel@hrflow.ai>

* [@the-forest-tree](https://github.com/the-forest-tree)
Loading

0 comments on commit db671c3

Please sign in to comment.