blob: 0381a24800c51abaf9be5643e1a672aabe14802e [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Build
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
on:
push:
branches:
- 'ci-enable/**'
- 'main'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
frontend:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: macos-latest
arch: arm64
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
node-version:
- 18
steps:
- name: Checkout Texera
uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.arch }}
- uses: actions/cache@v4
with:
path: |
frontend/node_modules
key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.node-version }}-yarn-cache-v1-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-${{ matrix.node-version }}-yarn-cache-v1-
- name: Prepare Yarn 4.5.1
run: corepack enable && corepack prepare yarn@4.5.1 --activate && yarn --cwd frontend set version 4.5.1
- name: Install dependency
run: yarn --cwd frontend install --immutable --network-timeout=100000
- name: Lint with Prettier & ESLint
run: yarn --cwd frontend format:ci
- name: Run frontend unit tests
run: yarn --cwd frontend run test:ci
- name: Prod build
run: yarn --cwd frontend run build:ci
scala:
strategy:
matrix:
os: [ ubuntu-22.04 ]
java-version: [ 11 ]
runs-on: ${{ matrix.os }}
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Add a health check so steps wait until Postgres is ready
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Setup sbt launcher
uses: sbt/setup-sbt@3e125ece5c3e5248e18da9ed8d2cce3d335ec8dd # v1.1.14
- uses: coursier/cache-action@4e2615869d13561d626ed48655e1a39e5b192b3c # v6.4.9
with:
extraSbtFiles: '["*.sbt", "project/**.{scala,sbt}", "project/build.properties" ]'
- name: Lint with scalafmt
run: sbt scalafmtCheckAll
- name: Create Databases
run: |
psql -h localhost -U postgres -f sql/texera_ddl.sql
psql -h localhost -U postgres -f sql/iceberg_postgres_catalog.sql
psql -h localhost -U postgres -f sql/texera_lakefs.sql
env:
PGPASSWORD: postgres
- name: Create texera_db_for_test_cases
run: psql -h localhost -U postgres -v DB_NAME=texera_db_for_test_cases -f sql/texera_ddl.sql
env:
PGPASSWORD: postgres
- name: Compile with sbt
run: sbt clean package
- name: Run backend tests
run: sbt test
python:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Texera
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f amber/requirements.txt ]; then pip install -r amber/requirements.txt; fi
if [ -f amber/operator-requirements.txt ]; then pip install -r 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 sql && sudo -u postgres psql -f iceberg_postgres_catalog.sql
- name: Lint with Ruff
run: |
cd amber/src/main/python && ruff check . && ruff format --check .
- name: Test with pytest
run: |
cd amber/src/main/python && pytest -sv