Skip to content

CI

CI #1254

Workflow file for this run

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'