Skip to content

Commit 70ccb2d

Browse files
committed
portable: CI: use GH and Cirrus
Try and implement CI across systems for better performance. Curently, a WIP.
1 parent 56dc167 commit 70ccb2d

File tree

4 files changed

+95
-7
lines changed

4 files changed

+95
-7
lines changed

.github/ci/before-install.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
#!/bin/sh
22

3-
if [ "$CIRRUS_OS" = "linux" ]; then
4-
apt-get update -qq && \
5-
apt-get --no-install-suggests --no-install-recommends -y install \
3+
set -xv
4+
SUDO="sudo"
5+
export SUDO
6+
7+
which_ci() {
8+
if [ -n "$RUNNER_OS" ]; then
9+
# GitHub Actions
10+
case "$RUNNER_OS" in
11+
Linux)
12+
unset SUDO
13+
echo "linux" ;;
14+
esac
15+
elif [ -n "$CIRRUS_OS" ]; then
16+
# Cirrus CI
17+
echo "$CIRRUS_OS"
18+
fi
19+
}
20+
21+
OS="$(which_ci)"
22+
23+
echo "CI_OS=$CI_OS"
24+
25+
if [ "$OS" = "linux" ]; then
26+
if [ "$CI_OS" == "alpine" ]; then
27+
apk add libevent-dev git build-base bsd-compat-headers bison automake make autoconf libbsd-dev util-linux-dev libressl-dev zlib-dev ncurses-dev openssh ed gcc clang
28+
else
29+
"$SUDO" apt-get update -qq && \
30+
"$SUDO" apt-get --no-install-suggests --no-install-recommends -y install \
631
athena-jot \
732
autoconf \
833
autoconf-archive \
@@ -11,6 +36,7 @@ if [ "$CIRRUS_OS" = "linux" ]; then
1136
bison \
1237
build-essential \
1338
ed \
39+
clang \
1440
git \
1541
libbsd-dev \
1642
libevent-dev \
@@ -22,9 +48,10 @@ if [ "$CIRRUS_OS" = "linux" ]; then
2248
pkg-config \
2349
uuid-dev \
2450
zlib1g-dev
51+
fi
2552
fi
2653

27-
if [ "$CIRRUS_OS" = "freebsd" ]; then
54+
if [ "$OS" = "freebsd" ]; then
2855
pkg install -y \
2956
automake \
3057
pkgconf \
@@ -35,7 +62,7 @@ if [ "$CIRRUS_OS" = "freebsd" ]; then
3562
p5-HTTP-Daemon-SSL
3663
fi
3764

38-
if [ "$CIRRUS_OS" = "darwin" ]; then
65+
if [ "$OS" = "darwin" ]; then
3966
brew install autoconf \
4067
automake \
4168
bison \

.github/ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
./autogen.sh || exit 1
44
./configure || exit 1
5-
exec make
5+
exec make -j4

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: GoT-portable CI
2+
3+
on:
4+
push:
5+
branches:
6+
- portable
7+
- ta/cirrus-updates
8+
9+
jobs:
10+
ubuntu-build:
11+
name: Ubuntu (${{ matrix.compiler }})
12+
runs-on: blacksmith-4vcpu-ubuntu-2404
13+
container:
14+
image: 'thomasadam/got-libc:latest'
15+
strategy:
16+
matrix:
17+
compiler: [gcc, clang]
18+
env:
19+
CI_OS: linux
20+
CI_COMPILER: ${{ matrix.compiler }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v5
24+
with:
25+
fetch-depth: 0
26+
- run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
27+
- name: Build
28+
run: .github/ci/build.sh
29+
- name: Tests
30+
if: ${{ matrix.compiler == 'gcc' }}
31+
run: |
32+
sudo make install
33+
(umask 022; make tests -j4 GOT_TEST_QUIET=)
34+
35+
alpine-build:
36+
name: Alpine (${{ matrix.compiler }})
37+
runs-on: blacksmith-4vcpu-ubuntu-2404
38+
container:
39+
image: 'thomasadam/got-alpine:latest'
40+
strategy:
41+
matrix:
42+
compiler: [gcc, clang]
43+
env:
44+
CI_OS: alpine
45+
CI_COMPILER: ${{ matrix.compiler }}
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
- run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
50+
- name: Build
51+
run: .github/ci/build.sh
52+
- name: Install
53+
run: make install
54+
- name: Setup SSH
55+
run: |
56+
ssh-keygen -A
57+
/usr/sbin/sshd -D &
58+
- name: Run Tests
59+
if: ${{ matrix.compiler == 'gcc' }}
60+
run: |
61+
(umask 022; make tests GOT_TEST_QUIET=)

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,4 @@ regress-path:
299299

300300
regress-tog:
301301
(cd $(top_builddir)/regress/tog || exit $$?; \
302-
./log.sh -q -r "$(GOT_TEST_ROOT)");
302+
./log.sh $(GOT_TEST_QUIET) -r "$(GOT_TEST_ROOT)");

0 commit comments

Comments
 (0)