Skip to content

Commit

Permalink
refactor: pyproject.toml to poetry (#65)
Browse files Browse the repository at this point in the history
* ci: add frappe black to CI (#57)

* ci: add frappe black to CI

* chore: black

* ci: backport testing (#59)

* Validate customizations (#41)

* fix:

* fix: only install customizations for cloud storage

* chore: add dependency versions

* tests: explicitly install moto with s3 extra

* ci: try flit extras-require

* test: try this config

* fix: fix toml (#62)

* refactor: pyproject.toml to poetry

* chore: downgrade moto version

* chore: rebase to version-15

* ci: coverage report to PR

* fix: linting

* chore: pytest command

* ci: remove old linters, allow from forks

* fix: add back setup.py

* fix: setup in wrong folder

---------

Co-authored-by: Tyler Matteson <[email protected]>
Co-authored-by: Tyler Matteson <[email protected]>
  • Loading branch information
3 people authored May 8, 2024
1 parent eb92d3b commit 6332878
Show file tree
Hide file tree
Showing 5 changed files with 881 additions and 106 deletions.
90 changes: 0 additions & 90 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ env:

jobs:
mypy:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 2

- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -40,14 +36,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

black:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 2

- name: Setup Python
uses: actions/setup-python@v5
Expand All @@ -61,14 +53,10 @@ jobs:
run: black --check .

prettier:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 2

- name: Prettify code
uses: rutajdash/[email protected]
Expand All @@ -82,81 +70,3 @@ jobs:
run: |
echo "The following files are not formatted:"
echo "${{steps.prettier-run.outputs.prettier_output}}" >> $GITHUB_OUTPUT
json_diff:
needs: [ py_json_merge ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 2

- name: Find JSON changes
id: changed-json
uses: tj-actions/changed-files@v43
with:
files: |
**/*.json
include_all_old_new_renamed_files: true

- name: Copy head paths files
run: |
mkdir head
touch head/acmr.txt
for file in ${{ steps.changed-json.outputs.added_files }}; do
echo "A,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.copied_files }}; do
echo "C,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.modified_files }}; do
echo "M,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
for file in ${{ steps.changed-json.outputs.renamed_files }}; do
echo "R,head/${file}" >> head/acmr.txt
cp --parents $file head/
done
- name: Checkout base
run: git checkout $(git --no-pager log --oneline -n 2 | awk 'NR==2 {print $1}')

- name: Copy base paths
run: |
mkdir base
touch base/mrd.txt
for file in ${{ steps.changed-json.outputs.modified_files }}; do
echo "M,${file}" >> base/mrd.txt
done
for file in ${{ steps.changed-json.outputs.all_old_new_renamed_files }}; do
echo "R,${file}" >> base/mrd.txt
done
for file in ${{ steps.changed-json.outputs.deleted_files }}; do
echo "D,${file}" >> base/mrd.txt
done
py_json_merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Fetch validator
run: git clone --depth 1 https://gist.github.com/f1bf2c11f78331b2417189c385022c28.git validate_json

- name: Validate JSON
run: python3 validate_json/validate_json.py ./cloud_storage/cloud_storage/

- name: Compile
run: python3 -m compileall -q ./

- name: Check merge
run: |
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
then echo "Found merge conflicts"
exit 1
fi
10 changes: 9 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ jobs:
working-directory: /home/runner/frappe-bench
run: |
source env/bin/activate
pytest ./apps/cloud_storage/cloud_storage/tests/ -s
cd apps/cloud_storage
pytest --cov=cloud_storage --cov-report=xml --disable-warnings -s | tee pytest-coverage.txt
env:
TYPE: server

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: /home/runner/frappe-bench/apps/cloud_storage/pytest-coverage.txt
junitxml-path: /home/runner/frappe-bench/apps/cloud_storage/coverage.xml

Loading

0 comments on commit 6332878

Please sign in to comment.