diff --git a/.github/workflows/test_auto_fixes.yml b/.github/workflows/test_auto_fixes.yml new file mode 100644 index 0000000000..54f6d2ebc8 --- /dev/null +++ b/.github/workflows/test_auto_fixes.yml @@ -0,0 +1,94 @@ +name: Run Python test +permissions: + contents: write +on: + workflow_call: + inputs: + skip_tests: + type: boolean + default: false + required: false + test_python_lower: + type: boolean + default: false + required: false +# DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests" +jobs: + select-strategy: + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.set-matrix.outputs.python-versions }} + steps: + - id: set-matrix + run: | + echo "python-versions=[\"3.9\",\"3.13\"]" >> $GITHUB_OUTPUT + python-test: + if: ${{ !inputs.skip_tests }} + name: Python Tests + needs: select-strategy + strategy: + matrix: + python: ${{ fromJson(needs.select-strategy.outputs.python-versions) }} + os: [ubuntu-latest] + runs-on: '${{ matrix.os }}' + steps: + - uses: actions/checkout@v4 + name: Checkout + with: + ref: ${{ github.head_ref }} + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + - name: Install Python dependencies + run: | + echo "Installing test dependencies..." + python -m pip install pytest tox + python -m pip install -e examples/netflow + python -m pip install black + echo "Installing linting dependencies from cache..." + python -m pip install maturin mypy networkx pyvis pandas-stubs + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Validate graphQL schema + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + run: | + npx graphql-schema-linter --rules fields-have-descriptions,types-have-descriptions raphtory-graphql/schema.graphql || true + - name: Update docs from graphQL schema + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + run: | + python docs/scripts/gen_docs_graphql_pages.py + - name: Run python linter + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + run: | + cd python && black . + - name: Run stubsgen + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + run: | + echo "Installing Raphtory from ./python" + pip install -e ./python + echo "Installing stubsgen" + python -m pip install -e stub_gen + cd python/scripts && python gen-stubs.py + - name: Run mypy + run: | + mypy -m raphtory + - name: Check for uncommitted changes + if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Changes detected. Committing and pushing..." + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout ${{ github.head_ref }} + git add . + git commit -m "chore: apply tidy-public auto-fixes" + git push --force-with-lease origin HEAD:${{ github.head_ref }} + else + echo "No changes to commit." + fi diff --git a/.github/workflows/test_during_pr.yml b/.github/workflows/test_during_pr.yml index 0cff1b4c4e..62f7ebea24 100644 --- a/.github/workflows/test_during_pr.yml +++ b/.github/workflows/test_during_pr.yml @@ -23,6 +23,13 @@ jobs: uses: ./.github/workflows/test_rust_disk_storage_workflow.yml secrets: inherit needs: rust-format-check + call-test-auto-fixes: + name: Run auto fixes + uses: ./.github/workflows/test_auto_fixes.yml + with: + test_python_lower: false + secrets: inherit + needs: rust-format-check call-test-python-workflow-in-local-repo: name: Run Python tests uses: ./.github/workflows/test_python_workflow.yml diff --git a/.github/workflows/test_python_workflow.yml b/.github/workflows/test_python_workflow.yml index 6f22f77ba5..d58f3db525 100644 --- a/.github/workflows/test_python_workflow.yml +++ b/.github/workflows/test_python_workflow.yml @@ -64,53 +64,9 @@ jobs: python -m pip install black echo "Installing linting dependencies from cache..." python -m pip install maturin mypy networkx pyvis pandas-stubs - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - name: Run Python tests run: | cd python && tox run - name: Run Python extension tests run: | cd examples/netflow/test && pytest . - - name: Validate graphQL schema - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' - run: | - npx graphql-schema-linter --rules fields-have-descriptions,types-have-descriptions raphtory-graphql/schema.graphql || true - - name: Update docs from graphQL schema - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' - run: | - python docs/scripts/gen_docs_graphql_pages.py - - name: Run python linter - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' - run: | - cd python && black . - - name: Run stubsgen - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' - run: | - echo "Installing Raphtory from ./python" - pip install -e ./python - echo "Installing stubsgen" - python -m pip install -e stub_gen - cd python/scripts && python gen-stubs.py - - name: Run mypy - run: | - mypy -m raphtory - - - name: Check for uncommitted changes - if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ -n "$(git status --porcelain)" ]; then - echo "Changes detected. Committing and pushing..." - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git checkout ${{ github.head_ref }} - git add . - git commit -m "chore: apply tidy-public auto-fixes" - git push --force-with-lease origin HEAD:${{ github.head_ref }} - else - echo "No changes to commit." - fi diff --git a/docs/reference/graphql/graphql_API.md b/docs/reference/graphql/graphql_API.md index 0aef135570..d3f98abb07 100644 --- a/docs/reference/graphql/graphql_API.md +++ b/docs/reference/graphql/graphql_API.md @@ -2417,43 +2417,43 @@ This allows you to specify multiple operations together.