Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypipes authored Jun 1, 2024
2 parents 6130ea0 + f88acb3 commit 4bded82
Show file tree
Hide file tree
Showing 57 changed files with 2,325 additions and 1,402 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/fmtcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: fmtcheck

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
fmtcheck:
runs-on: ubuntu-latest
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.21
- name: check fmt
run: 'bash -c "diff -u <(echo -n) <(gofmt -d .)"'
113 changes: 0 additions & 113 deletions .github/workflows/go.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: lint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
pull-requests: read # needed for only-new-issues option below

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.21
- name: lint
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
with:
version: v1.53
args: --timeout=5m0s --verbose
only-new-issues: true
189 changes: 189 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

# see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
jobs:
# tier-1
# main development platform, gets features first and it's most tested
ubuntu-latest:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.19', '1.20', '1.21']
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go }}
- name: run tests
env:
GHW_TESTING_SKIP_BLOCK: "1"
GHW_TESTING_SKIP_GPU: "1"
run: go test -v ./...

ubuntu-2004:
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.18', '1.19']
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go }}
- name: run tests
env:
GHW_TESTING_SKIP_BLOCK: "1"
GHW_TESTING_SKIP_GPU: "1"
run: go test -v ./...

windows-2022:
runs-on: windows-2022
strategy:
matrix:
go: [ '1.20', '1.21' ]
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go }}
- name: run tests
env:
GHW_TESTING_SKIP_BLOCK: "1"
GHW_TESTING_SKIP_GPU: "1"
GHW_TESTING_SKIP_CPU: "1"
GHW_TESTING_SKIP_MEMORY: "1"
GHW_TESTING_SKIP_HOST: "1"
GHW_TESTING_SKIP_NET: "1"
GHW_TESTING_SKIP_PCI: "1"
GHW_TESTING_SKIP_TOPOLOGY: "1"
run: go test -v ./...

windows-2019:
runs-on: windows-2019
strategy:
matrix:
go: [ '1.19' ]
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go }}
- name: run tests
env:
GHW_TESTING_SKIP_BLOCK: "1"
GHW_TESTING_SKIP_GPU: "1"
GHW_TESTING_SKIP_CPU: "1"
GHW_TESTING_SKIP_MEMORY: "1"
GHW_TESTING_SKIP_HOST: "1"
GHW_TESTING_SKIP_NET: "1"
GHW_TESTING_SKIP_PCI: "1"
GHW_TESTING_SKIP_TOPOLOGY: "1"
run: go test -v ./...

# tier-2
# best-effort support, limited to most recent platforms (OS+go)

# NOTE(jaypipes): We currently only support block information on MacOS, and
# the tests have block skipped because we cannot get meaningful information
# about the block devices in the Github Actions Runner virtual machines. So
# this is really just a test of whether the library builds on MacOS 12.
macos-12:
runs-on: macos-12
strategy:
matrix:
go: [ '1.18' ]
steps:
- name: harden runner
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
with:
egress-policy: block
disable-sudo: true
allowed-endpoints: >
github.com:443
api.github.com:443
proxy.github.com:443
raw.githubusercontent.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
- name: checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: setup go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go }}
- name: run tests
env:
GHW_TESTING_SKIP_BLOCK: "1"
GHW_TESTING_SKIP_CPU: "1"
GHW_TESTING_SKIP_GPU: "1"
GHW_TESTING_SKIP_HOST: "1"
GHW_TESTING_SKIP_MEMORY: "1"
GHW_TESTING_SKIP_NET: "1"
GHW_TESTING_SKIP_PCI: "1"
GHW_TESTING_SKIP_TOPOLOGY: "1"
run: go test -v ./...
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM golang:1.15-buster as builder
FROM golang:1.19-buster as builder
WORKDIR /go/src/github.com/jaypipes/ghw

# Force the go compiler to use modules.
ENV GO111MODULE=on
ENV GOPROXY=direct

# go.mod and go.sum go into their own layers.
Expand All @@ -16,7 +14,7 @@ COPY . .

RUN CGO_ENABLED=0 go build -o ghwc ./cmd/ghwc/

FROM alpine:3.7
FROM alpine:3.7@sha256:8421d9a84432575381bfabd248f1eb56f3aa21d9d7cd2511583c68c9b7511d10
RUN apk add --no-cache ethtool

WORKDIR /bin
Expand Down
Loading

0 comments on commit 4bded82

Please sign in to comment.