Skip to content

Commit

Permalink
Merge pull request #1 from vasayxtx/github-actions-ci
Browse files Browse the repository at this point in the history
Configure CI via github actions
  • Loading branch information
MikeYast authored Oct 3, 2024
2 parents 83ba1e7 + 3766d54 commit 69ae54b
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
lint:
strategy:
matrix:
go: [ '1.20' ]
fail-fast: true
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false

- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.1
args: --timeout=5m
32 changes: 32 additions & 0 deletions .github/workflows/sec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Security Scan

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
id-token: write
issues: write
pull-requests: write

jobs:
TruffleHog:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
with:
extra_args: --only-verified
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test_and_lint:
name: Test, Lint, and Coverage
strategy:
matrix:
go: [ '1.20' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: true
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false

- name: Install dependencies
run: go mod download

- name: Run tests with coverage
run: go test -race -cover -coverprofile="coverage.out" -covermode=atomic -v ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.out

- name: Calculate coverage
run: go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}'
id: coverage

0 comments on commit 69ae54b

Please sign in to comment.