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

Automatically build binary releases #2936

Closed
wants to merge 5 commits into from
Closed
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
30 changes: 30 additions & 0 deletions .github/dockerfiles/Dockerfile.alpine-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG OS_VERSION
FROM alpine:${OS_VERSION}
ARG ARCHIVE
RUN apk --no-cache upgrade
RUN apk add --no-cache \
dpkg-dev \
dpkg \
bash \
pcre \
ca-certificates \
openssl-dev \
ncurses-dev \
unixodbc-dev \
zlib-dev \
lksctp-tools-dev \
autoconf \
build-base \
perl-dev \
wget \
tar \
binutils \
libxslt-dev
COPY $ARCHIVE /tmp
RUN cd /tmp && tar xzf otp_src.tar.gz
WORKDIR /tmp/otp
RUN ./otp_build autoconf
RUN ./configure --with-ssl
RUN make release -j$(getconf _NPROCESSORS_ONLN) RELEASE_ROOT=/tmp/release
RUN make release_docs RELEASE_ROOT=/tmp/release DOC_TARGETS=chunks
RUN cd /tmp && tar czf release.tar.gz release/
27 changes: 27 additions & 0 deletions .github/dockerfiles/Dockerfile.ubuntu-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG OS_VERSION
FROM ubuntu:${OS_VERSION}
ARG ARCHIVE
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y --no-install-recommends install \
autoconf \
dpkg-dev \
gcc \
g++ \
make \
libncurses-dev \
unixodbc-dev \
libssl-dev \
libsctp-dev \
wget \
ca-certificates \
pax-utils \
xsltproc
COPY $ARCHIVE /tmp
RUN cd /tmp && tar xzf otp_src.tar.gz
WORKDIR /tmp/otp
RUN ./otp_build autoconf
RUN ./configure --with-ssl
RUN make release -j$(getconf _NPROCESSORS_ONLN) RELEASE_ROOT=/tmp/release
RUN make release_docs RELEASE_ROOT=/tmp/release DOC_TARGETS=chunks
RUN cd /tmp && tar czf release.tar.gz release/
26 changes: 26 additions & 0 deletions .github/scripts/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -euox pipefail

os=$1
os_version=$2
tmp_dir=$3

image=otp:${os}
container=otp_${os}
dockerfile=.github/dockerfiles/Dockerfile.${os}-binary

.github/scripts/init-pre-release.sh

docker build \
-t ${image} \
-f $dockerfile \
--build-arg OS_VERSION=${os_version} \
--build-arg ARCHIVE=otp_src.tar.gz \
.

docker run --name ${container} ${image}
mkdir -p ${tmp_dir}
docker cp ${container}:/tmp/release.tar.gz ${tmp_dir}/
docker rm -f ${container}
docker rmi -f ${image}
rm -rf otp_src.tar.gz
12 changes: 12 additions & 0 deletions .github/scripts/build_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euox pipefail

tmp_dir=$1
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#utilities
ssl_dir=/usr/local/opt/openssl

./otp_build autoconf
./configure --with-ssl=$ssl_dir --disable-dynamic-ssl-lib
make release -j$(getconf _NPROCESSORS_ONLN) RELEASE_ROOT=$PWD/release
make release_docs RELEASE_ROOT=$PWD/release DOC_TARGETS=chunks
tar czf ${tmp_dir}/release.tar.gz release/
33 changes: 33 additions & 0 deletions .github/workflows/build_binary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build binary releases

on:
push:
pull_request:

jobs:
build:
strategy:
matrix:
include:
- os: macos-10.15
runs-on: macos-10.15
script: .github/scripts/build_macos.sh
- os: ubuntu-20.04
runs-on: ubuntu-20.04
script: .github/scripts/build_linux.sh ubuntu 20.04
- os: alpine-3.12
runs-on: ubuntu-20.04
script: .github/scripts/build_linux.sh alpine 3.12
runs-on: ${{ matrix.runs-on}}
steps:
- uses: actions/checkout@v2
- run: mkdir -p tmp
- run: ${{ matrix.script }} $PWD/tmp
- name: Set artifact name
id: artifact-name
run: echo ::set-output name=NAME::$(echo ${{ github.ref }} | sed -E 's/refs\/(heads|tags)\///' | sed -E 's/refs\/pull\/([0-9]+).*/pr-\1/')-x86_64-${{ matrix.os }}.tar.gz
- run: mv tmp/release.tar.gz ${{ steps.artifact-name.outputs.NAME }}
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.artifact-name.outputs.NAME }}
path: ${{ steps.artifact-name.outputs.NAME }}
5 changes: 4 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
jobs:

pack:
# TODO: re-enable
if: false
name: Pack the Erlang/OTP tar.gz
runs-on: ubuntu-latest
steps:
Expand All @@ -33,6 +35,7 @@ jobs:
path: otp_src.tar.gz

build:
if: false
name: Build Erlang/OTP
runs-on: ubuntu-latest
needs: pack
Expand Down Expand Up @@ -110,10 +113,10 @@ jobs:

## If this is a tag that has been pushed we do some release work
release:
if: false
name: Release Erlang/OTP
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'erlang/otp'
steps:
## This step outputs the tag name and whether the tag is a release or patch
## (all releases have only two version identifiers, while patches have three
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sync-github-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

# Wait for up to a minute for previous runs to complete, abort if not done by then
pre-ci:
# TODO: re-enable
if: false
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
Expand All @@ -23,8 +25,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

sync-releases:
if: false
needs: pre-ci
if: github.repository == 'erlang/otp'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/update-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
jobs:

build-debian-64bit:
if: github.repository == 'erlang/otp'
# TODO: re-enable
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -26,7 +27,7 @@ jobs:
tags: latest

build-debian-32bit:
if: github.repository == 'erlang/otp'
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -42,7 +43,7 @@ jobs:
tags: latest

build-ubuntu-64bit:
if: github.repository == 'erlang/otp'
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down