Skip to content

Commit

Permalink
[workflow] gosigar (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Aug 7, 2023
1 parent 9d6c926 commit fd68195
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 213 deletions.
139 changes: 0 additions & 139 deletions .ci/Jenkinsfile

This file was deleted.

19 changes: 0 additions & 19 deletions .ci/jobs/defaults.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .ci/jobs/folders.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .ci/jobs/main.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/examples.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set examples=examples\df examples\free examples\ps examples\uptime
(for %%i in (%examples%) do (
go build -o %%i\out.exe ./%%i
%%i\out.exe
))
8 changes: 8 additions & 0 deletions .github/examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

for exampleDir in "examples/df" "examples/free" "examples/ps" "examples/uptime" ; do
go build -o ${exampleDir}/out.exe ./${exampleDir}
pushd ${exampleDir}
./out.exe
popd
done
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: ci

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

permissions:
contents: read

## Concurrency only allowed in the main branch.
## So old builds running for old commits within the same Pull Request are cancelled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Lint
run: |-
go mod tidy && git diff --exit-code
gofmt -l . | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
go vet
test:
strategy:
fail-fast: false
matrix:
go-version: ['1.15', '1.16']
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: '**/go.sum'

- name: Build
run: go build

- name: Test
run: go test -v ./...

- name: Run examples
run: ${{ startsWith(matrix.os,'windows') && '.github/examples.bat' || '.github/examples.sh' }}
18 changes: 18 additions & 0 deletions .github/workflows/opentelemetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: OpenTelemetry Export Trace

on:
workflow_run:
workflows:
- ci
types: [completed]

jobs:
otel-export-trace:
runs-on: ubuntu-latest
steps:
- uses: elastic/apm-pipeline-library/.github/actions/opentelemetry@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Go sigar [![Build Status](https://beats-ci.elastic.co/job/Beats/job/gosigar/job/master/badge/icon)](https://beats-ci.elastic.co/job/Beats/job/gosigar/job/master/)
# Go sigar [![ci](https://github.com/elastic/gosigar/actions/workflows/ci.yml/badge.svg)](https://github.com/elastic/gosigar/actions/workflows/ci.yml)


## Overview
Expand Down
8 changes: 8 additions & 0 deletions sys/windows/syscall_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ func TestEnumProcesses(t *testing.T) {
}

func TestGetDiskFreeSpaceEx(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("test is not running on latest windows versions. See https://github.com/elastic/gosigar/issues/172")
return
}
drives, err := GetLogicalDriveStrings()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -393,6 +397,10 @@ func TestGetVolumes(t *testing.T) {
}

func TestGetVolumePathsForVolume(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("test is not running on latest windows versions. See https://github.com/elastic/gosigar/issues/172")
return
}
volumes, err := GetVolumes()
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit fd68195

Please sign in to comment.