Merged PR 1265227: Add container build and test github action to heliodb

Tested on my own fork: https://github.com/safern/heliodb/actions
This commit is contained in:
Santiago Fernandez Madero authored and Murat Tuncer committed 2024-02-07 23:20:07 +03:00
1 parent 6c8bf4f145
commit ca7fe5ea32
7 files changed
+229

No files matched your search

@@ -0,0 +1,65 @@
FROM --platform=linux/amd64 mcr.microsoft.com/mirror/docker/library/ubuntu:20.04
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -qy \
wget \
curl \
sudo \
gnupg2 \
lsb-release \
tzdata \
build-essential \
pkg-config \
cmake \
git \
&& rm -rf /var/lib/apt/lists/*
# Add pgdg repo
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
rm -rf /var/lib/apt/lists/*
RUN curl -4sSf https://packagecloud.io/install/repositories/citusdata/community/script.deb.sh | bash
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y \
postgresql-15 \
postgresql-server-dev-15 \
libpq-dev \
postgresql-15-pgcron \
postgresql-15-pgvector \
postgresql-15-postgis-3 \
postgresql-15-rum \
&& rm -rf /var/lib/apt/lists/*
# Install Libbson, decimal128, pcre
ENV CLEANUP_SETUP=1
ENV INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup
RUN mkdir -p /tmp/install_setup
COPY scripts/ /tmp/install_setup
RUN MAKE_PROGRAM=cmake /tmp/install_setup/install_setup_libbson.sh
RUN /tmp/install_setup/install_setup_pcre2.sh
RUN /tmp/install_setup/install_setup_intel_decimal_math_lib.sh
RUN /tmp/install_setup/install_citus_indent.sh
RUN rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
RUN adduser --disabled-password --gecos "" --uid 1001 runner \
&& groupadd docker --gid 123 \
&& usermod -aG sudo runner \
&& usermod -aG docker runner \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
WORKDIR /home/runner
USER runner
LABEL org.opencontainers.image.source=https://github.com/microsoft/heliodb
LABEL org.opencontainers.image.description="Heliodb ubuntu build image"
LABEL org.opencontainers.image.licenses=MIT
+65
View File
@@ -0,0 +1,65 @@
name: Build heliodb Containers
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
paths:
- '.github/containers/**'
- '.github/workflows/build_containers.yml'
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'
paths:
- '.github/containers/**'
- '.github/workflows/build_containers.yml'
workflow_dispatch:
inputs:
pushLatestTag:
description: 'Publish latest tag'
default: false
type: boolean
env:
tagBranchName: ${{ github.event.pull_request && 'private' || github.ref_name }}
jobs:
ubuntu_build_container:
runs-on: ubuntu-latest
steps:
- name: Set tag name
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/microsoft/heliodb/build_ubuntu
tags: |
${{ (github.event_name == 'push' || inputs.pushLatestTag == true) && 'type=raw,value={{branch}}_latest' || 'type=raw,value={{branch}}_{{sha}}' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: '{{ defaultContext }}'
file: '.github/containers/Build-Ubuntu/Dockerfile'
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
+44
View File
@@ -0,0 +1,44 @@
name: Build and Test
run-name: ${{ github.event.pull_request.title || '' }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
- '.github/containers/**'
- '.devcontainer/**'
- '*.md'
pull_request:
types: [opened, reopened,synchronize]
paths-ignore:
- 'docs/**'
- '.github/containers/**'
- '.devcontainer/**'
- '*.md'
merge_group:
jobs:
ubuntu_build:
runs-on: ubuntu-latest
container:
image: ghcr.io/safern/heliodb/build_ubuntu:safern-setup_build_action_latest
steps:
- uses: actions/checkout@v4
- name: Build and install
run: sudo make install
- name: Run Tests
run: make check
- name: Citus Indent
run: |
citus_indent --check || (echo ""; echo "citus_indent failed, refer to CONTRIBUTING.md on how to use citus_indent"; exit 1)