Skip to content

Commit

Permalink
Fixes and refactoring of CI files
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby committed Dec 18, 2023
1 parent a2fff51 commit 4682090
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 61 deletions.
4 changes: 1 addition & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
directory: "/"
labels:
- "🤖 Dependencies"
schedule:
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
on: [push]
name: Benchmark

on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"

jobs:
Compare:
runs-on: ubuntu-latest
Expand All @@ -8,15 +27,19 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.19.x

- name: Fetch Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Benchmark
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt

- name: Get Previous Benchmark Results
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Save Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
Expand Down
26 changes: 23 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
on: [push, pull_request]
name: Linter
name: Golangci Lint Check

on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"

jobs:
Golint:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Golint
uses: reviewdog/action-golangci-lint@v2
with:
Expand Down
44 changes: 37 additions & 7 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
on: [push, pull_request]
name: Security
name: Gosec Security Scan

on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"

jobs:
Gosec:
gosec-scan:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Fetch Repository
uses: actions/checkout@v3
- name: Run Gosec
uses: securego/gosec@master
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
args: -exclude-dir=internal/*/ ./...
go-version: 'oldstable'
check-latest: true
cache: false

- name: Install Gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest

- name: Run Gosec
run: gosec -exclude-dir=internal ./...
58 changes: 27 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,37 @@ on:
push:
branches:
- master
- main
paths:
- "**"
- "!docs/**"
- "!**.md"
pull_request:
name: Tests
paths:
- "**"
- "!docs/**"
- "!**.md"

name: Test
jobs:
Tests:
Build:
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
go-version: [1.19.x, 1.20.x, 1.21.x]
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Setup Golang caches
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Fetch Repository
uses: actions/checkout@v3
- name: Run Test
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 15
command: go test ./... -v -race
- name: Fetch Repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Run Test
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 15
command: go test ./... -v -race -count=1
49 changes: 34 additions & 15 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
on: [push, pull_request_target]
name: Vulnerability Check

on:
push:
branches:
- master
- main
paths:
- "**"
- "!docs/**"
- "!**.md"
pull_request:
paths:
- "**"
- "!docs/**"
- "!**.md"

jobs:
Security:
govulncheck-check:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.19.x
- name: Fetch Repository
uses: actions/checkout@v3
- name: Install Govulncheck
run: |
export GO111MODULE=on
export PATH=${PATH}:`go env GOPATH`/bin
go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run Govulncheck
run: "`go env GOPATH`/bin/govulncheck ./..."
- name: Fetch Repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "stable"
check-latest: true
cache: false

- name: Install Govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run Govulncheck
run: govulncheck ./...

0 comments on commit 4682090

Please sign in to comment.