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

Github actions: use ccache #1919

Closed
wants to merge 21 commits into from
Closed
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
134 changes: 134 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: "GitHub CI merge checks"

on:
push:
branches: [ "auto", "github-actions-merge-tests" ]

env:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
CHECKOUT_FETCH_DEPTH: 1001

jobs:
linux-matrix-tests:

strategy:
matrix:
os:
- centos-stream-9
- debian-stable
- debian-testing
- debian-unstable
- fedora-39
- fedora-40
- fedora-rawhide
- gentoo
- opensuse-leap
- opensuse-tumbleweed
- ubuntu-focal
- ubuntu-jammy
- ubuntu-noble # EOL 2036-04
- ubuntu-oracular # EOL 2025-07
compiler:
- { CC: gcc, CXX: g++ }
- { CC: clang, CXX: clang++ }
layer:
- { name: layer-00-default, nick: default }
- { name: layer-01-minimal, nick: minimal }
- { name: layer-02-maximus, nick: maximus }
# exclude:
# if any combinations needs to be excluded, do it here
# - { os: macos-14, compiler: { CC: gcc, CXX: g++ } }

runs-on: ubuntu-latest
container:
image: squidcache/buildfarm-${{ matrix.os }}:latest # TODO: use stable before merge
options: --user 1001 # uid used by worfklow runner

name: linux-matrix-test(${{ matrix.os }},${{ matrix.compiler.CC }},${{ matrix.layer.nick }})
env:
CC: ${{ matrix.compiler.CC }}
CXX: ${{ matrix.compiler.CXX }}

steps:
- name: Checkout Sources
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}

- name: setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
verbose: 2 # default 0
append-timestamp: false
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}

- name: Run build test
id: test
run: |
export CC="/usr/bin/ccache $CC"
export CXX="/usr/bin/ccache $CXX"
./test-builds.sh --verbose --use-config-cache ${{ matrix.layer.name }}

- name: Publish build logs
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}
path: btlayer-*.log

macos:
runs-on: macos-14
name: macos-test

steps:
- name: Install prerequisite MacOS packages
run: |
brew install \
automake coreutils cppunit gawk \
gnu-getopt gnu-sed grep libtool \
make cyrus-sasl
# openldap openssl # already provided by github workers base-image

- name: Checkout Sources
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}

- name: Run build test
run: |
eval `brew shellenv`
PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig"
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openldap/lib/pkgconfig"
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/cyrus-sasl/lib/pkgconfig"
export PKG_CONFIG_PATH
export GETOPT="$HOMEBREW_PREFIX/opt/gnu-getopt/bin/getopt"
export MAKE="$HOMEBREW_PREFIX/bin/gmake"
# ensure we use Homebrew headers and libraries
# this is needed because pkg-config --libs openssl points to the wrong directory
# in version openssl@3: stable 3.3.0
export CPPFLAGS="-I$HOMEBREW_PREFIX/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$HOMEBREW_PREFIX/lib${LDFLAGS:+ $LDFLAGS}"
export CFLAGS="-Wno-compound-token-split-by-macro${CFLAGS:+ $CFLAGS}" # needed fir ltdl with Xcode

# libtool package referenced below fails to copy its configure*
# files, possibly due to a packaging/brewing bug. The following sed
# command restores installed libtoolize code to its earlier (and
# working) variation.
echo "brew libtool package details:"
brew info libtool --json | grep -E 'rebuild|tap_git_head'
# This hack was tested on libtoolize package with the following output:
# "rebuild": 2,
# "tap_git_head": "5cede8ea3b7b12c7f68215f75a951430b38d945f",
#
editable=$HOMEBREW_CELLAR/libtool/2.4.7/bin/glibtoolize
sed -i.bak 's@ltdl_ac_aux_dir=""@ltdl_ac_aux_dir="../build-aux"@' $editable || true
diff -u $editable.bak $editable || true

./test-builds.sh --verbose

- name: Publish build logs
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-macos
path: btlayer-*.log
64 changes: 15 additions & 49 deletions .github/workflows/default.yaml → .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: GitHub CI
name: "GitHub CI merge checks"

on:
push:
# test this branch and staged PRs based on this branch code
branches: [ "master", "auto" ]
branches: [ "master" ]

pull_request:
# test PRs targeting this branch code
Expand Down Expand Up @@ -42,6 +42,12 @@ jobs:
with:
fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}

- name: setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
verbose: 2 # default 0
append-timestamp: false

- run: ./bootstrap.sh
- run: ./configure --with-openssl
- run: make -j`nproc`
Expand Down Expand Up @@ -96,7 +102,6 @@ jobs:
matrix:
os:
- ubuntu-22.04
- macos-14
compiler:
- { CC: gcc, CXX: g++ }
- { CC: clang, CXX: clang++ }
Expand All @@ -106,7 +111,7 @@ jobs:
- { name: layer-02-maximus, nick: maximus }
exclude:
# Non-clang testing on MacOS is too much work for very little gain
- { os: macos-14, compiler: { CC: gcc, CXX: g++ } }
# - { os: macos-14, compiler: { CC: gcc, CXX: g++ } }

runs-on: ${{ matrix.os }}

Expand All @@ -119,63 +124,25 @@ jobs:
steps:

- name: Install prerequisite Linux packages
if: runner.os == 'Linux'
run: |
# required for "apt-get build-dep" to work
sudo sed --in-place -E 's/# (deb-src.*updates main)/ \1/g' /etc/apt/sources.list
sudo apt-get --quiet=2 update
sudo apt-get --quiet=2 build-dep squid
sudo apt-get --quiet=2 install linuxdoc-tools libtool-bin ${{ matrix.compiler.CC }}

- name: Install prerequisite MacOS packages
if: runner.os == 'macOS'
run: |
brew install \
automake coreutils cppunit gawk \
gnu-getopt gnu-sed grep libtool \
make cyrus-sasl
# openldap openssl # already provided by github workers base-image

- name: Checkout sources
uses: actions/checkout@v4

- name: setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
verbose: 2 # default 0
append-timestamp: false

- name: Run build on Linux
if: runner.os == 'Linux'
run: ./test-builds.sh ${{ matrix.layer.name }}

- name: Run build on MacOS
if: runner.os == 'macOS'
run: |
eval `brew shellenv`
PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig"
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openldap/lib/pkgconfig"
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/cyrus-sasl/lib/pkgconfig"
export PKG_CONFIG_PATH
export GETOPT="$HOMEBREW_PREFIX/opt/gnu-getopt/bin/getopt"
export MAKE="$HOMEBREW_PREFIX/bin/gmake"
# ensure we use Homebrew headers and libraries
# this is needed because pkg-config --libs openssl points to the wrong directory
# in version openssl@3: stable 3.3.0
export CPPFLAGS="-I$HOMEBREW_PREFIX/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L$HOMEBREW_PREFIX/lib${LDFLAGS:+ $LDFLAGS}"
export CFLAGS="-Wno-compound-token-split-by-macro${CFLAGS:+ $CFLAGS}" # needed fir ltdl with Xcode

# libtool package referenced below fails to copy its configure*
# files, possibly due to a packaging/brewing bug. The following sed
# command restores installed libtoolize code to its earlier (and
# working) variation.
echo "brew libtool package details:"
brew info libtool --json | grep -E 'rebuild|tap_git_head'
# This hack was tested on libtoolize package with the following output:
# "rebuild": 2,
# "tap_git_head": "5cede8ea3b7b12c7f68215f75a951430b38d945f",
#
editable=$HOMEBREW_CELLAR/libtool/2.4.7/bin/glibtoolize
sed -i.bak 's@ltdl_ac_aux_dir=""@ltdl_ac_aux_dir="../build-aux"@' $editable || true
diff -u $editable.bak $editable || true

./test-builds.sh ${{ matrix.layer.name }}

- name: Publish build logs
if: success() || failure()
uses: actions/upload-artifact@v4
Expand All @@ -193,7 +160,6 @@ jobs:
steps:

- name: Install Squid prerequisite Linux packages
if: runner.os == 'Linux'
run: |
# required for "apt-get build-dep" to work
sudo sed --in-place -E 's/# (deb-src.*updates main)/ \1/g' /etc/apt/sources.list
Expand Down