Skip to content

Commit fad857e

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 fad857e

File tree

4 files changed

+91
-7
lines changed

4 files changed

+91
-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: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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@v4
24+
- run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
25+
- name: Build
26+
run: .github/ci/build.sh
27+
- name: Tests
28+
run: |
29+
sudo make install
30+
(umask 022; make tests GOT_TEST_QUIET=)
31+
32+
alpine-build:
33+
name: Alpine (${{ matrix.compiler }})
34+
runs-on: blacksmith-4vcpu-ubuntu-2404
35+
container:
36+
image: 'thomasadam/got-alpine:latest'
37+
strategy:
38+
matrix:
39+
compiler: [gcc, clang]
40+
env:
41+
CI_OS: alpine
42+
CI_COMPILER: ${{ matrix.compiler }}
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
- run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
47+
- name: Build
48+
run: .github/ci/build.sh
49+
- name: Install
50+
run: make install
51+
- name: Setup SSH
52+
run: |
53+
ssh-keygen -A
54+
/usr/sbin/sshd -D &
55+
- name: Run Tests
56+
run: |
57+
(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)