Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workflow] gosigar #171

Merged
merged 16 commits into from
Aug 7, 2023
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.

7 changes: 7 additions & 0 deletions .github/examples.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

for %%exampleDir in (examples/df examples/free examples/ps examples/uptime) do (
go build -o %%exampleDir/out.exe ./%%exampleDir
v1v marked this conversation as resolved.
Show resolved Hide resolved
cd %%exampleDir
v1v marked this conversation as resolved.
Show resolved Hide resolved
out.exe
cd ..
)
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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: ci

on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '**.md'
- '**.asciidoc'
pull_request:
paths-ignore:
- '**.md'
- '**.asciidoc'

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-2019]
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
Loading