-
Notifications
You must be signed in to change notification settings - Fork 6
111 lines (106 loc) · 4.29 KB
/
ci.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
name: CI
on:
push:
branches: [ main ]
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
legacy:
name: legacy
runs-on: windows-latest
steps:
- name: Setup go 1.17
uses: actions/setup-go@v4
with:
go-version: 1.17 # go 1.18 won't work
- name: Checkout code
uses: actions/checkout@v3
with:
path: repo
- name: Load Modules
run: |
go mod download
go mod vendor
shell: bash
working-directory: repo
- name: Move packages
run: |
mkdir -p path
mv repo/vendor path/src
mkdir -p path/src/github.com/forensicanalysis
mv repo path/src/github.com/forensicanalysis/fslib
cp -r path/src/github.com/forensicanalysis/fslib/replace/context path/src
# echo "package afero" > path/src/github.com/spf13/afero/memmap.go
mkdir -p path/src/io path/src/internal
cp -r $(go env GOROOT)/src/io/fs path/src/io
cp -r $(go env GOROOT)/src/internal/oserror path/src/internal
sed -i 's#sort\.Slice(list, func(i, j int) bool { return list\[i]\.Name() < list\[j]\.Name() })#sort.Sort(SortedDir(list))#g' path/src/io/fs/readdir.go
echo "type SortedDir []DirEntry" >> path/src/io/fs/readdir.go
echo "func (a SortedDir) Len() int { return len(a) }" >> path/src/io/fs/readdir.go
echo "func (a SortedDir) Less(i, j int) bool { return a[i].Name() < a[j].Name() }" >> path/src/io/fs/readdir.go
echo "func (a SortedDir) Swap(i, j int) { a[i], a[j] = a[j], a[i] }" >> path/src/io/fs/readdir.go
shell: bash
- name: Build with go 1.9.7
run: |
mkdir -p go1.9.7
curl -Lso go1.9.7.windows-amd64.zip https://golang.org/dl/go1.9.7.windows-amd64.zip
unzip -q go1.9.7.windows-amd64.zip -d go1.9.7
GOPATH=$GITHUB_WORKSPACE/path GOROOT=$GITHUB_WORKSPACE/go1.9.7/go go1.9.7/go/bin/go build github.com/forensicanalysis/fslib/...
shell: bash
- name: Build with go 1.7.6
run: |
mkdir -p go1.7.6
curl -Lso go1.7.6.windows-amd64.zip https://golang.org/dl/go1.7.6.windows-amd64.zip
unzip -q go1.7.6.windows-amd64.zip -d go1.7.6
GOPATH=$GITHUB_WORKSPACE/path GOROOT=$GITHUB_WORKSPACE/go1.7.6/go go1.7.6/go/bin/go build github.com/forensicanalysis/fslib/...
shell: bash
- name: Build with go 1.5.4
run: |
mkdir -p go1.5.4
curl -Lso go1.5.4.windows-amd64.zip https://golang.org/dl/go1.5.4.windows-amd64.zip
unzip -q go1.5.4.windows-amd64.zip -d go1.5.4
GOPATH=$GITHUB_WORKSPACE/path GOROOT=$GITHUB_WORKSPACE/go1.5.4/go $GITHUB_WORKSPACE/go1.5.4/go/bin/go build github.com/forensicanalysis/fslib/...
shell: bash
- name: Build with go 1.2.2
run: |
mkdir -p go1.2.2
curl -Lso go1.2.2.windows-amd64.zip https://golang.org/dl/go1.2.2.windows-amd64.zip
unzip -q go1.2.2.windows-amd64.zip -d go1.2.2
GOPATH=$GITHUB_WORKSPACE/path GOROOT=$GITHUB_WORKSPACE/go1.2.2/go $GITHUB_WORKSPACE/go1.2.2/go/bin/go build github.com/forensicanalysis/fslib/...
shell: bash
fslib:
name: fslib
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Setup go 1.18
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v3
- name: Download dependencies
run: go mod download
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
args: --verbose --config .github/.golangci.yml --enable gofmt --enable goimports
if: matrix.os != 'windows-latest'
- name: Lint Windows
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
args: --verbose --config .github/.golangci.yml
if: matrix.os == 'windows-latest'
- name: Test
run: go test -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic ./...
shell: bash
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.os == 'windows-latest'