Skip to content

Commit

Permalink
centos-fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonish committed Feb 9, 2024
1 parent ba5bd7b commit 17e7263
Showing 1 changed file with 70 additions and 137 deletions.
207 changes: 70 additions & 137 deletions .github/workflows/legacy-centos-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,71 @@ permissions: read-all
env:
DEFAULT_SV_REPO: https://github.com/OISF/suricata-verify
DEFAULT_SV_BRANCH: master

DEFAULT_CFLAGS: "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-function"

# Apt sometimes likes to ask for user input, this will prevent that.
DEBIAN_FRONTEND: "noninteractive"

# A recent version of stable Rust that is known to pass build, test and other
# verification steps in this workflow. This was added because using "stable"
# could cause some steps to fail.
RUST_VERSION_KNOWN: "1.70.0"

# The minimum version of Rust supported.
RUST_VERSION_MIN: "1.63.0"

jobs:

prepare-deps:
name: Prepare dependencies
# Actions pinned to v3 for now as the newer ones require a newer glibc:
# https://github.com/actions/runner/pull/3128
centos-7:
name: CentOS 7
runs-on: ubuntu-latest
container: centos:7
steps:
- name: Dumping github context for debugging
run: echo $JSON
env:
JSON: ${{ toJSON(github) }}
- run: sudo apt update && sudo apt -y install jq curl
- name: Cache ~/.cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ github.job }}-cargo

- name: Cache RPMs
uses: actions/cache@v3
with:
path: /var/cache/yum
key: ${{ github.job }}-yum
- run: echo "keepcache=1" >> /etc/yum.conf

- name: Determine number of CPUs
run: echo CPUS=$(nproc --all) >> $GITHUB_ENV

- name: Install system dependencies
run: |
yum -y install epel-release
yum -y install \
autoconf \
automake \
cargo \
curl \
diffutils \
file-devel \
gcc \
gcc-c++ \
git \
jansson-devel \
jq \
lua-devel \
libtool \
libyaml-devel \
libnfnetlink-devel \
libnetfilter_queue-devel \
libnet-devel \
libcap-ng-devel \
libevent-devel \
libmaxminddb-devel \
libpcap-devel \
lz4-devel \
make \
nss-devel \
pcre2-devel \
pkgconfig \
python36-PyYAML \
rust \
sudo \
which \
zlib-devel
#################################

- name: Parse repo and branch information
env:
# We fetch the actual pull request to get the latest body as
Expand Down Expand Up @@ -97,28 +137,26 @@ jobs:
echo SV_REPO=${SV_REPO:-${DEFAULT_SV_REPO}} | tee -a ${GITHUB_ENV}
echo SV_BRANCH=${SV_BRANCH:-${DEFAULT_SV_BRANCH}} | tee -a ${GITHUB_ENV}
- name: Annotate output
run: |
echo "::notice:: LIBHTP_REPO=${LIBHTP_REPO}"
echo "::notice:: LIBHTP_BRANCH=${LIBHTP_BRANCH}"
echo "::notice:: SU_REPO=${SU_REPO}"
echo "::notice:: SU_BRANCH=${SU_BRANCH}"
echo "::notice:: SV_REPO=${SV_REPO}"
echo "::notice:: SV_BRANCH=${SV_BRANCH}"
# Now checkout Suricata for the bundle script.
- name: Checking out Suricata
uses: actions/checkout@v4.1.1
- name: Fetching libhtp
run: |
DESTDIR=./bundle ./scripts/bundle.sh libhtp
tar zcf libhtp.tar.gz -C bundle libhtp
- name: Fetching suricata-update
#################################

- name: Install cbindgen
run: |
DESTDIR=./bundle ./scripts/bundle.sh suricata-update
tar zcf suricata-update.tar.gz -C bundle suricata-update
cargo install --force --debug cbindgen
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3

- name: Fetching libhtp
run: ./scripts/bundle.sh libhtp
- name: Fetching suricata-update
run: ./scripts/bundle.sh suricata-update
- name: Fetching suricata-verify
run: |
# Looking for a pull request number. in the SV_BRANCH
Expand All @@ -135,113 +173,8 @@ jobs:
echo "Using suricata-verify branch ${SV_BRANCH}"
fi
git clone --depth 1 ${SV_REPO} suricata-verify
cd suricata-verify
git fetch --depth 1 origin ${SV_BRANCH}
git -c advice.detachedHead=false checkout FETCH_HEAD
cd ..
tar zcf suricata-verify.tar.gz suricata-verify
- name: Uploading prep archive
uses: actions/upload-artifact@v3
with:
name: prep
path: |
libhtp.tar.gz
suricata-update.tar.gz
suricata-verify.tar.gz
overwrite: true

prepare-cbindgen:
name: Prepare cbindgen
runs-on: ubuntu-latest
steps:
- name: Cache ~/.cargo
uses: actions/cache@v4.0.0
with:
path: ~/.cargo
key: ${{ github.job }}-cargo
- name: Installing Rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
rustup target add x86_64-unknown-linux-musl
- name: Building static cbindgen for Linux
run: |
cargo install --target x86_64-unknown-linux-musl --debug cbindgen
cp $HOME/.cargo/bin/cbindgen .
- name: Uploading cbindgen artifact
uses: actions/upload-artifact@v3
with:
name: cbindgen
path: .

# Actions pinned to v3 for now as the newer ones require a newer glibc:
# https://github.com/actions/runner/pull/3128
centos-7:
name: CentOS 7
runs-on: ubuntu-latest
container: centos:7
needs: [prepare-deps, debian-12-dist]
steps:
- name: Cache ~/.cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ github.job }}-cargo

- name: Cache RPMs
uses: actions/cache@v3
with:
path: /var/cache/yum
key: ${{ github.job }}-yum
- run: echo "keepcache=1" >> /etc/yum.conf

- name: Determine number of CPUs
run: echo CPUS=$(nproc --all) >> $GITHUB_ENV
- name: Install system dependencies
run: |
yum -y install epel-release
yum -y install \
autoconf \
automake \
cargo \
diffutils \
file-devel \
gcc \
gcc-c++ \
jansson-devel \
jq \
lua-devel \
libtool \
libyaml-devel \
libnfnetlink-devel \
libnetfilter_queue-devel \
libnet-devel \
libcap-ng-devel \
libevent-devel \
libmaxminddb-devel \
libpcap-devel \
lz4-devel \
make \
nss-devel \
pcre2-devel \
pkgconfig \
python36-PyYAML \
rust \
sudo \
which \
zlib-devel
- name: Download suricata.tar.gz
uses: actions/download-artifact@v3
with:
name: dist
- run: tar zxf suricata-*.tar.gz --strip-components=1
# This isn't really needed as we are building from a prepared
# package, but some package managers like RPM and Debian like to
# run this command even on prepared packages, so make sure it
# works.
- name: Test autoreconf
run: autoreconf -fv --install
- run: ./autogen.sh
- run: CFLAGS="${DEFAULT_CFLAGS}" ./configure
- run: make -j ${{ env.CPUS }}
- run: make install
Expand Down

0 comments on commit 17e7263

Please sign in to comment.