-
Notifications
You must be signed in to change notification settings - Fork 58
81 lines (71 loc) · 2.67 KB
/
go.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
name: goloader Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: auto
strategy:
fail-fast: false
matrix:
go-second-version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: macos-latest
go-second-version: 8
- os: macos-latest
go-second-version: 9
- os: macos-latest
go-second-version: 10
include:
- os: macos-11
go-second-version: 8
- os: macos-11
go-second-version: 9
- os: macos-11
go-second-version: 10
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.${{ matrix.go-second-version }}.x
- name: Rename cmd/internal
shell: sh
run:
cp -r `go env GOROOT`/src/cmd/internal `go env GOROOT`/src/cmd/objfile
- name: Checkout code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
- name: Build
run:
go build github.com/pkujhd/goloader/examples/loader
- name: Compile const.go
shell: sh
run: |
if [ ${{ matrix.go-second-version }} -ge 20 ]; then
go list -export -f '{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}' std `go list -f {{.Imports}} $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go | awk '{sub(/^\[/, ""); print }' | awk '{sub(/\]$/, ""); print }'` > importcfg
go tool compile -importcfg importcfg $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go
else
go tool compile $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go
fi
- name: Compile base.go
shell: sh
run: |
if [ ${{ matrix.go-second-version }} -ge 20 ]; then
go list -export -f '{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}' std `go list -f {{.Imports}} $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go | awk '{sub(/^\[/, ""); print }' | awk '{sub(/\]$/, ""); print }'` > importcfg
go tool compile -importcfg importcfg $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go
else
go tool compile $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go
fi
- name: Test base.o
run:
./loader -o base.o -run main.main
- name: Test const.o
run:
./loader -o const.o -run main.main