Skip to content

chore: Update CI workflows #28

chore: Update CI workflows

chore: Update CI workflows #28

Workflow file for this run

name: ci
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch: {}
# Inputs are available under: github.event.inputs.{name}
# inputs:
# name:
# description: 'Variable description'
# required: true
# default: 'default value here'
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
jobs:
# Scan direct Go dependencies for known vulnerabilities
scan:
name: scan for vulnerabilities
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4
# Configure runner environment
- name: Set up runner environment
run: ./.github/workflows/assets/utils.sh setup
env:
GITHUB_USER: ${{ github.actor }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19.x
# List direct dependencies
- name: List dependencies
run: go list -mod=readonly -f '{{if not .Indirect}}{{.}}{{end}}' -m all > go.list
# Scan dependencies using Nancy
# https://github.com/sonatype-nexus-community/nancy-github-action
- name: Scan dependencies
uses: sonatype-nexus-community/[email protected]
# Runs on every push and pull request on the selected branches.
# Can also be executed manually.
test:
name: code quality and correctness
needs: scan
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4
# Configure runner environment
- name: Set up runner environment
run: ./.github/workflows/assets/utils.sh setup
env:
GITHUB_USER: ${{ github.actor }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# Style consistency and static analysis using 'golangci-lint'
# https://github.com/marketplace/actions/run-golangci-lint
- name: Static analysis
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
# Run unit tests
- name: Test
run: make test
env:
CIRCLE_API_KEY: ${{ secrets.CIRCLE_API_KEY }}
# Save artifacts
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: assets
path: |
coverage.html