Skip to content

Commit 40b1c26

Browse files
committed
fix(ci): debug
1 parent 0102d43 commit 40b1c26

1 file changed

Lines changed: 111 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11+
DIAG_DIR: /tmp/ctk-diagnostics
1112

1213
jobs:
1314
goreleaser:
@@ -26,19 +27,127 @@ jobs:
2627
cache: true
2728
cache-dependency-path: go.sum
2829

30+
- name: Collect context
31+
run: |
32+
set -euxo pipefail
33+
mkdir -p "$DIAG_DIR"
34+
{
35+
echo "date=$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
36+
echo "github_ref=${GITHUB_REF}"
37+
echo "github_ref_name=${GITHUB_REF_NAME}"
38+
echo "github_sha=${GITHUB_SHA}"
39+
echo "runner_os=${RUNNER_OS}"
40+
echo "runner_arch=${RUNNER_ARCH}"
41+
echo "pwd=$(pwd)"
42+
} | tee "$DIAG_DIR/context.txt"
43+
git status --short | tee "$DIAG_DIR/git-status.txt"
44+
git rev-parse HEAD | tee "$DIAG_DIR/git-head.txt"
45+
git show --stat --summary --decorate=fuller HEAD | tee "$DIAG_DIR/git-head-summary.txt"
46+
go version | tee "$DIAG_DIR/go-version.txt"
47+
go env | tee "$DIAG_DIR/go-env.txt"
48+
sha256sum go.mod go.sum | tee "$DIAG_DIR/go-files.sha256"
49+
sed -n '1,220p' go.mod | tee "$DIAG_DIR/go.mod.txt"
50+
sed -n '1,220p' .github/conf/.goreleaser.yml | tee "$DIAG_DIR/goreleaser.yml.txt"
51+
2952
- name: Warm module cache
3053
run: |
54+
set -euxo pipefail
3155
go mod download
3256
go mod verify
57+
go list -m all | tee "$DIAG_DIR/go-list-m-all.txt"
58+
go list -m -json all > "$DIAG_DIR/go-list-m-all.json"
59+
go mod graph | tee "$DIAG_DIR/go-mod-graph.txt"
60+
go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./cmd/main.go | sort | tee "$DIAG_DIR/go-list-deps-main.txt"
61+
go list -deps -json ./cmd/main.go > "$DIAG_DIR/go-list-deps-main.json"
3362
3463
- name: Warm build cache
35-
run: go build -trimpath -ldflags "-s -w" -o /tmp/ctk ./cmd/main.go
64+
run: |
65+
set -euxo pipefail
66+
go build -trimpath -ldflags "-s -w" -o /tmp/ctk ./cmd/main.go
67+
ls -lh /tmp/ctk | tee "$DIAG_DIR/warm-build-ls.txt"
68+
file /tmp/ctk | tee "$DIAG_DIR/warm-build-file.txt"
69+
sha256sum /tmp/ctk | tee "$DIAG_DIR/warm-build.sha256"
70+
go version -m /tmp/ctk | tee "$DIAG_DIR/warm-build-go-version-m.txt"
71+
go tool buildid /tmp/ctk | tee "$DIAG_DIR/warm-build-buildid.txt"
72+
(size /tmp/ctk || true) | tee "$DIAG_DIR/warm-build-size.txt"
3673
3774
- name: Run GoReleaser
3875
uses: goreleaser/goreleaser-action@v6
3976
with:
4077
distribution: goreleaser
4178
version: '~> v2'
42-
args: release -f .github/conf/.goreleaser.yml --clean --parallelism 1
79+
args: release -f .github/conf/.goreleaser.yml --clean --parallelism 1 --verbose
4380
env:
4481
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Inspect dist
84+
if: always()
85+
run: |
86+
set -euxo pipefail
87+
ls -la dist/ | tee "$DIAG_DIR/dist-root.txt"
88+
find dist -maxdepth 2 -type f | sort | tee "$DIAG_DIR/dist-files.txt"
89+
find dist -maxdepth 2 -type f -exec ls -lh {} + | tee "$DIAG_DIR/dist-ls.txt"
90+
find dist -maxdepth 2 -type f -exec file {} + | tee "$DIAG_DIR/dist-file.txt"
91+
find dist -maxdepth 2 -type f -exec sha256sum {} + | tee "$DIAG_DIR/dist.sha256"
92+
for f in $(find dist -maxdepth 2 -type f -name 'ctk*' 2>/dev/null | sort); do
93+
echo "=== $f ===" | tee -a "$DIAG_DIR/dist-binaries.txt"
94+
ls -lh "$f" | tee -a "$DIAG_DIR/dist-binaries.txt"
95+
file "$f" | tee -a "$DIAG_DIR/dist-binaries.txt"
96+
go tool buildid "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" || true
97+
go version -m "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" || true
98+
(size "$f" || true) | tee -a "$DIAG_DIR/dist-binaries.txt"
99+
done
100+
du -sh dist | tee "$DIAG_DIR/dist-size.txt"
101+
sed -n '1,240p' dist/artifacts.json | tee "$DIAG_DIR/dist-artifacts.json.txt" || true
102+
sed -n '1,240p' dist/checksums.txt | tee "$DIAG_DIR/dist-checksums.txt" || true
103+
104+
- name: Compare linux amd64 output
105+
if: always()
106+
run: |
107+
set -euxo pipefail
108+
TARGET="dist/ctk_linux_amd64_v1/ctk"
109+
if [ -f /tmp/ctk ] && [ -f "$TARGET" ]; then
110+
ls -lh /tmp/ctk "$TARGET" | tee "$DIAG_DIR/compare-linux-amd64-ls.txt"
111+
sha256sum /tmp/ctk "$TARGET" | tee "$DIAG_DIR/compare-linux-amd64.sha256"
112+
cmp -s /tmp/ctk "$TARGET" && echo "identical=true" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt" || echo "identical=false" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt"
113+
else
114+
echo "linux amd64 artifact missing" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt"
115+
fi
116+
117+
- name: Inspect GitHub release assets
118+
if: always()
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
set -euxo pipefail
123+
gh release view "${GITHUB_REF_NAME}" --json tagName,name,isDraft,isImmutable,isPrerelease,assets > "$DIAG_DIR/release-assets.json"
124+
cat "$DIAG_DIR/release-assets.json"
125+
jq -r '
126+
[
127+
.tagName,
128+
.name,
129+
(.isDraft|tostring),
130+
(.isPrerelease|tostring),
131+
(.isImmutable|tostring)
132+
] | @tsv
133+
' "$DIAG_DIR/release-assets.json" | tee "$DIAG_DIR/release-summary.tsv"
134+
jq -r '
135+
.assets[]
136+
| [
137+
.name,
138+
(.size|tostring),
139+
.contentType,
140+
.state,
141+
.updatedAt,
142+
(.downloadCount|tostring),
143+
.url
144+
] | @tsv
145+
' "$DIAG_DIR/release-assets.json" | tee "$DIAG_DIR/release-assets.tsv"
146+
147+
- name: Upload diagnostics
148+
if: always()
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: build-diagnostics-${{ github.ref_name }}
152+
path: /tmp/ctk-diagnostics
153+
if-no-files-found: warn

0 commit comments

Comments
 (0)