diff --git a/.github/workflows/Branch-protection.yml b/.github/workflows/Branch-protection.yml deleted file mode 100644 index c18d3a6a..00000000 --- a/.github/workflows/Branch-protection.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Check branch origin - -on: - pull_request: - -jobs: - check-branch-protection: - uses: Geode-solutions/actions/.github/workflows/branch-protection.yml@master - with: - branch_from: 'next' - branch_to: 'master' diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml deleted file mode 100644 index aa5606ed..00000000 --- a/.github/workflows/CICD.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: CICD - -on: - push: - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Test - run: | - pip install -r requirements.txt - pip install pytest - pytest - build: - runs-on: ubuntu-latest - needs: test - if: github.ref == 'refs/heads/next' || github.ref == 'refs/heads/master' - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.TOKEN }} - - name: Python Semantic Release - uses: python-semantic-release/python-semantic-release@master - id: semantic-release - with: - github_token: ${{ secrets.TOKEN }} - - name: Build - run: | - python3 -m pip install --upgrade build - python3 -m build - - name: Upload PYPI - if: steps.semantic-release.outputs.released == 'true' - run: | - python3 -m pip install twine==6.0.1 - python3 -m twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }} - - name: Setup NODE - uses: actions/setup-node@v3 - with: - registry-url: "https://registry.npmjs.org" - node-version: "20.x" - - name: Upload NPM - if: steps.semantic-release.outputs.released == 'true' - run: | - pwd - cd ${{ github.workspace }} - npm i - npm run json - jq '.version="${{steps.semantic-release.outputs.version}}"' package.json > temp && mv temp package.json - cat package.json - npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Merge master -> next - if: github.ref == 'refs/heads/master' - uses: devmasx/merge-branch@master - with: - type: now - from_branch: master - target_branch: next - github_token: ${{ secrets.TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..35ffc1c3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,12 @@ +name: Deploy + +on: + workflow_dispatch: + +jobs: + deploy: + uses: Geode-solutions/actions/.github/workflows/py-deploy.yml@master + with: + npm: true + secrets: inherit + \ No newline at end of file diff --git a/.github/workflows/pr_update.yml b/.github/workflows/pr_update.yml new file mode 100644 index 00000000..9743601e --- /dev/null +++ b/.github/workflows/pr_update.yml @@ -0,0 +1,11 @@ +name: Pull request + +on: + pull_request: + types: [opened, reopened] + branches: + - master + +jobs: + update-branch: + uses: Geode-solutions/actions/.github/workflows/update-branch.yml@master \ No newline at end of file diff --git a/.github/workflows/prepare_deploy.yml b/.github/workflows/prepare_deploy.yml new file mode 100644 index 00000000..4c8536cf --- /dev/null +++ b/.github/workflows/prepare_deploy.yml @@ -0,0 +1,9 @@ +name: Prepare deploy + +on: + workflow_dispatch: + +jobs: + prepare: + uses: Geode-solutions/actions/.github/workflows/py-prepare-deploy.yml@master + secrets: inherit diff --git a/.github/workflows/prepare_pr.yml b/.github/workflows/prepare_pr.yml deleted file mode 100644 index 77f8181d..00000000 --- a/.github/workflows/prepare_pr.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Prepare PR - -on: - pull_request: - branches: - - next - -jobs: - prepare: - uses: Geode-solutions/actions/.github/workflows/py-prepare-pr.yml@master - secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..e8193173 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Test + +on: + push: + branches-ignore: + - master + - next + +jobs: + test: + uses: Geode-solutions/actions/.github/workflows/py-test.yml@master + with: + repos: ${{ vars.REPOS }} + secrets: inherit diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml new file mode 100644 index 00000000..177cb915 --- /dev/null +++ b/.github/workflows/test_pr.yml @@ -0,0 +1,12 @@ +name: Test PR + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + test: + uses: Geode-solutions/actions/.github/workflows/py-test-pr.yml@master + with: + repos: ${{ vars.REPOS }} + secrets: inherit diff --git a/requirements.in b/requirements.in index a9f7d46d..53896aba 100644 --- a/requirements.in +++ b/requirements.in @@ -1,15 +1,10 @@ -OpenGeode-core -OpenGeode-IO -OpenGeode-Inspector -OpenGeode-Geosciences -OpenGeode-GeosciencesIO -Geode-Viewables -geode-numerics -geode-simplex -geode-explicit -geode-implicit -geode-common -fastjsonschema -Flask[async] -Flask-Cors -werkzeug \ No newline at end of file +OpenGeode-core==15.24.1 +OpenGeode-IO==7.3.1 +OpenGeode-Inspector==6.7.0 +OpenGeode-Geosciences==9.2.1 +OpenGeode-GeosciencesIO==5.7.1 +Geode-Viewables==3.2.0 +fastjsonschema==2.16.2 +Flask[async]==3.0.3 +Flask-Cors==6.0.1 +werkzeug==3.0.3 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 75eff9e7..7b5af813 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile requirements.in +# pip-compile --pre requirements.in # asgiref==3.9.1 # via flask @@ -10,48 +10,17 @@ blinker==1.9.0 # via flask click==8.2.1 # via flask -fastjsonschema==2.21.1 +fastjsonschema==2.16.2 # via -r requirements.in -flask[async]==3.1.1 +flask[async]==3.0.3 # via # -r requirements.in + # flask # flask-cors flask-cors==6.0.1 # via -r requirements.in -geode-background==9.4.0 - # via - # geode-explicit - # geode-implicit - # geode-simplex geode-common==33.9.0 - # via - # -r requirements.in - # geode-background - # geode-conversion - # geode-explicit - # geode-implicit - # geode-numerics - # geode-simplex - # geode-viewables -geode-conversion==6.4.0 - # via - # geode-explicit - # geode-implicit -geode-explicit==6.3.0 - # via - # -r requirements.in - # geode-implicit -geode-implicit==4.1.1 - # via -r requirements.in -geode-numerics==6.3.0 - # via - # -r requirements.in - # geode-implicit - # geode-simplex -geode-simplex==9.6.0 - # via - # -r requirements.in - # geode-implicit + # via geode-viewables geode-viewables==3.2.0 # via -r requirements.in itsdangerous==2.2.0 @@ -60,19 +29,12 @@ jinja2==3.1.6 # via flask markupsafe==3.0.2 # via - # flask # jinja2 # werkzeug opengeode-core==15.24.1 # via # -r requirements.in - # geode-background # geode-common - # geode-conversion - # geode-explicit - # geode-implicit - # geode-numerics - # geode-simplex # geode-viewables # opengeode-geosciences # opengeode-geosciencesio @@ -81,26 +43,18 @@ opengeode-core==15.24.1 opengeode-geosciences==9.2.1 # via # -r requirements.in - # geode-implicit # geode-viewables # opengeode-geosciencesio opengeode-geosciencesio==5.7.1 - # via - # -r requirements.in - # geode-implicit + # via -r requirements.in opengeode-inspector==6.7.0 - # via - # -r requirements.in - # geode-explicit - # geode-implicit - # geode-simplex + # via -r requirements.in opengeode-io==7.3.1 # via # -r requirements.in - # geode-implicit # geode-viewables # opengeode-geosciencesio -werkzeug==3.1.3 +werkzeug==3.0.3 # via # -r requirements.in # flask diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index e07733df..fc1aa143 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -154,11 +154,8 @@ def create_unique_data_folder() -> tuple[str, str]: def save_all_viewables_and_return_info( - geode_object, - data, generated_id, - data_path, - additional_files=None - ): + geode_object, data, generated_id, data_path, additional_files=None +): saved_native_file_path = geode_functions.save( geode_object, data, @@ -185,22 +182,21 @@ def save_all_viewables_and_return_info( "input_files": additional_files or [], } -def generate_native_viewable_and_light_viewable_from_object( - geode_object, - data - ): + +def generate_native_viewable_and_light_viewable_from_object(geode_object, data): generated_id, data_path = create_unique_data_folder() - return save_all_viewables_and_return_info(geode_object, data, generated_id, data_path) + return save_all_viewables_and_return_info( + geode_object, data, generated_id, data_path + ) -def generate_native_viewable_and_light_viewable_from_file( - geode_object, - input_filename - ): +def generate_native_viewable_and_light_viewable_from_file(geode_object, input_filename): generated_id, data_path = create_unique_data_folder() full_input_filename = geode_functions.upload_file_path(input_filename) - copied_full_path = os.path.join(data_path, werkzeug.utils.secure_filename(input_filename)) + copied_full_path = os.path.join( + data_path, werkzeug.utils.secure_filename(input_filename) + ) shutil.copy2(full_input_filename, copied_full_path) additional_files_copied = [] @@ -208,7 +204,9 @@ def generate_native_viewable_and_light_viewable_from_file( for additional_file in additional.mandatory_files + additional.optional_files: if additional_file.is_missing: continue - source_path = os.path.join(os.path.dirname(full_input_filename), additional_file.filename) + source_path = os.path.join( + os.path.dirname(full_input_filename), additional_file.filename + ) if not os.path.exists(source_path): continue dest_path = os.path.join(data_path, additional_file.filename) diff --git a/tests/test_utils_functions.py b/tests/test_utils_functions.py index 5285a404..52282717 100644 --- a/tests/test_utils_functions.py +++ b/tests/test_utils_functions.py @@ -85,7 +85,6 @@ def test_create_unique_data_folder(client): assert not os.path.exists(data_path) - def test_save_all_viewables_and_return_info(client): app = client.application with app.app_context():