Skip to content

Commit 166cc24

Browse files
committed
debug pipeline
1 parent 92bcadd commit 166cc24

3 files changed

Lines changed: 210 additions & 0 deletions

File tree

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: GoReleaser Debug
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
jobs:
10+
ldflags_args:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
commit-date: ${{ steps.ldflags.outputs.commit-date }}
14+
commit: ${{ steps.ldflags.outputs.commit }}
15+
version: ${{ steps.ldflags.outputs.version }}
16+
tree-state: ${{ steps.ldflags.outputs.tree-state }}
17+
steps:
18+
- id: checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- id: ldflags
23+
run: |
24+
echo "commit=$GITHUB_SHA" >> $GITHUB_OUTPUT
25+
echo "commit-date=$(git log --date=iso8601-strict -1 --pretty=%ct)" >> $GITHUB_OUTPUT
26+
echo "version=$(git describe --tags --always --dirty | cut -c2-)" >> $GITHUB_OUTPUT
27+
echo "tree-state=$(if git diff --quiet; then echo "clean"; else echo "dirty"; fi)" >> $GITHUB_OUTPUT
28+
29+
goreleaser-test:
30+
name: Test GoReleaser Build
31+
needs:
32+
- ldflags_args
33+
permissions:
34+
contents: write # To add assets to a release.
35+
id-token: write # To do keyless signing with cosign
36+
runs-on: macos-14 # M1/Apple Silicon runner - matching release workflow
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Setup Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version-file: 'go.mod'
47+
cache: true
48+
49+
- name: Install Syft
50+
uses: anchore/sbom-action/download-syft@7b36ad622f042cab6f59a75c2ac24ccb256e9b45 # v0.20.4
51+
52+
- name: Install Cosign
53+
uses: sigstore/cosign-installer@v3.9.2
54+
55+
- name: Debug Go Environment
56+
run: |
57+
echo "=== Go Version ==="
58+
go version
59+
echo "=== Go Environment ==="
60+
go env
61+
echo "=== Test Simple Build (matching goreleaser config) ==="
62+
time CGO_ENABLED=1 go build -trimpath -tags=netgo -o openlane ./cmd/cli 2>&1 | head -20
63+
echo "=== Clean up test build ==="
64+
rm -f openlane
65+
66+
- name: Test GoReleaser Build Command
67+
uses: goreleaser/goreleaser-action@v6
68+
with:
69+
distribution: goreleaser
70+
version: latest
71+
args: build --snapshot --clean
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
75+
VERSION: ${{ needs.ldflags_args.outputs.version }}
76+
COMMIT: ${{ needs.ldflags_args.outputs.commit }}
77+
COMMIT_DATE: ${{ needs.ldflags_args.outputs.commit-date }}
78+
TREE_STATE: ${{ needs.ldflags_args.outputs.tree-state }}
79+
GOPROXY: https://proxy.golang.org,direct
80+
81+
- name: Test GoReleaser Full Release (dry-run)
82+
uses: goreleaser/goreleaser-action@v6
83+
with:
84+
distribution: goreleaser
85+
version: latest
86+
args: release --snapshot --clean --skip=publish,sign --verbose
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
90+
VERSION: ${{ needs.ldflags_args.outputs.version }}
91+
COMMIT: ${{ needs.ldflags_args.outputs.commit }}
92+
COMMIT_DATE: ${{ needs.ldflags_args.outputs.commit-date }}
93+
TREE_STATE: ${{ needs.ldflags_args.outputs.tree-state }}
94+
GOPROXY: https://proxy.golang.org,direct
95+
96+
- name: Test GoReleaser EXACT Release Command (snapshot mode)
97+
id: run-goreleaser-exact
98+
uses: goreleaser/goreleaser-action@v6
99+
with:
100+
distribution: goreleaser
101+
version: latest
102+
args: release --snapshot --clean --verbose
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
106+
VERSION: ${{ needs.ldflags_args.outputs.version }}
107+
COMMIT: ${{ needs.ldflags_args.outputs.commit }}
108+
COMMIT_DATE: ${{ needs.ldflags_args.outputs.commit-date }}
109+
TREE_STATE: ${{ needs.ldflags_args.outputs.tree-state }}
110+
111+
- name: Upload Build Artifacts
112+
if: failure()
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: goreleaser-debug-macos-14
116+
path: |
117+
dist/
118+
*.log
119+
120+
- name: Debug on Failure
121+
if: failure()
122+
run: |
123+
echo "=== Disk Space ==="
124+
df -h
125+
echo "=== Memory Usage ==="
126+
if command -v free >/dev/null 2>&1; then free -h; fi
127+
echo "=== Process List ==="
128+
ps aux | grep -E "(go|goreleaser)" | grep -v grep || true
129+
echo "=== Network Connectivity ==="
130+
curl -s -o /dev/null -w "%{http_code}" https://proxy.golang.org || echo "Failed to reach proxy.golang.org"
131+
echo "=== Recent System Messages ==="
132+
if command -v dmesg >/dev/null 2>&1; then sudo dmesg | tail -50; fi

.goreleaser-old.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
project_name: openlane
2+
builds:
3+
- env:
4+
- GO111MODULE=on
5+
- CGO_ENABLED=0
6+
binary: openlane
7+
flags:
8+
- -trimpath
9+
- -tags=netgo
10+
ldflags:
11+
- "-X main.Version={{ .Env.VERSION }}"
12+
- "-X main.Commit={{ .Env.COMMIT }}"
13+
- "-X main.CommitDate={{ .Env.COMMIT_DATE }}"
14+
- "-X main.TreeState={{ .Env.TREE_STATE }}"
15+
- "-X github.com/theopenlane/core/internal/constants.CLIVersion={{ .Env.VERSION }}"
16+
goos:
17+
- linux
18+
- windows
19+
- darwin
20+
goarch:
21+
- amd64
22+
- arm64
23+
overrides:
24+
- goos: darwin
25+
goarch: arm64
26+
env:
27+
- CGO_ENABLED=1
28+
- goos: darwin
29+
goarch: amd64
30+
goamd64: v1
31+
env:
32+
- CGO_ENABLED=1
33+
main: ./cmd/cli
34+
archives:
35+
- format: tar.gz # we can use binary, but it seems there's an issue where goreleaser skips the sboms
36+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
37+
format_overrides:
38+
- goos: windows
39+
format: zip
40+
brews:
41+
- homepage: 'https://github.com/theopenlane/core'
42+
description: 'openlane is the client CLI for interacting with the openlane server'
43+
directory: Formula
44+
license: 'Apache-2.0'
45+
commit_author:
46+
name: bender-core
47+
email: bender@theopenlane.io
48+
repository:
49+
owner: theopenlane
50+
name: homebrew-tap
51+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
52+
test: |
53+
system "#{bin}/openlane --help"
54+
source:
55+
enabled: true
56+
changelog:
57+
sort: asc
58+
use: github
59+
sboms:
60+
- artifacts: archive
61+
release:
62+
# If set to auto, will mark the release as not ready for production
63+
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
64+
prerelease: auto
65+
github:
66+
owner: theopenlane
67+
name: openlane
68+
# This section defines how and which artifacts we want to sign for the release.
69+
signs:
70+
- cmd: cosign
71+
args:
72+
- "sign-blob"
73+
- "--output-signature=${signature}"
74+
- "${artifact}"
75+
- "--yes" # needed on cosign >= 2.0.0
76+
artifacts: archive
77+
output: true

.goreleaser.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ builds:
2727
- CGO_ENABLED=1
2828
- goos: darwin
2929
goarch: amd64
30+
goamd64: v1
3031
env:
3132
- CGO_ENABLED=1
3233
main: ./cmd/cli

0 commit comments

Comments
 (0)