Copilot commented on code in PR #3642:
URL: https://github.com/apache/texera/pull/3642#discussion_r2261610216
##########
.github/workflows/github-action-build.yml:
##########
@@ -98,47 +98,73 @@ jobs:
run: cd core && sbt clean package
- name: Run backend tests
run: cd core && sbt test
+
+python_udf:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ python-version: ['3.9', '3.10', '3.11', '3.12']
- python_udf:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os:
- - ubuntu-latest
- python-version: [ '3.9', '3.10', '3.11', '3.12' ]
+ steps:
+ - name: Checkout Texera
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- steps:
- - name: Checkout Texera
- uses: actions/checkout@v2
- - name: Set up R for R-UDF
- uses: r-lib/actions/setup-r@v2
- with:
- r-version: '4.3.3'
- - name: Install R dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
- with:
- cache: false
- working-directory: "./core/amber"
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- if [ -f core/amber/requirements.txt ]; then pip install -r
core/amber/requirements.txt; fi
- if [ -f core/amber/r-requirements.txt ]; then pip install -r
core/amber/r-requirements.txt; fi
- if [ -f core/amber/operator-requirements.txt ]; then pip install -r
core/amber/operator-requirements.txt; fi
- - name: Install PostgreSQL
- run: sudo apt-get update && sudo apt-get install -y postgresql
- - name: Start PostgreSQL Service
- run: sudo systemctl start postgresql
- - name: Create Database and User
- run: |
- cd core/scripts/sql && sudo -u postgres psql -f
iceberg_postgres_catalog.sql
- - name: Lint with flake8 and black
- run: |
- cd core/amber/src/main/python && flake8 && black . --check
- - name: Test with pytest
- run: |
- cd core/amber/src/main/python && pytest -sv
\ No newline at end of file
+ - name: Detect relevant changes
+ id: changes
+ uses: dorny/paths-filter@v3
+ with:
+ filters: |
+ python_code:
+ - 'core/amber/src/main/python/**'
+
+ - name: Early exit if no Python changes
+ run: |
+ if [ "${{ steps.changes.outputs.python_code }}" != "true" ]; then
+ echo "No changes in core/amber/src/main/python — skipping."
+ exit 0
+ fi
+
+ - name: Set up R for R-UDF
+ uses: r-lib/actions/setup-r@v2
+ with:
+ r-version: '4.3.3'
+
+ - name: Install R dependencies
+ uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ cache: false
+ working-directory: "./core/amber"
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
Review Comment:
The `actions/setup-python@v2` action is outdated. Consider updating to
`actions/setup-python@v4` or later for better compatibility and security
updates, similar to how `actions/checkout` was updated to v4.
```suggestion
uses: actions/setup-python@v4
```
##########
.github/workflows/github-action-build.yml:
##########
@@ -98,47 +98,73 @@ jobs:
run: cd core && sbt clean package
- name: Run backend tests
run: cd core && sbt test
+
+python_udf:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ python-version: ['3.9', '3.10', '3.11', '3.12']
- python_udf:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os:
- - ubuntu-latest
- python-version: [ '3.9', '3.10', '3.11', '3.12' ]
+ steps:
+ - name: Checkout Texera
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- steps:
- - name: Checkout Texera
- uses: actions/checkout@v2
- - name: Set up R for R-UDF
- uses: r-lib/actions/setup-r@v2
- with:
- r-version: '4.3.3'
- - name: Install R dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
- with:
- cache: false
- working-directory: "./core/amber"
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- if [ -f core/amber/requirements.txt ]; then pip install -r
core/amber/requirements.txt; fi
- if [ -f core/amber/r-requirements.txt ]; then pip install -r
core/amber/r-requirements.txt; fi
- if [ -f core/amber/operator-requirements.txt ]; then pip install -r
core/amber/operator-requirements.txt; fi
- - name: Install PostgreSQL
- run: sudo apt-get update && sudo apt-get install -y postgresql
- - name: Start PostgreSQL Service
- run: sudo systemctl start postgresql
- - name: Create Database and User
- run: |
- cd core/scripts/sql && sudo -u postgres psql -f
iceberg_postgres_catalog.sql
- - name: Lint with flake8 and black
- run: |
- cd core/amber/src/main/python && flake8 && black . --check
- - name: Test with pytest
- run: |
- cd core/amber/src/main/python && pytest -sv
\ No newline at end of file
+ - name: Detect relevant changes
+ id: changes
+ uses: dorny/paths-filter@v3
+ with:
+ filters: |
+ python_code:
+ - 'core/amber/src/main/python/**'
+
+ - name: Early exit if no Python changes
+ run: |
+ if [ "${{ steps.changes.outputs.python_code }}" != "true" ]; then
+ echo "No changes in core/amber/src/main/python — skipping."
+ exit 0
+ fi
+
+ - name: Set up R for R-UDF
+ uses: r-lib/actions/setup-r@v2
+ with:
+ r-version: '4.3.3'
+
+ - name: Install R dependencies
+ uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ cache: false
+ working-directory: "./core/amber"
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install dependencies
Review Comment:
Using `exit 0` in a workflow step will mark the step as successful but
continue executing subsequent steps. To properly skip the entire job when no
Python changes are detected, you should use job-level conditionals on
subsequent steps or set a job output and use it in job conditions.
```suggestion
# Removed "Early exit if no Python changes" step
- name: Set up R for R-UDF
if: steps.changes.outputs.python_code == 'true'
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.3'
- name: Install R dependencies
if: steps.changes.outputs.python_code == 'true'
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: false
working-directory: "./core/amber"
- name: Set up Python ${{ matrix.python-version }}
if: steps.changes.outputs.python_code == 'true'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.changes.outputs.python_code == 'true'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]