Skip to content

Commit

Permalink
CI: show build commands on terminal (squid-cache#1965)
Browse files Browse the repository at this point in the history
test-builds.sh records build output in per-layer logs, and we are
already collecting those logs. Send build output to standard output as
well, to expose it in GitHub Actions user interface. This new detailed
output is enclosed in a "layer ... output" group to keep emphasizing
problematic output lines extracted by test-builds.sh.

Also enclose MacOS build setup output in a group, for similar reasons.
  • Loading branch information
kinkie authored and squid-anubis committed Feb 17, 2025
1 parent bbcef1c commit e5a66fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/quick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
key: ${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}

- name: Run build on Linux
run: ./test-builds.sh ${{ matrix.layer.name }}
run: ./test-builds.sh --verbose ${{ matrix.layer.name }}

- name: Publish build logs
if: success() || failure()
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
uses: github/codeql-action/init@v3

- name: Build Squid
run: ./test-builds.sh ./test-suite/buildtests/layer-02-maximus.opts
run: ./test-builds.sh --verbose ./test-suite/buildtests/layer-02-maximus.opts

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
9 changes: 5 additions & 4 deletions .github/workflows/slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ jobs:

- name: Run test-builds
id: test-builds
run: |
./test-builds.sh ${{ matrix.layer.name }}
run: ./test-builds.sh --verbose ${{ matrix.layer.name }}

- name: Publish build logs
if: success() || failure()
Expand Down Expand Up @@ -101,6 +100,7 @@ jobs:
- name: Run test-builds
id: test-builds
run: |
echo "::group::setup output"
eval `brew shellenv`
PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig"
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$HOMEBREW_PREFIX/opt/openldap/lib/pkgconfig"
Expand Down Expand Up @@ -128,8 +128,9 @@ jobs:
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
echo "::endgroup::"
./test-builds.sh
./test-builds.sh --verbose
- name: Publish build logs
if: success() || failure()
Expand Down Expand Up @@ -176,7 +177,7 @@ jobs:
run: |
export MAKE=gmake
./test-builds.sh
./test-builds.sh --verbose
- name: Publish build logs
if: success() || failure()
Expand Down
5 changes: 4 additions & 1 deletion test-builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ while [ $# -ge 1 ]; do
done

logtee() {
local layer=$2
case $verbose in
yes)
echo "::group::$layer output" # github collapsible section
tee $1
echo "::endgroup::"
;;
progress)
tee $1 | awk '{printf "."; n++; if (!(n % 80)) print "" } END {print ""}'
Expand Down Expand Up @@ -111,7 +114,7 @@ buildtest() {

# log the result for the outer script to notice
echo "buildtest.sh result is $result";
} 2>&1 | logtee ${log}
} 2>&1 | logtee ${log} ${layer}

result=1 # failure by default
if grep -q '^buildtest.sh result is 0$' ${log}; then
Expand Down

0 comments on commit e5a66fc

Please sign in to comment.