mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-10 19:29:14 +08:00
[ci] Implement automatic tests on GH Actions on linux, windows and darwin
Based off 3710bfcc3e/.github/workflows/test.yml
This commit is contained in:
parent
f2b8fbd047
commit
29304ebf73
91
.github/workflows/test.yml
vendored
Normal file
91
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
on: [push, pull_request]
|
||||
name: Test
|
||||
jobs:
|
||||
test_v3_module:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.12.x, 1.14.x, 1.15.x]
|
||||
os: [ubuntu-18.04, ubuntu-16.04, windows-2019, windows-2016, macOS-10.14, macos-11.0]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: |
|
||||
cd ./v3/
|
||||
go test ./...
|
||||
|
||||
test_v3_gopath:
|
||||
env:
|
||||
GOPATH: ${{ github.workspace }}
|
||||
GO111MODULE: off
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.13.x, 1.14.x, 1.15.x]
|
||||
os: [ubuntu-18.04, ubuntu-16.04, windows-2019, windows-2016, macOS-10.14, macos-11.0]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}/src/github.com/shirou/gopsutil
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -t github.com/shirou/gopsutil/v3/...
|
||||
- name: Test
|
||||
run: |
|
||||
go test github.com/shirou/gopsutil/v3/...
|
||||
|
||||
test_v2_gopath:
|
||||
env:
|
||||
GOPATH: ${{ github.workspace }}
|
||||
GO111MODULE: off
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.12.x, 1.14.x, 1.15.x]
|
||||
os: [ubuntu-18.04, ubuntu-16.04, windows-2019, windows-2016, macOS-10.14, macos-11.0]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}/src/github.com/shirou/gopsutil
|
||||
- name: Get dependencies
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
go get -d -u github.com/golang/dep
|
||||
cd $Env:GOPATH/src/github.com/golang/dep
|
||||
git checkout v0.5.4
|
||||
go install -ldflags="-X main.version=v0.5.4" ./cmd/dep
|
||||
echo "$Env:GOPATH/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
cd $Env:GOPATH/src/github.com/shirou/gopsutil
|
||||
dep ensure
|
||||
# exclude v3 from being run with ./...
|
||||
try { rm -ErrorAction:Stop -Recurse -Force $Env:GOPATH/src/github.com/shirou/gopsutil/v3 } catch [System.Management.Automation.ItemNotFoundException] {}
|
||||
- name: Get dependencies
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
if ! command -v dep &>/dev/null; then
|
||||
mkdir -p $GOPATH/bin
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
echo "PATH=$GOPATH/bin:$PATH" >> $GITHUB_PATH
|
||||
fi
|
||||
cd $GOPATH/src/github.com/shirou/gopsutil
|
||||
dep ensure
|
||||
# exclude v3 from being run with ./...
|
||||
rm -rf $GOPATH/src/github.com/shirou/gopsutil/v3
|
||||
- name: Test
|
||||
run: |
|
||||
go test github.com/shirou/gopsutil/...
|
Loading…
x
Reference in New Issue
Block a user