chore: added some examples #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: Get dependencies | |
run: go mod download | |
- name: Run tests | |
run: go test -v -race -coverprofile=coverage.out ./... | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage.out | |
security: | |
name: Security Scan | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/golang@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
with: | |
args: --severity-threshold=high --json-file-output=snyk.json | |
- name: Upload Snyk results | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
sarif_file: snyk.json | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [test, security] # Wait for both test and security scan | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: Get dependencies | |
run: go mod download | |
- name: Build | |
run: go build -v ./... |