-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
89 lines (80 loc) · 2.49 KB
/
action.yml
File metadata and controls
89 lines (80 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: 'Patch Go'
description: 'Patch Go!'
inputs:
patch-repo:
description: 'Repository containing the patched Go source (e.g., username/go)'
default: 'DefinedNet/go'
patch-ref:
description: 'Branch, tag, or commit SHA of the patched version'
required: true
cache-key-suffix:
description: 'Optional suffix for cache key'
required: false
default: ''
runs:
using: "composite"
steps:
- name: Set up cache key
id: cache-key
shell: bash
run: |
CACHE_KEY="patched-go-${{ inputs.patch-ref }}-${{ runner.os }}-${{ runner.arch }}"
if [ -n "${{ inputs.cache-key-suffix }}" ]; then
CACHE_KEY="${CACHE_KEY}-${{ inputs.cache-key-suffix }}"
fi
echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT
- name: Cache patched Go installation
id: cache-go
uses: actions/cache@v4
with:
path: ~/patched-go
key: ${{ steps.cache-key.outputs.key }}
- name: Verify build tools
if: steps.cache-go.outputs.cache-hit != 'true'
shell: bash
run: |
if ! command -v clang &> /dev/null; then
echo "Error: clang not found. Xcode Command Line Tools may not be installed."
exit 1
fi
echo "Build tools verified"
- name: Install bootstrap Go compiler
if: steps.cache-go.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Clone patched Go source
if: steps.cache-go.outputs.cache-hit != 'true'
shell: bash
run: |
git clone https://github.com/${{ inputs.patch-repo }}.git ~/go-source
cd ~/go-source
git checkout ${{ inputs.patch-ref }}
- name: Build patched Go
if: steps.cache-go.outputs.cache-hit != 'true'
shell: bash
run: |
cd ~/go-source/src
./make.bash
mkdir -p ~/patched-go
cp -r ~/go-source/* ~/patched-go/
- name: Add patched Go to PATH
shell: bash
run: |
echo "$HOME/patched-go/bin" >> $GITHUB_PATH
echo "GOROOT=$HOME/patched-go" >> $GITHUB_ENV
# Add GOPATH/bin to PATH (where go install puts binaries)
echo "$HOME/go/bin" >> $GITHUB_PATH
echo "GOPATH=$HOME/go" >> $GITHUB_ENV
- name: Verify installation
shell: bash
run: |
go version
go env GOROOT
go env GOARCH
go env GOOS
- name: Clean up
shell: bash
if: steps.cache-go.outputs.cache-hit != 'true'
run: |
rm -rf ~/go-source