Skip to content

Commit 3c8e73d

Browse files
committed
otp: Add github workflow test scripts
1 parent a3f17eb commit 3c8e73d

14 files changed

+1115
-93
lines changed

.github/dockerfiles/Dockerfile.32-bit

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM docker.pkg.github.com/erlang/otp/i386-debian-base
2+
3+
ARG MAKEFLAGS=-j4
4+
ENV MAKEFLAGS=$MAKEFLAGS \
5+
ERLC_USE_SERVER=yes \
6+
ERL_TOP=/buildroot/otp \
7+
PATH=/buildroot/otp/bin:$PATH
8+
9+
ARG ARCHIVE=./otp.tar.gz
10+
COPY $ARCHIVE /buildroot/otp.tar.gz
11+
RUN cd /buildroot && tar xzf ./otp.tar.gz
12+
13+
WORKDIR /buildroot/otp/
14+
15+
RUN ./configure --prefix=/otp && make && make install
16+
17+
RUN TESTSUITE_ROOT=/tests ./otp_build tests
18+
19+
ENTRYPOINT ["bash","-c"]

.github/dockerfiles/Dockerfile.64-bit

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM docker.pkg.github.com/erlang/otp/ubuntu-base
2+
3+
## We do a SSA lint check here
4+
ENV ERL_COMPILER_OPTIONS=ssalint
5+
6+
ARG MAKEFLAGS=-j4
7+
ENV MAKEFLAGS=$MAKEFLAGS \
8+
ERLC_USE_SERVER=yes \
9+
ERL_TOP=/buildroot/otp \
10+
PATH=/buildroot/otp/bin:$PATH
11+
12+
ARG ARCHIVE=./otp.tar.gz
13+
COPY $ARCHIVE /buildroot/otp.tar.gz
14+
RUN cd /buildroot && tar xzf ./otp.tar.gz
15+
16+
WORKDIR /buildroot/otp/
17+
18+
RUN ./configure --prefix=/otp && make && make install
19+
20+
RUN TESTSUITE_ROOT=/tests ./otp_build tests
21+
22+
ENTRYPOINT ["bash","-c"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
##
2+
## This docker file will build Erlang on 32-bit to 64-bit x86
3+
##
4+
FROM docker.pkg.github.com/erlang/otp/i386-debian-base as build
5+
6+
ARG HOST_ARCH=amd64
7+
ARG HOST_TRIP=x86_64-linux-gnu
8+
9+
ARG MAKEFLAGS=-j4
10+
ENV MAKEFLAGS=$MAKEFLAGS \
11+
ERLC_USE_SERVER=yes \
12+
ERL_TOP=/buildroot/otp
13+
14+
ARG ARCHIVE=./otp.tar.gz
15+
COPY $ARCHIVE /buildroot/otp.tar.gz
16+
RUN cd /buildroot && tar xzf ./otp.tar.gz
17+
18+
WORKDIR /buildroot/otp
19+
20+
## Build the bootstrap system
21+
RUN ./configure && make && make install
22+
23+
## Prepare for a new build
24+
RUN cd .. && rm -rf otp && tar xzf ./otp.tar.gz
25+
26+
ENV HOST=$HOST_TRIP \
27+
CC=$HOST_TRIP-gcc \
28+
CPP=$HOST_TRIP-cpp \
29+
CXX=$HOST_TRIP-g++ \
30+
LD=$CC \
31+
DED_LDFLAGS="-shared -Wl,-Bsymbolic" \
32+
RANLIB=$HOST_TRIP-ranlib \
33+
AR=$HOST_TRIP-ar \
34+
erl_xcomp_sysroot=/buildroot/sysroot
35+
36+
## Build the cross system
37+
RUN ./configure --prefix=/otp/ --host=$HOST --build=`erts/autoconf/config.guess` && \
38+
make && make install
39+
40+
## Build the cross tests
41+
RUN ./otp_build tests
42+
RUN cd release/tests/test_server && \
43+
erl -sname test@docker -noshell -eval "ts:install([{cross,\"yes\"},{crossflags,[{\"host\",\"$HOST\"}]},{crossroot,\"/$ERL_TOP\"}])." -s ts compile_testcases -s init stop
44+
45+
FROM debian as install
46+
47+
# Install the released application
48+
COPY --from=build /otp /otp
49+
COPY --from=build /buildroot/otp/release/tests /tests
50+
51+
ENV PATH=/otp/bin:$PATH
52+
53+
ENTRYPOINT ["bash","-c"]
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
##
2+
## This docker file will build a base image for building Erlang/OTP
3+
##
4+
ARG BASE=debian
5+
FROM $BASE
6+
## Need to have a second arg here as the first does not expose the $BASE in the script below
7+
ARG BASE=debian
8+
9+
ARG HOST_ARCH=amd64
10+
ARG HOST_TRIP=x86_64-linux-gnu
11+
12+
ENV INSTALL_LIBS="zlib1g-dev libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxbase3.0-dev libwxgtk3.0-dev libsctp-dev lksctp-tools"
13+
14+
## See https://wiki.debian.org/Multiarch/HOWTO for details on how to install things
15+
RUN if [ "$BASE" = "i386/debian" ]; then BUILD_ARCH=`dpkg --print-architecture` && \
16+
dpkg --add-architecture $HOST_ARCH && \
17+
sed -i "s:deb http:deb [arch=$BUILD_ARCH,$HOST_ARCH] http:g" /etc/apt/sources.list; \
18+
fi
19+
20+
RUN apt-get update && \
21+
apt-get -y upgrade && \
22+
apt-get install -y build-essential m4 autoconf fop xsltproc \
23+
default-jdk libxml2-utils $INSTALL_LIBS
24+
25+
RUN if [ "$BASE" = "i386/debian" ]; then apt-get install -y \
26+
crossbuild-essential-$HOST_ARCH \
27+
$(for LIB in $INSTALL_LIBS; do echo "$LIB:$HOST_ARCH"; done) && \
28+
for dir in `find / -type d -name $HOST_TRIP`; do \
29+
echo -n "$dir: /buildroot/sysroot"; \
30+
echo `dirname $dir`; \
31+
mkdir -p /buildroot/sysroot$dir; \
32+
cp -r `dirname $dir`/* `dirname /buildroot/sysroot$dir`; \
33+
cp -r $dir/* `dirname /buildroot/sysroot$dir`; \
34+
done; fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM docker.pkg.github.com/erlang/otp/ubuntu-base
2+
3+
ARG MAKEFLAGS=-j4
4+
ENV MAKEFLAGS=$MAKEFLAGS \
5+
ERLC_USE_SERVER=yes \
6+
ERL_TOP=/buildroot/otp \
7+
PATH=/buildroot/otp/bin:$PATH
8+
9+
ARG ARCHIVE=./otp.tar.gz
10+
COPY $ARCHIVE /buildroot/otp.tar.gz
11+
RUN cd /buildroot && tar xzf ./otp.tar.gz
12+
13+
WORKDIR /buildroot/otp/
14+
15+
## We don't build pdf in order to save some time
16+
ENV RELEASE_ROOT=/otp DOC_TARGETS="html man chunks"
17+
18+
RUN ./configure && make && make release
19+
20+
RUN make docs release_docs
21+
22+
ENTRYPOINT ["bash","-c"]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##
2+
## This docker file will build a base image for building Erlang/OTP
3+
##
4+
FROM ubuntu
5+
6+
ENV INSTALL_LIBS="zlib1g-dev libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxbase3.0-dev libwxgtk3.0-gtk3-dev libsctp-dev lksctp-tools"
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update && \
11+
apt-get -y upgrade && \
12+
apt-get install -y build-essential m4 autoconf fop xsltproc \
13+
default-jdk libxml2-utils $INSTALL_LIBS

.github/workflows/main.yaml

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
##
2+
## This workflow handles testing of pull requests and pushes.
3+
## It also publishes some packages to any new Erlang/OTP release
4+
##
5+
## To speed this up it would be nice if one could share docker
6+
## images inbetween different jobs, but at the moment this is
7+
## not possible so we need to rebuild all of Erlang/OTP multiple
8+
## times.
9+
##
10+
## Also once the windows runner supports WSL we should implement
11+
## support for building Erlang/OTP here.
12+
##
13+
14+
name: Build, verify and possibly release Erlang/OTP
15+
16+
on:
17+
push:
18+
pull_request:
19+
20+
jobs:
21+
22+
pack:
23+
name: Pack the Erlang/OTP tar.gz
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Commit autoconf files
28+
## We first commit the autoconf generate so that they
29+
## are kept in the pre-built achive
30+
run: |
31+
./otp_build autoconf
32+
find . -name aclocal.m4 | xargs git add -f
33+
find . -name configure | xargs git add -f
34+
find . -name config.h.in | xargs git add -f
35+
find . -name config.guess | xargs git add -f
36+
find . -name config.sub | xargs git add -f
37+
find . -name install-sh | xargs git add -f
38+
git config --global user.email "[email protected]"
39+
git config --global user.name "Your Name"
40+
git commit --no-verify -m 'Add generated configure files'
41+
- name: Archive git repository
42+
run: git archive --prefix otp/ -o otp_src.tar.gz HEAD
43+
- name: Upload source tar archive
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: otp_git_archive
47+
path: otp_src.tar.gz
48+
49+
build:
50+
name: Build Erlang/OTP
51+
runs-on: ubuntu-latest
52+
needs: pack
53+
54+
strategy:
55+
matrix:
56+
type: [64-bit,32-bit,cross-compile,documentation]
57+
fail-fast: false
58+
59+
steps:
60+
- uses: actions/checkout@v2
61+
- name: Download source archive
62+
uses: actions/download-artifact@v2
63+
with:
64+
name: otp_git_archive
65+
## We need to login to the package registry in order to pull
66+
## the base debian image.
67+
- name: Docker login
68+
run: docker login https://docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
69+
- name: Build ${{ matrix.type }} image
70+
run: |
71+
docker build -t otp --build-arg ARCHIVE=otp_src.tar.gz \
72+
-f .github/dockerfiles/Dockerfile.${{ matrix.type }} .
73+
74+
## Smoke build tests
75+
- if: matrix.type == '32-bit' || matrix.type == '64-bit' || matrix.type == 'cross-compile'
76+
name: Run smoke test
77+
run: |
78+
docker run -v $PWD/scripts:/scripts otp "cd /tests && /scripts/run-smoke-tests"
79+
80+
## Documentation checks
81+
- if: matrix.type == 'documentation'
82+
name: Run xmllimt
83+
run: docker run otp "make xmllint"
84+
- if: matrix.type == 'documentation'
85+
name: Run html link check
86+
run: docker run -v $PWD/scripts:/scripts otp "/scripts/otp_html_check /otp doc/index.html"
87+
- if: matrix.type == 'documentation'
88+
name: Run html link check
89+
run: docker run otp "erlc lib/stdlib/test/shell_docs_SUITE.erl && ct_run -noshell -no_auto_compile -suite shell_docs_SUITE -case render"
90+
91+
## Run dialyzer
92+
- if: matrix.type == '64-bit'
93+
name: Run dialyzer
94+
run: docker run -v $PWD/scripts:/scripts otp "/scripts/run-dialyzer"
95+
96+
## Build pre-built tar archives
97+
- if: matrix.type == '32-bit'
98+
name: Build pre-built tar archives
99+
run: |
100+
docker run -v $PWD:/github otp \
101+
"scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /buildroot/otp.tar.gz"
102+
- if: matrix.type == '32-bit'
103+
name: Upload pre-built tar archive
104+
uses: actions/upload-artifact@v2
105+
with:
106+
name: otp_prebuilt
107+
path: otp_src.tar.gz
108+
109+
## If this is a tag that has been pushed we do some release work
110+
release:
111+
name: Release Erlang/OTP
112+
runs-on: ubuntu-latest
113+
needs: build
114+
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'garazdawi/otp'
115+
steps:
116+
- uses: actions/checkout@v2
117+
118+
## This step outputs the tag name and whether the tag is a release or patch
119+
## (all releases have only two version identifiers, while patches have three
120+
## or more)
121+
- name: Get Tag Name
122+
id: tag
123+
run: |
124+
TAG=${GITHUB_REF#refs/tags/}
125+
IS_RELEASE=`$(echo $TAG | grep -E '^OTP-[0-9]+\.[0-9]+$' > /dev/null) \
126+
&& echo "true" || echo "false"`
127+
echo "::set-output name=tag::$TAG"
128+
echo "::set-output name=release::${IS_RELEASE}"
129+
130+
## Publish the pre-built archive
131+
- name: Download source archive
132+
uses: actions/download-artifact@v2
133+
with:
134+
name: otp_prebuilt
135+
- run: mv otp_src.tar.gz ${{ steps.tag.outputs.tag }}.tar.gz
136+
- name: Upload pre-built tar archive
137+
uses: softprops/action-gh-release@v1
138+
with:
139+
files: ${{ steps.tag.outputs.tag }}.tar.gz
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
143+
## Publish the Erlang/OTP bundle
144+
- name: Build OTP Bundle
145+
run: scripts/bundle-otp ${{ steps.tag.outputs.tag }}
146+
- name: Upload OTP Bundle
147+
uses: softprops/action-gh-release@v1
148+
## Only provide bundle at major and minor releases
149+
if: steps.tag.outputs.release == 'true'
150+
with:
151+
files: |
152+
${{ steps.tag.outputs.tag }}.0-bundle.txt
153+
${{ steps.tag.outputs.tag }}.0-bundle.tar.gz
154+
env:
155+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/update-base.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Update docker base image
2+
3+
## Update the base image every day
4+
on:
5+
schedule:
6+
## In UTC
7+
- cron: '0 0 * * *'
8+
9+
## Build base images to be used by other github workflows
10+
jobs:
11+
12+
build-debian-64bit:
13+
if: github.repository == 'erlang/otp'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Build and push 64-bit base image
18+
uses: docker/build-push-action@v1
19+
with:
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
registry: docker.pkg.github.com
23+
dockerfile: .github/dockerfiles/Dockerfile.debian-base
24+
repository: ${{ github.actor }}/otp/debian-base
25+
tags: latest
26+
27+
build-debian-32bit:
28+
if: github.repository == 'erlang/otp'
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Build and push 32-bit base image
33+
uses: docker/build-push-action@v1
34+
with:
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
registry: docker.pkg.github.com
38+
dockerfile: .github/dockerfiles/Dockerfile.debian-base
39+
build_args: "BASE=i386/debian"
40+
repository: ${{ github.actor }}/otp/i386-debian-base
41+
tags: latest
42+
43+
build-ubuntu-64bit:
44+
if: github.repository == 'erlang/otp'
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Build and push 64-bit base image
49+
uses: docker/build-push-action@v1
50+
with:
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
registry: docker.pkg.github.com
54+
dockerfile: .github/dockerfiles/Dockerfile.ubuntu-base
55+
repository: ${{ github.actor }}/otp/ubuntu-base
56+
tags: latest

0 commit comments

Comments
 (0)