|
| 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 |
0 commit comments