Skip to content

Commit 6934f71

Browse files
cdeckerrustyrussell
authored andcommitted
gci: Add basic configuration for Github Actions as CI
1 parent 6bed85b commit 6934f71

File tree

2 files changed

+182
-0
lines changed

2 files changed

+182
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
name: Continuous Integration
3+
on: [push, pull_request]
4+
jobs:
5+
build-and-test:
6+
strategy:
7+
fail-fast: false
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/[email protected]
12+
13+
- name: Set up Python 3.6
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.6
17+
18+
- name: Install dependencies
19+
run: |
20+
export DEBIAN_FRONTEND=noninteractive
21+
export BITCOIN_VERSION=0.20.1
22+
export ELEMENTS_VERSION=0.18.1.8
23+
sudo useradd -ms /bin/bash tester
24+
sudo apt-get update -qq
25+
26+
sudo apt-get -qq install --no-install-recommends --allow-unauthenticated -yy \
27+
autoconf \
28+
automake \
29+
binfmt-support \
30+
build-essential \
31+
clang \
32+
cppcheck \
33+
docbook-xml \
34+
eatmydata \
35+
gcc-aarch64-linux-gnu \
36+
gcc-arm-linux-gnueabihf \
37+
gcc-arm-none-eabi \
38+
gettext \
39+
git \
40+
libc6-dev-arm64-cross \
41+
libc6-dev-armhf-cross \
42+
libgmp-dev \
43+
libpq-dev \
44+
libprotobuf-c-dev \
45+
libsqlite3-dev \
46+
libtool \
47+
libxml2-utils \
48+
locales \
49+
net-tools \
50+
postgresql \
51+
python-pkg-resources \
52+
python3 \
53+
python3-dev \
54+
python3-pip \
55+
python3-setuptools \
56+
qemu \
57+
qemu-system-arm \
58+
qemu-user-static \
59+
shellcheck \
60+
software-properties-common \
61+
sudo \
62+
tcl \
63+
unzip \
64+
valgrind \
65+
wget \
66+
xsltproc \
67+
zlib1g-dev
68+
69+
echo "tester ALL=(root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/tester
70+
sudo chmod 0440 /etc/sudoers.d/tester
71+
72+
cd /tmp/ && \
73+
wget https://storage.googleapis.com/c-lightning-tests/bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.bz2 && \
74+
wget -q https://storage.googleapis.com/c-lightning-tests/elements-$ELEMENTS_VERSION-x86_64-linux-gnu.tar.bz2 && \
75+
tar -xjf bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.bz2 && \
76+
tar -xjf elements-$ELEMENTS_VERSION-x86_64-linux-gnu.tar.bz2 && \
77+
sudo mv bitcoin-$BITCOIN_VERSION/bin/* /usr/local/bin && \
78+
sudo mv elements-$ELEMENTS_VERSION/bin/* /usr/local/bin && \
79+
rm -rf \
80+
bitcoin-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz \
81+
bitcoin-$BITCOIN_VERSION \
82+
elements-$ELEMENTS_VERSION-x86_64-linux-gnu.tar.bz2 \
83+
elements-$ELEMENTS_VERSION
84+
85+
- name: Build
86+
run: |
87+
echo Running in $(pwd)
88+
export ARCH=${ARCH:-64}
89+
export BOLTDIR=lightning-rfc
90+
export CC=${COMPILER:-gcc}
91+
export COMPAT=${COMPAT:-1}
92+
export TEST_CHECK_DBSTMTS=${TEST_CHECK_DBSTMTS:-0}
93+
export DEVELOPER=${DEVELOPER:-1}
94+
export EXPERIMENTAL_FEATURES=${EXPERIMENTAL_FEATURES:-0}
95+
export PATH=$CWD/dependencies/bin:"$HOME"/.local/bin:"$PATH"
96+
export PYTEST_OPTS="--maxfail=5 --reruns=2 --suppress-no-test-exit-code ${PYTEST_OPTS}"
97+
export PYTEST_PAR=${PYTEST_PAR:-10}
98+
export PYTEST_SENTRY_ALWAYS_REPORT=1
99+
export SLOW_MACHINE=1
100+
export TEST_CMD=${TEST_CMD:-"make -j $PYTEST_PAR pytest"}
101+
export TEST_DB_PROVIDER=${DB:-"sqlite3"}
102+
export TEST_NETWORK=${NETWORK:-"regtest"}
103+
export TIMEOUT=900
104+
export VALGRIND=${VALGRIND:-0}
105+
106+
env
107+
108+
pip3 install --user -U \
109+
-r requirements.txt \
110+
-r contrib/pyln-client/requirements.txt \
111+
-r contrib/pyln-proto/requirements.txt \
112+
-r contrib/pyln-testing/requirements.txt
113+
114+
# Install utilities that aren't dependencies, but make running
115+
# tests easier/feasible on CI
116+
pip3 install --user \
117+
blinker \
118+
pytest-sentry \
119+
pytest-rerunfailures==9.1.1 \
120+
pytest-test-groups==1.0.3 \
121+
pytest-custom-exit-code==0.3.0
122+
123+
git clone https://github.com/lightningnetwork/lightning-rfc.git ../lightning-rfc
124+
125+
git submodule init
126+
git submodule update
127+
(cd external/libwally-core/src/; git submodule init; git submodule update)
128+
129+
./configure CC="$CC"
130+
cat config.vars
131+
132+
if [ "$TARGET_HOST" == "arm-linux-gnueabihf" ] || [ "$TARGET_HOST" == "aarch64-linux-gnu" ]
133+
then
134+
export QEMU_LD_PREFIX=/usr/"$TARGET_HOST"/
135+
export MAKE_HOST="$TARGET_HOST"
136+
export BUILD=x86_64-pc-linux-gnu
137+
export AR="$TARGET_HOST"-ar
138+
export AS="$TARGET_HOST"-as
139+
export CC="$TARGET_HOST"-gcc
140+
export CXX="$TARGET_HOST"-g++
141+
export LD="$TARGET_HOST"-ld
142+
export STRIP="$TARGET_HOST"-strip
143+
export CONFIGURATION_WRAPPER=qemu-"${TARGET_HOST%%-*}"-static
144+
145+
wget -q https://zlib.net/zlib-1.2.11.tar.gz \
146+
&& tar xf zlib-1.2.11.tar.gz \
147+
&& cd zlib-1.2.11 \
148+
&& ./configure --prefix="$QEMU_LD_PREFIX" \
149+
&& make \
150+
&& sudo make install
151+
cd .. && rm zlib-1.2.11.tar.gz && rm -rf zlib-1.2.11
152+
153+
wget -q https://www.sqlite.org/2018/sqlite-src-3260000.zip \
154+
&& unzip -q sqlite-src-3260000.zip \
155+
&& cd sqlite-src-3260000 \
156+
&& automake --add-missing --force-missing --copy || true \
157+
&& ./configure --disable-tcl --enable-static --disable-readline --disable-threadsafe --disable-load-extension --host="$TARGET_HOST" --prefix="$QEMU_LD_PREFIX" \
158+
&& make \
159+
&& sudo make install
160+
cd .. && rm sqlite-src-3260000.zip && rm -rf sqlite-src-3260000
161+
162+
wget -q https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz \
163+
&& tar xf gmp-6.1.2.tar.xz \
164+
&& cd gmp-6.1.2 \
165+
&& ./configure --disable-assembly --prefix="$QEMU_LD_PREFIX" --host="$TARGET_HOST" \
166+
&& make \
167+
&& sudo make install
168+
cd .. && rm gmp-6.1.2.tar.xz && rm -rf gmp-6.1.2
169+
170+
./configure CC="$TARGET_HOST-gcc" --enable-static
171+
172+
make -j32 CC="$TARGET_HOST-gcc" > /dev/null
173+
else
174+
eatmydata make -j32
175+
eatmydata $TEST_CMD
176+
fi

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: 'Lightning CI'
3+
description: 'A preconfigured container with all c-lightning dependencies'
4+
runs:
5+
using: 'docker'
6+
image: 'contrib/Dockerfile.tester'

0 commit comments

Comments
 (0)