-
Notifications
You must be signed in to change notification settings - Fork 315
/
Copy pathgo-1.20.yaml
139 lines (123 loc) · 3.85 KB
/
go-1.20.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package:
name: go-1.20
version: 1.20.14
epoch: 4
description: "the Go programming language"
copyright:
- license: BSD-3-Clause
dependencies:
provides:
- go=1.20.999 # This should be go=${{package.version}}-${{package.epoch}}
runtime:
- bash
- binutils-gold # Needed for cgo linking due to upstream issue #15696 which forces use of the gold linker.
- build-base
environment:
contents:
packages:
- bash
- build-base
- busybox
- ca-certificates-bundle
- gcc-go
pipeline:
- uses: fetch
with:
uri: https://go.dev/dl/go${{package.version}}.src.tar.gz
expected-sha256: 1aef321a0e3e38b7e91d2d7eb64040666cabdcc77d383de3c9522d0d69b67f4e
strip-components: 0
- runs: |
cd go/src
./make.bash -v
- runs: |
cd go
mkdir -p "${{targets.destdir}}"/usr/bin "${{targets.destdir}}"/usr/lib/go/bin "${{targets.destdir}}"/usr/share/doc/go
for bin in go gofmt; do
install -Dm755 bin/$bin "${{targets.destdir}}"/usr/lib/go/bin/$bin
ln -s /usr/lib/go/bin/$bin "${{targets.destdir}}"/usr/bin/
done
cp -a pkg lib "${{targets.destdir}}"/usr/lib/go/
cp -r doc misc "${{targets.destdir}}"/usr/share/doc/go
cp -a src "${{targets.destdir}}"/usr/lib/go/
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/obj
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/bootstrap
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/tool/*/api
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/*/cmd
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/tool/*/api
rm -rf "${{targets.destdir}}"/usr/lib/go/pkg/tool/*/go_bootstrap
rm -rf "${{targets.destdir}}"/usr/lib/go/src/cmd/dist/dist
# Remove tests from /usr/lib/go/src, not needed at runtime
find "${{targets.destdir}}"/usr/lib/go/src \( -type f -a -name "*_test.go" \) \
-exec rm -rf \{\} \+
find "${{targets.destdir}}"/usr/lib/go/src \( -type d -a -name "testdata" \) \
-exec rm -rf \{\} \+
find "${{targets.destdir}}"/usr/lib/go/src \( -type f -a -name "*.rc" \) \
-exec rm -rf \{\} \+
find "${{targets.destdir}}"/usr/lib/go/src \( -type f -a -name "*.bat" \) \
-exec rm -rf \{\} \+
- uses: strip
subpackages:
- name: "go-1.20-doc"
description: "go documentation"
pipeline:
- runs: |
mkdir -p "${{targets.subpkgdir}}"/usr/share
mv "${{targets.destdir}}"/usr/share/doc "${{targets.subpkgdir}}"/usr/share/
test:
pipeline:
- uses: test/docs
update:
enabled: true
shared: true
github:
identifier: golang/go
strip-prefix: go
tag-filter: go1.20
use-tag: true
test:
environment:
contents:
packages:
- build-base
pipeline:
- name: Test Go installation
runs: |
# Write a simple "Hello World" Go program
cat <<EOF > hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
EOF
# Format the Go program
go fmt hello.go
# Run the Go program and check the output
go run hello.go | grep "Hello World"
go version
go help
gofmt --help
- name: Test Go cross-compilation
runs: |
# Build the Go program for a different OS/architecture
GOOS=freebsd GOARCH=amd64 go build hello.go
- name: Test Go with cgo
runs: |
# Write a Go program that uses cgo
cat <<EOF > hello_cgo.go
package main
/*
#include <stdlib.h>
#include <stdio.h>
void hello() {
printf("%s\\n", "Hello from cgo!");
fflush(stdout);
}
*/
import "C"
func main() {
C.hello()
}
EOF
# Run the Go program with cgo and check the output
go run hello_cgo.go | grep "Hello from cgo!"