Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejuvenate build using GHA. #1

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### How to build image (Debian Bookworm example).
```
docker build \
--build-arg BUILD_NUMBER=69 \
--file .github/docker/debian/bookworm/amd64/Dockerfile \
--progress=plain \
--tag artifacts:latest \
--ulimit nofile=1024000:1024000 \
.
```

### How to dump artifacts from image to current directory.
```
docker save artifacts:latest | tar --ignore-command-error --strip-components=2 --to-command='tar -vxf -' -xf -
```
79 changes: 79 additions & 0 deletions .github/docker/debian/bookworm/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM --platform=linux/amd64 debian:bookworm AS builder

ARG BUILD_NUMBER=42

SHELL ["/bin/bash", "-c"]

ENV PYENV_VERSION_TAG=v2.4.0
ENV PYTHON_VERSION=2.7.18
ENV V8_GIT_VERSION=6.1.298
ENV BUILD_DIR=/data/BUILD
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y \
&& apt-get install -y \
build-essential \
ca-certificates \
curl \
devscripts \
git \
libbz2-dev \
libffi-dev \
libglib2.0-dev \
liblzma-dev \
libncurses5 \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
lsb-release \
make \
ninja-build \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& apt-get clean \
&& update-ca-certificates --fresh \
&& rm -rf /var/lib/apt/lists/*

ENV PYENV_ROOT "/opt/pyenv"
ENV PATH "$PYENV_ROOT/shims:$PYENV_ROOT/bin:$BUILD_DIR/depot_tools:$PATH"

RUN git clone --depth 1 --branch $PYENV_VERSION_TAG https://github.com/pyenv/pyenv.git $PYENV_ROOT \
&& sed -i 's|PATH="/|PATH="$PYENV_ROOT/bin/:/|g' /etc/profile \
&& $PYENV_ROOT/bin/pyenv init - | tee -a /etc/profile \
&& echo "export PATH=\"$BUILD_DIR/depot_tools:${PATH}\"" | tee -a /etc/profile

RUN pyenv install $PYTHON_VERSION \
&& pyenv global $PYTHON_VERSION

ENTRYPOINT ["/bin/bash", "-l"]

WORKDIR $BUILD_DIR

COPY ./stub-gclient-spec $BUILD_DIR/.gclient

RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git \
&& gclient sync --verbose -r $V8_GIT_VERSION \
&& cd v8 \
&& gn gen out.gn --args="is_debug=true symbol_level=2 blink_symbol_level=1 v8_symbol_level=1 v8_static_library=true is_component_build=false v8_enable_i18n_support=false v8_use_external_startup_data=false" \
&& gn args out.gn --list | tee out.gn/gn_args.txt \
&& ninja -v d8 -C out.gn

COPY ./debian $BUILD_DIR/debian

RUN sed -i -e "s/GIT_VERSION/$V8_GIT_VERSION/g" debian/v8-6.1_static.pc \
&& sed -i -e "s/GIT_VERSION/$V8_GIT_VERSION/g" debian/changelog \
&& sed -i -e "s/DATE/$(env LC_ALL=en_US.utf8 date '+%a, %d %b %Y %H:%M:%S %z')/g" debian/changelog \
&& sed -i -e "s/DISTRO/$(lsb_release -sc | tr -d '\n')/g" debian/changelog \
&& sed -i -e "s/BUILD_NUMBER/$BUILD_NUMBER/g" debian/changelog \
&& debuild -b -us -uc \
&& mkdir ../OUT \
&& mv -v ../*.deb ../OUT/.

# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
FROM scratch
COPY --from=builder /data/OUT/ /
79 changes: 79 additions & 0 deletions .github/docker/debian/bullseye/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM --platform=linux/amd64 debian:bullseye AS builder

ARG BUILD_NUMBER=42

SHELL ["/bin/bash", "-c"]

ENV PYENV_VERSION_TAG=v2.4.0
ENV PYTHON_VERSION=2.7.18
ENV V8_GIT_VERSION=6.1.298
ENV BUILD_DIR=/data/BUILD
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y \
&& apt-get install -y \
build-essential \
ca-certificates \
curl \
devscripts \
git \
libbz2-dev \
libffi-dev \
libglib2.0-dev \
liblzma-dev \
libncurses5 \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
lsb-release \
make \
ninja-build \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& apt-get clean \
&& update-ca-certificates --fresh \
&& rm -rf /var/lib/apt/lists/*

ENV PYENV_ROOT "/opt/pyenv"
ENV PATH "$PYENV_ROOT/shims:$PYENV_ROOT/bin:$BUILD_DIR/depot_tools:$PATH"

RUN git clone --depth 1 --branch $PYENV_VERSION_TAG https://github.com/pyenv/pyenv.git $PYENV_ROOT \
&& sed -i 's|PATH="/|PATH="$PYENV_ROOT/bin/:/|g' /etc/profile \
&& $PYENV_ROOT/bin/pyenv init - | tee -a /etc/profile \
&& echo "export PATH=\"$BUILD_DIR/depot_tools:${PATH}\"" | tee -a /etc/profile

RUN pyenv install $PYTHON_VERSION \
&& pyenv global $PYTHON_VERSION

ENTRYPOINT ["/bin/bash", "-l"]

WORKDIR $BUILD_DIR

COPY ./stub-gclient-spec $BUILD_DIR/.gclient

RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git \
&& gclient sync --verbose -r $V8_GIT_VERSION \
&& cd v8 \
&& gn gen out.gn --args="is_debug=true symbol_level=2 blink_symbol_level=1 v8_symbol_level=1 v8_static_library=true is_component_build=false v8_enable_i18n_support=false v8_use_external_startup_data=false" \
&& gn args out.gn --list | tee out.gn/gn_args.txt \
&& ninja -v d8 -C out.gn

COPY ./debian $BUILD_DIR/debian

RUN sed -i -e "s/GIT_VERSION/$V8_GIT_VERSION/g" debian/v8-6.1_static.pc \
&& sed -i -e "s/GIT_VERSION/$V8_GIT_VERSION/g" debian/changelog \
&& sed -i -e "s/DATE/$(env LC_ALL=en_US.utf8 date '+%a, %d %b %Y %H:%M:%S %z')/g" debian/changelog \
&& sed -i -e "s/DISTRO/$(lsb_release -sc | tr -d '\n')/g" debian/changelog \
&& sed -i -e "s/BUILD_NUMBER/$BUILD_NUMBER/g" debian/changelog \
&& debuild -b -us -uc \
&& mkdir ../OUT \
&& mv -v ../*.deb ../OUT/.

# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
FROM scratch
COPY --from=builder /data/OUT/ /
64 changes: 64 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Distribute

on:
pull_request:
push:
branches:
- master
paths:
- "**"
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.ref }}

jobs:
deb:
name: 'DEB'
permissions:
id-token: write
contents: read
uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main
strategy:
# max-parallel: 1
fail-fast: false
matrix:
os:
- debian
version:
- bookworm
- bullseye
platform:
- name: amd64
runner: ubuntu-latest
with:
RUNNER: ${{ matrix.platform.runner }}
ARTIFACTS_PATTERN: '.*\.(deb)$'
DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/Dockerfile
MAINTAINER: 'Andrey Volk <[email protected]>'
META_FILE_PATH_PREFIX: /var/www/libv8/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}
PLATFORM: ${{ matrix.platform.name }}
TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-artifact
UPLOAD_BUILD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }}
secrets:
GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}
HOSTNAME: ${{ secrets.HOSTNAME }}
PROXY_URL: ${{ secrets.PROXY_URL }}
USERNAME: ${{ secrets.USERNAME }}
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}

meta:
name: 'Publish build data to meta-repo'
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }}
needs:
- deb
permissions:
id-token: write
contents: read
uses: signalwire/actions-template/.github/workflows/meta-repo-content.yml@main
with:
META_CONTENT: '/var/www/libv8/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}'
META_REPO: signalwire/bamboo_gha_trigger
META_REPO_BRANCH: trigger/libv8/${{ github.ref_name }}
secrets:
GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}
2 changes: 1 addition & 1 deletion linux/debian/changelog → debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG_NAME (GIT_VERSION-BUILD_VERSION~DISTRO) DISTRO; urgency=medium
libv8-6.1 (GIT_VERSION-BUILD_NUMBER~DISTRO) DISTRO; urgency=medium

* New version based on GIT_VERSION
(https://chromium.googlesource.com/v8/v8.git)
Expand Down
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
25 changes: 25 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Source: libv8-6.1
Priority: optional
Maintainer: FreeSWITCH Solutions <[email protected]>
Standards-Version: 3.9.6
Section: libs
Homepage: https://developers.google.com/v8/

Package: libv8-6.1
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: V8 JavaScript engine - runtime library
V8 is a high performance JavaScript engine written in C++.
It is used in the web browser Chromium.
.
This package provides libraries for V8.

Package: libv8-6.1-dev
Section: libdevel
Architecture: amd64
Depends: libv8-6.1 (= ${binary:Version}), ${misc:Depends}
Description: V8 JavaScript engine - development files for 6.1.x
V8 is a high performance JavaScript engine written in C++.
It is used in the web browser Chromium.
.
This package provide development headers for V8 6.1.x.
File renamed without changes.
36 changes: 36 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/make -f

BIN_PACKAGE_NAME := libv8-6.1
DEV_PACKAGE_NAME := libv8-6.1-dev
V8_INCLUDE_DIR := v8/include
V8_OUT_RELEASE_DIR := v8/out.gn

%:
dh $@

override_dh_update_autotools_config:
# Override dh_update_autotools_config to do nothing

override_dh_autoreconf:
# Override dh_autoreconf to do nothing

override_dh_auto_build:
# Override dh_auto_build to do nothing

override_dh_auto_test:
# Override dh_auto_test to do nothing

override_dh_strip:
# Override dh_strip to do nothing

override_dh_install:
dh_install -p$(DEV_PACKAGE_NAME) debian/v8-6.1_static.pc usr/lib/pkgconfig/
dh_install -p$(DEV_PACKAGE_NAME) $(V8_INCLUDE_DIR)/*.h usr/include/v8-6.1/
dh_install -p$(DEV_PACKAGE_NAME) $(V8_INCLUDE_DIR)/libplatform/*.h usr/include/v8-6.1/libplatform/
dh_install -p$(DEV_PACKAGE_NAME) $(V8_OUT_RELEASE_DIR)/gn_args.txt usr/include/v8-6.1/

dh_install -p$(BIN_PACKAGE_NAME) $(V8_OUT_RELEASE_DIR)/d8 usr/lib/v8-6.1/
dh_install -p$(BIN_PACKAGE_NAME) $(V8_OUT_RELEASE_DIR)/obj/*.a usr/lib/v8-6.1/
dh_install -p$(BIN_PACKAGE_NAME) $(V8_OUT_RELEASE_DIR)/obj/src/inspector/*.a usr/lib/v8-6.1/src/inspector/

dh_install
File renamed without changes.
2 changes: 2 additions & 0 deletions debian/source/lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source: source-is-missing *
libv8-6.1-dev: pkg-config-unavailable-for-cross-compilation [usr/lib/pkgconfig/v8-6.1_static.pc]
File renamed without changes.
1 change: 0 additions & 1 deletion linux/.gitignore

This file was deleted.

Loading