-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from freeswitch/gha
[GHA] Add `Build and Distribute` workflow.
- Loading branch information
Showing
8 changed files
with
621 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
ARG BUILDER_IMAGE=centos:7.2.1511 | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
MAINTAINER ${MAINTAINER} | ||
ENV MAINTAINER=${MAINTAINER} | ||
|
||
RUN yum -y update && \ | ||
yum install -y \ | ||
audiofile-devel \ | ||
autoconf \ | ||
automake \ | ||
bind-license \ | ||
centos-release-scl \ | ||
cyrus-sasl-lib \ | ||
dbus \ | ||
dbus-libs \ | ||
devtoolset-9-gcc* \ | ||
dos2unix \ | ||
doxygen \ | ||
dpkg-dev \ | ||
dracut \ | ||
epel-release \ | ||
expat \ | ||
gcc \ | ||
gcc-c++ \ | ||
git \ | ||
glib2 \ | ||
glib2-devel \ | ||
gnupg2 \ | ||
gzip \ | ||
krb5-dxevel \ | ||
libatomic \ | ||
libcurl-devel \ | ||
libtool \ | ||
libuuid-devel \ | ||
libxml2 \ | ||
lksctp-tools-devel \ | ||
lsb_release \ | ||
make \ | ||
multilib-rpm-config \ | ||
openssl-devel \ | ||
pkg-config \ | ||
procps-ng \ | ||
python \ | ||
python-libs \ | ||
rpm-build \ | ||
rpmdevtools \ | ||
scl-utils \ | ||
sqlite \ | ||
swig \ | ||
unzip \ | ||
uuid-devel \ | ||
vim-minimal \ | ||
wget \ | ||
which \ | ||
xz \ | ||
xz-libs \ | ||
yum-plugin-fastestmirror \ | ||
yum-plugin-ovl \ | ||
yum-utils \ | ||
zlib-devel && \ | ||
yum -y clean all | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR}/src/ | ||
RUN cd ${DATA_DIR}/src/ && \ | ||
git reset --hard HEAD && git clean -xfd && \ | ||
cd ${DATA_DIR} | ||
|
||
ARG SPEC_FILE=spandsp | ||
|
||
# Bootstrap and Build | ||
RUN cat <<EOF > ~/.rpmmacros | ||
%packager ${MAINTAINER} | ||
%_topdir ${DATA_DIR}/rpmbuild | ||
EOF | ||
RUN rpmdev-setuptree | ||
|
||
RUN echo "export VERSION=$(rpm -q --qf '%{VERSION}\n' --specfile ${DATA_DIR}/src/${SPEC_FILE}.spec 2>/dev/null | head -1)" \ | ||
| tee ~/.env && \ | ||
chmod +x ~/.env | ||
|
||
RUN . ~/.env && \ | ||
mv -v ${DATA_DIR}/src/ ${DATA_DIR}/${SPEC_FILE}-${VERSION}/ && \ | ||
tar cvzf ${DATA_DIR}/rpmbuild/SOURCES/${SPEC_FILE}-${VERSION}.tar.gz --exclude .git -C ${DATA_DIR} ${SPEC_FILE}-${VERSION}/ && \ | ||
cp -v ${DATA_DIR}/${SPEC_FILE}-${VERSION}/${SPEC_FILE}.spec ${DATA_DIR}/rpmbuild/SPECS/ && \ | ||
sed -i "s/\(Release:\)\([[:space:]]*\)1%{?dist}/\1\2${BUILD_NUMBER}.${GIT_SHA}/" ${DATA_DIR}/rpmbuild/SPECS/${SPEC_FILE}.spec | ||
|
||
RUN rpmbuild -bs ${DATA_DIR}/rpmbuild/SPECS/${SPEC_FILE}.spec | ||
RUN find ${DATA_DIR}/rpmbuild/SRPMS/ -type f | xargs -rI{} yum-builddep -y {} | ||
RUN rpmbuild -ba ${DATA_DIR}/rpmbuild/SPECS/${SPEC_FILE}.spec | ||
|
||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) | ||
FROM scratch | ||
COPY --from=builder /data/rpmbuild/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
ARG BUILDER_IMAGE=debian:bookworm | ||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
MAINTAINER ${MAINTAINER} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
apt-transport-https \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
debhelper \ | ||
devscripts \ | ||
dh-autoreconf \ | ||
docbook-xsl \ | ||
dos2unix \ | ||
doxygen \ | ||
git \ | ||
graphviz \ | ||
libglib2.0-dev \ | ||
libssl-dev \ | ||
lsb-release \ | ||
pkg-config \ | ||
wget | ||
|
||
RUN update-ca-certificates --fresh | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR} | ||
RUN git reset --hard HEAD && git clean -xfd | ||
|
||
RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ | ||
chmod +x ~/.env | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# Bootstrap and Build | ||
RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" | tee -a ~/.env | ||
RUN . ~/.env && dch \ | ||
--controlmaint \ | ||
--distribution "${CODENAME}" \ | ||
--force-bad-version \ | ||
--force-distribution \ | ||
--newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
"Nightly build, ${GIT_SHA}" | ||
|
||
RUN apt-get -q update && \ | ||
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ | ||
apt-get -y -f install | ||
|
||
ENV DEB_BUILD_OPTIONS="parallel=1" | ||
RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
--force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" | ||
RUN 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/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
ARG BUILDER_IMAGE=arm32v7/debian:bookworm | ||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
MAINTAINER ${MAINTAINER} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
apt-transport-https \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
debhelper \ | ||
devscripts \ | ||
dh-autoreconf \ | ||
docbook-xsl \ | ||
dos2unix \ | ||
doxygen \ | ||
git \ | ||
graphviz \ | ||
libglib2.0-dev \ | ||
libssl-dev \ | ||
lsb-release \ | ||
pkg-config \ | ||
wget | ||
|
||
RUN update-ca-certificates --fresh | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR} | ||
RUN git reset --hard HEAD && git clean -xfd | ||
|
||
RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ | ||
chmod +x ~/.env | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# Bootstrap and Build | ||
RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" | tee -a ~/.env | ||
RUN . ~/.env && dch \ | ||
--controlmaint \ | ||
--distribution "${CODENAME}" \ | ||
--force-bad-version \ | ||
--force-distribution \ | ||
--newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
"Nightly build, ${GIT_SHA}" | ||
|
||
RUN apt-get -q update && \ | ||
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ | ||
apt-get -y -f install | ||
|
||
ENV DEB_BUILD_OPTIONS="parallel=1" | ||
RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
--force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" | ||
RUN 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/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
ARG BUILDER_IMAGE=debian:bullseye | ||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
MAINTAINER ${MAINTAINER} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
apt-transport-https \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
debhelper \ | ||
devscripts \ | ||
dh-autoreconf \ | ||
docbook-xsl \ | ||
dos2unix \ | ||
doxygen \ | ||
git \ | ||
graphviz \ | ||
libglib2.0-dev \ | ||
libssl-dev \ | ||
lsb-release \ | ||
pkg-config \ | ||
wget | ||
|
||
RUN update-ca-certificates --fresh | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR} | ||
RUN git reset --hard HEAD && git clean -xfd | ||
|
||
RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ | ||
chmod +x ~/.env | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# Bootstrap and Build | ||
RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" | tee -a ~/.env | ||
RUN . ~/.env && dch \ | ||
--controlmaint \ | ||
--distribution "${CODENAME}" \ | ||
--force-bad-version \ | ||
--force-distribution \ | ||
--newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
"Nightly build, ${GIT_SHA}" | ||
|
||
RUN apt-get -q update && \ | ||
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ | ||
apt-get -y -f install | ||
|
||
ENV DEB_BUILD_OPTIONS="parallel=1" | ||
RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
--force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" | ||
RUN 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/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
ARG BUILDER_IMAGE=arm32v7/debian:bullseye | ||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
MAINTAINER ${MAINTAINER} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
apt-transport-https \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
debhelper \ | ||
devscripts \ | ||
dh-autoreconf \ | ||
docbook-xsl \ | ||
dos2unix \ | ||
doxygen \ | ||
git \ | ||
graphviz \ | ||
libglib2.0-dev \ | ||
libssl-dev \ | ||
lsb-release \ | ||
pkg-config \ | ||
wget | ||
|
||
RUN update-ca-certificates --fresh | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR} | ||
RUN git reset --hard HEAD && git clean -xfd | ||
|
||
RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ | ||
chmod +x ~/.env | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# Bootstrap and Build | ||
RUN echo "export VERSION=$(dpkg-parsechangelog --show-field Version | cut -f1 -d'-')" | tee -a ~/.env | ||
RUN . ~/.env && dch \ | ||
--controlmaint \ | ||
--distribution "${CODENAME}" \ | ||
--force-bad-version \ | ||
--force-distribution \ | ||
--newversion "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
"Nightly build, ${GIT_SHA}" | ||
|
||
RUN apt-get -q update && \ | ||
mk-build-deps --install --remove debian/control --tool "apt-get -y --no-install-recommends" && \ | ||
apt-get -y -f install | ||
|
||
ENV DEB_BUILD_OPTIONS="parallel=1" | ||
RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ | ||
--force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}" | ||
RUN 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/ / |
Oops, something went wrong.