From aa2a06c83b83cf9a491b8a8c67c4a75d818a4b01 Mon Sep 17 00:00:00 2001 From: "Yiqun (Ethan) Zhang" Date: Sat, 2 Nov 2024 19:00:12 -0500 Subject: [PATCH] Create prestissimo-build.yml --- .github/actions/install-gh-cli/action.yml | 15 +++ .github/workflows/prestissimo-build.yml | 128 ++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 .github/actions/install-gh-cli/action.yml create mode 100644 .github/workflows/prestissimo-build.yml diff --git a/.github/actions/install-gh-cli/action.yml b/.github/actions/install-gh-cli/action.yml new file mode 100644 index 0000000000000..cda35d07a99fb --- /dev/null +++ b/.github/actions/install-gh-cli/action.yml @@ -0,0 +1,15 @@ +name: Install GitHub CLI +description: Installs the GitHub CLI (gh) on the runner +runs: + using: composite + steps: + - name: Download and install GitHub CLI + shell: bash + run: | + curl -sSL https://github.com/cli/cli/releases/latest/download/gh_$(uname -s)_amd64.tar.gz -o gh.tar.gz + tar -xzf gh.tar.gz + sudo mv gh_*/bin/gh /usr/local/bin/ + rm -rf gh.tar.gz gh_* + - name: Verify GitHub CLI installation + shell: bash + run: gh --version diff --git a/.github/workflows/prestissimo-build.yml b/.github/workflows/prestissimo-build.yml new file mode 100644 index 0000000000000..28d373f4d13a0 --- /dev/null +++ b/.github/workflows/prestissimo-build.yml @@ -0,0 +1,128 @@ +name: Prestissimo check and build + +on: + push: + branches: + - 'master' + paths: + - 'presto-native-execution/**' + - '.github/workflows/prestissimo-build.yml' + pull_request: + paths: + - 'presto-native-execution/**' + - '.github/workflows/prestissimo-build.yml' + +permissions: + contents: read + +concurrency: + group: prestissimo-check-and-build-${{ github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + format-check: + name: Format check + # prevent errors when forks ff their main branch + if: ${{ github.repository == 'prestodb/presto' }} + runs-on: prestissimo_x64 + container: public.ecr.aws/oss-presto/velox-dev:check + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fix git permissions + # Usually actions/checkout does this but as we run in a container + # it doesn't work + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Check formatting + run: | + cd presto-native-execution + make format-check + + header-check: + name: Header check + if: ${{ github.repository == 'prestodb/presto' }} + runs-on: prestissimo_x64 + container: public.ecr.aws/oss-presto/velox-dev:check + needs: format-check + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fix git permissions + # Usually actions/checkout does this but as we run in a container + # it doesn't work + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Check license headers + run: | + cd presto-native-execution + make header-check + + linux-build-all: + name: Linux build all + if: ${{ github.repository == 'prestodb/presto' }} + runs-on: prestissimo_x64 + container: prestodb/presto-native-dependency:latest + needs: header-check + env: + CCACHE_DIR: "${{ github.workspace }}/.ccache" + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Fix git permissions + # Usually actions/checkout does this but as we run in a container + # it doesn't work + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Update velox submodule + run: | + cd presto-native-execution + make velox-submodule + + - name: Install all adapter dependencies + run: | + mkdir -p ${HOME}/adapter-deps/install + source /opt/rh/gcc-toolset-12/enable + set -xu + cd presto-native-execution + DEPENDENCY_DIR=${HOME}/adapter-deps PROMPT_ALWAYS_RESPOND=n ./scripts/setup-adapters.sh jwt + + - name: Install GitHub CLI + uses: ./.github/actions/install-gh-cli + + - name: Get Ccache Stash + uses: assignUser/stash/restore@v1 + with: + path: '${{ env.CCACHE_DIR }}' + key: ccache-ubuntu-release + + - name: Build all + run: | + mkdir -p '${{ env.CCACHE_DIR }}' + ccache -sz -M 8Gi + source /opt/rh/gcc-toolset-12/enable + cd presto-native-execution + cmake \ + -B _build/release \ + -GNinja \ + -DAWSSDK_ROOT_DIR=${HOME}/adapter-deps/install \ + -DTREAT_WARNINGS_AS_ERRORS=1 \ + -DENABLE_ALL_WARNINGS=1 \ + -DCMAKE_BUILD_TYPE=Release \ + -DPRESTO_ENABLE_PARQUET=ON \ + -DPRESTO_ENABLE_S3=ON \ + -DPRESTO_ENABLE_REMOTE_FUNCTIONS=ON \ + -DPRESTO_ENABLE_JWT=ON \ + -DCMAKE_PREFIX_PATH=/usr/local \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DMAX_LINK_JOBS=2 + ninja -C _build/release -j 8 + ccache -vs + + - uses: assignUser/stash/save@v1 + with: + path: '${{ env.CCACHE_DIR }}' + key: ccache-ubuntu-release