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

More refinements to GitHub Actions CI #363

Merged
merged 4 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 0 additions & 119 deletions .github/workflows/c-cpp.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: GitHub Actions CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
container: ${{ matrix.config.container }}

strategy:
fail-fast: false
matrix:
config:
- {name: 'ubuntu-14.04 gcc-4.8', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.8', cxx: 'g++-4.8', tag: '4.8', toolchain: 'ppa:ubuntu-toolchain-r/test'}
- {name: 'ubuntu-14.04 gcc-4.9', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.9', cxx: 'g++-4.9', tag: '4.9', toolchain: 'ppa:ubuntu-toolchain-r/test'}
- {name: 'ubuntu-18.04 gcc-5', os: ubuntu-18.04, cc: 'gcc-5', cxx: 'g++-5', tag: '5'}
- {name: 'ubuntu-18.04 gcc-6', os: ubuntu-18.04, cc: 'gcc-6', cxx: 'g++-6', tag: '6'}
- {name: 'ubuntu-18.04 gcc-7', os: ubuntu-18.04, cc: 'gcc-7', cxx: 'g++-7', tag: '7'}
- {name: 'ubuntu-18.04 gcc-8', os: ubuntu-18.04, cc: 'gcc-8', cxx: 'g++-8', tag: '8'}
- {name: 'ubuntu-20.04 gcc-9', os: ubuntu-20.04, cc: 'gcc-9', cxx: 'g++-9', tag: '9'}
- {name: 'ubuntu-20.04 gcc-10', os: ubuntu-20.04, cc: 'gcc-10', cxx: 'g++-10', tag: '10'}
- {name: 'ubuntu-22.04 gcc-11', os: ubuntu-20.04, cc: 'gcc-11', cxx: 'g++-11', tag: '11'}

env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
CCVERSION: ${{ matrix.config.tag }}
GHA_CONTAINER: ${{ matrix.config.container }}
GHA_CONFIG_NAME: ${{ matrix.config.name }}

steps:
- name: if running in a container, update and install sudo, git, and other basics
if: matrix.config.container != ''
run: |
case "${GHA_CONTAINER}" in
ubuntu*)
apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y install tzdata sudo apt-transport-https make apt-file software-properties-common libssl-dev build-essential autotools-dev autoconf automake pkgconf
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git
;;
*)
;;
esac
- name: override DNS to fix IP address for hostname in some Docker containers
if: matrix.config.container == 'ubuntu:14.04'
run: |
echo "==="
echo "Before: /etc/hosts"
cat /etc/hosts
echo "==="
echo "Removing localhost name from ::1 entry in /etc/hosts..."
sed 's/^::1\s\s*localhost\s\(.*\)/::1 \1/' /etc/hosts > /tmp/hosts.temp
cp /tmp/hosts.temp /etc/hosts
rm /tmp/hosts.temp
echo "After: /etc/hosts"
cat /etc/hosts
echo "==="
ip addr
echo "==="
echo "'hostname -i' shows '$(hostname -i)'"
echo "'hostname -I' shows '$(hostname -I)'"
echo "'hostname -s' shows '$(hostname -s)'"
echo "'hostname -f' shows '$(hostname -f)'"
- name: configure toolchain (optional)
if: matrix.config.toolchain != ''
run: |
sudo apt-add-repository ${{ matrix.config.toolchain }}
sudo apt-get update
sudo apt-get -y install libtool
- uses: actions/checkout@v3
- name: set ownership of git repository in Docker containers
if: matrix.config.container != ''
run: |
chown -R $(id -u):$(id -g) .
- name: tweak multi_client_test.cc for container usage
if: matrix.config.container == 'ubuntu:14.04'
run: |
echo "==="
echo "Before multi_client_test.cc:"
grep push_port tests/libgearman-1.0/multi_client_test.cc
echo "Changing multi_client_test.cc..."
sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19298 \2/' tests/libgearman-1.0/multi_client_test.cc
sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19300 \2/' tests/libgearman-1.0/multi_client_test.cc
echo "After multi_client_test.cc:"
grep push_port tests/libgearman-1.0/multi_client_test.cc
echo "==="
- name: install dependencies
run: |
case "${GHA_CONFIG_NAME}" in
ubuntu*)
sudo apt-get update && sudo apt-get -o Acquire::Retries=3 install -y libboost-all-dev gperf libevent-dev uuid-dev sphinx-doc sphinx-common libhiredis-dev ${{ matrix.config.cc }} ${{ matrix.config.cxx }}
;;
*)
;;
esac
- name: bootstrap
run: |
if [ -n "$GHA_CONTAINER" ]; then
echo "container: $GHA_CONTAINER"
fi
if [ -f "/etc/lsb-release" ]; then
cat /etc/lsb-release
fi
./bootstrap.sh -a
- name: configure
run: |
if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
export CXXFLAGS
echo "CXXFLAGS: $CXXFLAGS"
fi
./configure --enable-ssl
- name: make
run: |
if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
export CXXFLAGS
echo "CXXFLAGS: $CXXFLAGS"
fi
${CC} --version && make
- name: make test
run: ${CC} --version && make test
- name: check test-suite.log
if: success() || failure()
run: |
if [ -f "./test-suite.log" ]; then
cat ./test-suite.log
else
echo "No test-suite.log file found."
fi