Skip to content

Commit 19b0313

Browse files
committed
Add GitHub Actions CI for multi-platform builds
Test builds on Fedora, RockyLinux 9, Ubuntu, macOS, and FreeBSD. Create distribution tarball on release. Also fix Makefile.am to include string-compat.h and RELEASING.md in dist.
1 parent 9cd019f commit 19b0313

File tree

3 files changed

+112
-4
lines changed

3 files changed

+112
-4
lines changed

.github/workflows/build.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [master, devel]
6+
pull_request:
7+
branches: [master, devel]
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
build-linux:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: ${{ matrix.container }}
16+
strategy:
17+
matrix:
18+
include:
19+
- container: fedora:latest
20+
deps: dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel
21+
- container: rockylinux:9
22+
deps: dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb && dnf install -y epel-release && dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel
23+
- container: ubuntu:latest
24+
deps: apt-get update && apt-get install -y gcc make autoconf automake libpcap-dev libevent-dev libdumbnet-dev
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Install dependencies
31+
run: ${{ matrix.deps }}
32+
33+
- name: Autoreconf
34+
run: autoreconf -f -i
35+
36+
- name: Configure
37+
run: ./configure
38+
39+
- name: Build
40+
run: make
41+
42+
- name: Test binary
43+
run: ./scanssh -V
44+
45+
build-macos:
46+
runs-on: macos-latest
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Install dependencies
52+
run: brew install autoconf automake libpcap libevent libdnet
53+
54+
- name: Autoreconf
55+
run: autoreconf -f -i
56+
57+
- name: Configure
58+
run: |
59+
./configure \
60+
--with-libpcap=$(brew --prefix libpcap) \
61+
--with-libevent=$(brew --prefix libevent) \
62+
--with-libdnet=$(brew --prefix libdnet)
63+
64+
- name: Build
65+
run: make
66+
67+
- name: Test binary
68+
run: ./scanssh -V
69+
70+
build-freebsd:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Build on FreeBSD
77+
uses: vmactions/freebsd-vm@v1
78+
with:
79+
usesh: true
80+
prepare: pkg install -y gcc gmake autoconf automake libpcap libevent libdnet
81+
run: |
82+
autoreconf -f -i
83+
./configure
84+
make
85+
./scanssh -V
86+
87+
create-dist:
88+
runs-on: ubuntu-latest
89+
container: fedora:latest
90+
needs: [build-linux, build-macos, build-freebsd]
91+
if: github.event_name == 'release'
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v4
95+
96+
- name: Install dependencies
97+
run: dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel
98+
99+
- name: Create distribution
100+
run: |
101+
autoreconf -f -i
102+
./configure
103+
make dist
104+
105+
- name: Upload release asset
106+
uses: softprops/action-gh-release@v2
107+
with:
108+
files: scanssh-*.tar.gz

Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/@DNETCOMPAT@ -I$(top_srcdir)/compat \
1313

1414
man_MANS = scanssh.1
1515

16-
EXTRA_DIST = $(man_MANS) README.md \
17-
md5.c err.c \
16+
EXTRA_DIST = $(man_MANS) README.md RELEASING.md \
17+
md5.c err.c string-compat.h \
1818
compat/libdnet/dnet.h \
1919
compat/err.h compat/md5.h \
2020
compat/sys/queue.h compat/sys/tree.h

Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/@DNETCOMPAT@ -I$(top_srcdir)/compat \
337337
@EVENTINC@ @PCAPINC@ @DNETINC@
338338

339339
man_MANS = scanssh.1
340-
EXTRA_DIST = $(man_MANS) README.md \
341-
md5.c err.c \
340+
EXTRA_DIST = $(man_MANS) README.md RELEASING.md \
341+
md5.c err.c string-compat.h \
342342
compat/libdnet/dnet.h \
343343
compat/err.h compat/md5.h \
344344
compat/sys/queue.h compat/sys/tree.h

0 commit comments

Comments
 (0)