-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
114 lines (108 loc) · 4.49 KB
/
action.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: 'Build Go from source'
description: 'Build and test Go from source code'
inputs:
go_variables:
description: 'Variables and their values ready for export'
required: false
test_build:
description: 'When set to true, all tests of build are executed'
required: false
default: 'true'
runs:
using: "composite"
steps:
- name: Clone master of go
shell: bash
run: git clone --depth=1 --branch master --single-branch --no-tags https://go.googlesource.com/go
- name: Apply patch files
shell: bash
run: |
if [ ! -f *.patch ]; then echo "No patch file found. Skipping."; exit 0; fi
mv *.patch ./go/src/
cd go/src
git config user.email "${{ github.event.pusher.email }}"
git config user.name "${{ github.event.pusher.name }}"
git am --ignore-space-change --ignore-whitespace --whitespace=fix *.patch
git show --stat -n $(ls -1 *.patch | wc -l)
rm ./*.patch
- name: Complete Go set up
shell: bash
run: |
export ${{ inputs.go_variables }}
mkdir -p $(go env GOMODCACHE)
mkdir -p $(dirname $(go env GOENV))
echo $PATH
- name: Build
shell: bash
run: |
export ${{ inputs.go_variables }}
export goos=$(go env GOOS)
export goarch=$(go env GOARCH)
echo "goos=$goos" >> $GITHUB_ENV
echo "goarch=$goarch" >> $GITHUB_ENV
if [ -z "$GOROOT_BOOTSTRAP" ]; then export GOROOT_BOOTSTRAP=$(go env GOROOT); fi
export crosscompile=true
if [ "$(go env GOOS)" == "$(go env GOHOSTOS)" -a "$(go env GOARCH)" == "$(go env GOHOSTARCH)" ]; then crosscompile=false; fi
echo "crosscompile=$crosscompile" >> $GITHUB_ENV
cd go/src
./make.bash --no-banner
- name: Test locally
shell: bash
if: ${{ inputs.test_build == 'true' && env.crosscompile == 'false' }}
run: |
export ${{ inputs.go_variables }}
echo $GOROOT
go version
go env GOROOT
cd go/src
./run.bash --no-rebuild
- name: Test using QEMU
shell: bash
if: ${{ inputs.test_build == 'true' && env.crosscompile == 'true' }}
run: |
go install github.com/iwdgo/gotip-build/architecture@latest
export ${{ inputs.go_variables }}
architecture -imagebase=alpine
export tooldir=${{ env.goos }}_${{ env.goarch }}
docker cp ./go/bin/$tooldir/. xalpine:/usr/local/bin/ # in $PATH
# create directories
docker exec xalpine mkdir -p /tmp/go/src/cmd/go/
docker exec xalpine mkdir /tmp/go/bin/
docker exec xalpine mkdir -p /tmp/go/lib/time/
docker exec xalpine mkdir /tmp/go/misc/
docker exec xalpine mkdir -p /tmp/go/pkg/include/
docker exec xalpine mkdir /tmp/go/pkg/temp/
docker exec xalpine mkdir -p /tmp/go/pkg/tool/$tooldir/
docker exec xalpine mkdir -p /tmp/go/test/bench/
docker exec xalpine mkdir /tmp/go/test/chan/
docker exec xalpine mkdir /tmp/go/test/dwarf/
docker exec xalpine mkdir /tmp/go/test/fixedbugs/
docker exec xalpine mkdir /tmp/go/test/interface/
docker exec xalpine mkdir /tmp/go/test/ken/
docker exec xalpine mkdir /tmp/go/test/syntax/
docker exec xalpine mkdir /tmp/go/test/typeparam/
# Go variables
docker exec xalpine mkdir -p /root/.config/go/ # GOENV
docker exec xalpine mkdir -p /root/.cache/go-build/ # GOCACHE
docker exec xalpine mkdir -p /root/go/pkg/mod/ # GOMODCACHE
docker exec xalpine mkdir /tmp/go-build/
# copy executables, include directory
docker cp ./go/VERSION.cache xalpine:/tmp/go/
docker cp ./go/bin/$tooldir/. xalpine:/tmp/go/bin/
docker cp ./go/pkg/tool/$tooldir/. xalpine:/tmp/go/pkg/tool/$tooldir/
docker cp ./go/misc/. xalpine:/tmp/go/misc/
docker cp ./go/lib/time/zoneinfo.zip xalpine:/tmp/go/lib/time/zoneinfo.zip
docker cp ./go/pkg/include/. xalpine:/tmp/go/pkg/include/
docker cp ./go/src/. xalpine:/tmp/go/src/
docker cp ./go/test/. xalpine:/tmp/go/test/
# Smoke tests
docker exec -w /tmp/go/bin xalpine go version
docker exec -w /tmp/go/bin xalpine go env
# Bash is the default shell when available
export $(cat $GITHUB_ENV | grep usebash)
runbash='./run.bash'
if [ "$usebash" == "false" ]; then runbash='/bin/sh ./run.bash'; fi
docker exec -w /tmp/go/src xalpine $runbash --no-rebuild
branding:
icon: crosshair
color: blue