Skip to content

Commit 31beb33

Browse files
committed
Adding summaries for CI workflows
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
1 parent a7ad81e commit 31beb33

3 files changed

Lines changed: 153 additions & 17 deletions

File tree

.github/workflows/job-build.yml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ on:
1717
required: false
1818
default: false
1919
type: boolean
20-
2120
env:
2221
GOTOOLCHAIN: local
2322

@@ -42,10 +41,11 @@ jobs:
4241
- if: ${{ inputs.canary }}
4342
name: "Init (canary): retrieve GO_VERSION"
4443
run: |
44+
. ./hack/github/action-helpers.sh
4545
latest_go="$(. ./hack/provisioning/version/fetch.sh; go::canary::for::go-setup)"
4646
printf "GO_VERSION=%s\n" "$latest_go" >> "$GITHUB_ENV"
4747
[ "$latest_go" != "" ] || \
48-
echo "::warning title=No canary go::There is currently no canary go version to test. Steps will not run."
48+
github::log::warning "No canary go" "There is currently no canary go version to test. Steps will not run."
4949
5050
- if: ${{ env.GO_VERSION != '' }}
5151
name: "Init: install go"
@@ -56,14 +56,49 @@ jobs:
5656

5757
- if: ${{ env.GO_VERSION != '' }}
5858
name: "Run: make binaries"
59+
id: run
5960
run: |
61+
. ./hack/github/action-helpers.sh
62+
63+
# https://github.com/orgs/community/discussions/44185
64+
# - name: "Init: zero"
65+
# id: init
66+
# run: |
67+
68+
github::md::h1 "Lint: building" > $GITHUB_STEP_SUMMARY
69+
github::md::table::header "OS" "Arch" "Result" "Time" >> $GITHUB_STEP_SUMMARY
70+
71+
failure=
72+
73+
build(){
74+
local goos="$1"
75+
local goarch="${2:-amd64}"
76+
local goarm="${3:-}"
77+
local result
78+
79+
github::timer::begin
80+
81+
GOOS="$goos" GOARCH="$goarch" GOARM="$goarm" make binaries \
82+
&& result="$decorator_success" \
83+
|| {
84+
failure=true
85+
result="$decorator_failure"
86+
}
87+
88+
[ ! "$goarm" ] || goarch="$goarch/v$goarm"
89+
github::md::table::line "$goos" "$goarch" "$result" "$(github::timer::format <(github::timer::tick))" >> $GITHUB_STEP_SUMMARY
90+
}
91+
6092
# We officially support these
61-
GOOS=linux make binaries
62-
GOOS=windows make binaries
63-
GOOS=freebsd make binaries
64-
GOOS=darwin make binaries
65-
GOARCH=arm GOARM=6 make binaries
93+
build linux
94+
build linux arm64
95+
build windows
96+
build freebsd
97+
build darwin
98+
build linux arm 6
6699
# These architectures are not released, but we still verify that we can at least compile
67-
GOARCH=ppc64le make binaries
68-
GOARCH=riscv64 make binaries
69-
GOARCH=s390x make binaries
100+
build linux ppc64le
101+
build linux riscv64
102+
build linux s390x
103+
104+
[ ! "$failure" ] || exit 1

.github/workflows/job-test-integration-host.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
shell: bash
6060

6161
env:
62-
SHOULD_RUN: yes
62+
SHOULD_RUN: true
6363
GO_VERSION: ${{ inputs.go-version }}
6464
# Both Docker and nerdctl on linux need rootful right now
6565
WITH_SUDO: ${{ contains(inputs.runner, 'ubuntu') }}
@@ -86,10 +86,10 @@ jobs:
8686
}
8787
if [ "$latest_go" == "" ] && [ "${latest_containerd:1}" == "$CONTAINERD_VERSION" ]; then
8888
echo "::warning title=No canary::There is currently no canary versions to test. Steps will not run.";
89-
printf "SHOULD_RUN=no\n" >> "$GITHUB_ENV"
89+
printf "SHOULD_RUN=false\n" >> "$GITHUB_ENV"
9090
fi
9191
92-
- if: ${{ env.SHOULD_RUN == 'yes' }}
92+
- if: ${{ env.SHOULD_RUN == true }}
9393
name: "Init: install go"
9494
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
9595
with:
@@ -98,7 +98,7 @@ jobs:
9898

9999
# XXX RUNNER_OS and generally env is too unreliable
100100
# - if: ${{ env.RUNNER_OS == 'Linux' }}
101-
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == 'yes' }}
101+
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == true }}
102102
name: "Init (linux): prepare host"
103103
run: |
104104
if [ "${{ contains(inputs.binary, 'docker') }}" == true ]; then
@@ -136,7 +136,7 @@ jobs:
136136
# FIXME: remove expect when we are done removing unbuffer from tests
137137
sudo apt-get install -qq expect
138138
139-
- if: ${{ contains(inputs.runner, 'windows') && env.SHOULD_RUN == 'yes' }}
139+
- if: ${{ contains(inputs.runner, 'windows') && env.SHOULD_RUN == true }}
140140
name: "Init (windows): prepare host"
141141
env:
142142
ctrdVersion: ${{ env.CONTAINERD_VERSION }}
@@ -156,15 +156,15 @@ jobs:
156156
go install ./cmd/nerdctl
157157
echo "::endgroup::"
158158
159-
- if: ${{ env.SHOULD_RUN == 'yes' }}
159+
- if: ${{ env.SHOULD_RUN == true }}
160160
name: "Init: install dev tools"
161161
run: |
162162
echo "::group:: make install-dev-tools"
163163
make install-dev-tools
164164
echo "::endgroup::"
165165
166166
# ipv6 is tested only on linux
167-
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == 'yes' }}
167+
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == true }}
168168
name: "Run (linux): integration tests (IPv6)"
169169
run: |
170170
./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-ipv6

hack/github/action-helpers.sh

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright The containerd Authors.
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# shellcheck disable=SC2034
18+
set -o errexit -o errtrace -o functrace -o nounset -o pipefail
19+
#root="$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)"
20+
#readonly root
21+
# shellcheck source=/dev/null
22+
#. "$root/../../scripts/lib.sh"
23+
24+
readonly decorator_success=""
25+
readonly decorator_failure=""
26+
27+
github::md::h1(){
28+
printf "# %s\n" "$1"
29+
}
30+
31+
github::md::h2(){
32+
printf "## %s\n" "$1"
33+
}
34+
35+
github::md::bq(){
36+
local x
37+
for x in "$@"; do
38+
printf "> %s\n" "$1"
39+
done
40+
}
41+
42+
github::md::table::header(){
43+
printf "|"
44+
for x in "$@"; do
45+
printf " %s |" "$x"
46+
done
47+
printf "\n"
48+
printf "|"
49+
for x in "$@"; do
50+
printf "%s|" "---"
51+
done
52+
printf "\n"
53+
}
54+
55+
github::md::table::line(){
56+
printf "|"
57+
for x in "$@"; do
58+
printf " %s |" "$x"
59+
done
60+
printf "\n"
61+
}
62+
63+
github::log::group(){
64+
echo "::group::$*"
65+
}
66+
67+
github::log::endgroup(){
68+
echo "::endgroup::"
69+
}
70+
71+
github::log::warning(){
72+
local title="$1"
73+
local msg="$2"
74+
75+
echo "::warning title=$title::$msg"
76+
}
77+
78+
_begin=${_begin:-}
79+
_duration=
80+
github::timer::begin(){
81+
_begin="$(date +%s)"
82+
}
83+
84+
github::timer::tick(){
85+
local tick
86+
87+
tick="$(date +%s)"
88+
printf "%s" "$((tick - _begin))"
89+
}
90+
91+
github::timer::format() {
92+
local t
93+
t="$(cat "$1")"
94+
local h=$((t/60/60%24))
95+
local m=$((t/60%60))
96+
local s=$((t%60))
97+
98+
[[ "$h" == 0 ]] || printf "%d hours " "$h"
99+
[[ "$m" == 0 ]] || printf "%d minutes " "$m"
100+
printf '%d seconds' "$s"
101+
}

0 commit comments

Comments
 (0)