Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update actions; move centos-7 to its own workflow - v3 #10384

Closed
wants to merge 9 commits into from
4 changes: 2 additions & 2 deletions .github/workflows/authors-done.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- run: echo "Author check is complete"

- name: Download artifact new authors
uses: actions/github-script@v6
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
Expand All @@ -38,7 +38,7 @@ jobs:
fi
- name: Comment on PR
if: ${{ env.new_authors == 'yes' }}
uses: actions/github-script@v6
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ name: New Authors Check
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-id:
name: New Author Check
runs-on: ubuntu-latest
steps:
- name: Checkout PR code
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
Expand All @@ -35,7 +39,7 @@ jobs:
- run: echo ${{ github.event.number }} > new-authors/pr-number.txt
- run: ls -l
- name: Upload new authors
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: new-authors
path: new-authors
Expand Down
177 changes: 177 additions & 0 deletions .github/workflows/build-centos-7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
name: build-centos-7

on:
push:
pull_request:
workflow_dispatch:
inputs:
LIBHTP_REPO:
LIBHTP_BRANCH:
SU_REPO:
SU_BRANCH:
SV_REPO:
SV_BRANCH:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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"

jobs:
centos-7:
runs-on: ubuntu-latest
container: centos:7
steps:
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo
key: ${{ github.job }}-cargo

- name: Cache RPMs
uses: actions/[email protected]
with:
path: /var/cache/yum
key: ${{ github.job }}-yum

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

- 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
# github.event.pull_request.body has the body from the
# initial pull request.
PR_HREF: ${{ github.event.pull_request._links.self.href }}
run: |
if test "${PR_HREF}"; then
body=$(curl -s "${PR_HREF}" | jq -r .body | tr -d '\r')

echo "Parsing branch and PR info from:"
echo "${body}"

LIBHTP_REPO=$(echo "${body}" | awk -F = '/^LIBHTP_REPO=/ { print $2 }')
LIBHTP_BRANCH=$(echo "${body}" | awk -F = '/^LIBHTP_BRANCH=/ { print $2 }')

SU_REPO=$(echo "${body}" | awk -F = '/^SU_REPO=/ { print $2 }')
SU_BRANCH=$(echo "${body}" | awk -F = '/^SU_BRANCH=/ { print $2 }')

SV_REPO=$(echo "${body}" | awk -F = '/^SV_REPO=/ { print $2 }')
SV_BRANCH=$(echo "${body}" | awk -F = '/^SV_BRANCH=/ { print $2 }')
else
echo "No pull request body, will use inputs or defaults."
LIBHTP_REPO=${{ inputs.LIBHTP_REPO }}
LIBHTP_BRANCH=${{ inputs.LIBHTP_BRANCH }}
SU_REPO=${{ inputs.SU_REPO }}
SU_BRANCH=${{ inputs.SU_BRANCH }}
SV_REPO=${{ inputs.SV_REPO }}
SV_BRANCH=${{ inputs.SV_BRANCH }}
fi

# If the _REPO variables don't contain a full URL, add GitHub.
if [ "${LIBHTP_REPO}" ] && ! echo "${LIBHTP_REPO}" | grep -q '^https://'; then
LIBHTP_REPO="https://github.com/${LIBHTP_REPO}"
fi
if [ "${SU_REPO}" ] && ! echo "${SU_REPO}" | grep -q '^https://'; then
SU_REPO="https://github.com/${SU_REPO}"
fi
if [ "${SV_REPO}" ] && ! echo "${SV_REPO}" | grep -q '^https://'; then
SV_REPO="https://github.com/${SV_REPO}"
fi

echo LIBHTP_REPO=${LIBHTP_REPO} | tee -a ${GITHUB_ENV}
echo LIBHTP_BRANCH=${LIBHTP_BRANCH} | tee -a ${GITHUB_ENV}

echo SU_REPO=${SU_REPO} | tee -a ${GITHUB_ENV}
echo SU_BRANCH=${SU_BRANCH} | tee -a ${GITHUB_ENV}

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}"

- name: Install cbindgen
run: |
cargo install --debug cbindgen
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

# Now checkout Suricata for the bundle script.
- name: Checking out Suricata
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744

- run: ./scripts/bundle.sh

- name: Fetching suricata-verify
run: |
# Looking for a pull request number. in the SV_BRANCH
# value. This could be "pr/NNN", "pull/NNN" or a link to an
# OISF/suricata-verify pull request.
pr=$(echo "${SV_BRANCH}" | sed -n \
-e 's/^https:\/\/github.com\/OISF\/suricata-verify\/pull\/\([0-9]*\)$/\1/p' \
-e 's/^pull\/\([0-9]*\)$/\1/p' \
-e 's/^pr\/\([0-9]*\)$/\1/p')
if [ "${pr}" ]; then
SV_BRANCH="refs/pull/${pr}/head"
echo "Using suricata-verify pull-request ${SV_BRANCH}"
else
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

- run: ./autogen.sh
- run: ./configure
- run: make -j ${{ env.CPUS }}
- run: python3 ./suricata-verify/run.py -q --debug-failed
- run: make install-full
- run: suricata-update -V
- run: suricatasc -h
Loading
Loading