From 1dcec5128397f2df1d1a03d36fd7546cc5bd3d8c Mon Sep 17 00:00:00 2001 From: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:58:45 -0700 Subject: [PATCH 1/2] Update github-action-build.yml Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> --- .github/workflows/github-action-build.yml | 110 +++++++++++++--------- 1 file changed, 68 insertions(+), 42 deletions(-) diff --git a/.github/workflows/github-action-build.yml b/.github/workflows/github-action-build.yml index c2196b84e61..e9c038aa069 100644 --- a/.github/workflows/github-action-build.yml +++ b/.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 + 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 From 874643c94445a3612659d332420ee0d2a0f0f0e9 Mon Sep 17 00:00:00 2001 From: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:04:03 -0700 Subject: [PATCH 2/2] Update github-action-build.yml Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> --- .github/workflows/github-action-build.yml | 111 +++++++++------------- 1 file changed, 43 insertions(+), 68 deletions(-) diff --git a/.github/workflows/github-action-build.yml b/.github/workflows/github-action-build.yml index e9c038aa069..5d80dbbdd1d 100644 --- a/.github/workflows/github-action-build.yml +++ b/.github/workflows/github-action-build.yml @@ -99,72 +99,47 @@ jobs: - 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'] - - steps: - - name: Checkout Texera - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - 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 - 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 + python_udf: + needs: detect_changes + if: ${{ needs.detect_changes.outputs.python_changed == 'true' }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + python-version: ['3.9', '3.10', '3.11', '3.12'] - - name: Test with pytest - run: | - cd core/amber/src/main/python && pytest -sv + steps: + - uses: actions/checkout@v4 + - 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