Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit d926a24

Browse files
committed
add checks workflows
1 parent 71bb73d commit d926a24

3 files changed

Lines changed: 209 additions & 0 deletions

File tree

.github/workflows/code-check.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# This GitHub action runs your tests for each commit push and/or PR. Optionally
2+
# you can turn it on using a cron schedule for regular testing.
3+
#
4+
name: Provider Code Check
5+
on:
6+
pull_request:
7+
paths-ignore:
8+
- 'README.md'
9+
- '.vscode'
10+
- '.gitignore'
11+
- 'CHANGELOG.md'
12+
- 'CONTRIBUTING.md'
13+
- 'LICENSE'
14+
push:
15+
branches: [ "main" ]
16+
paths-ignore:
17+
- 'README.md'
18+
- '.vscode'
19+
- '.gitignore'
20+
- 'CHANGELOG.md'
21+
- 'CONTRIBUTING.md'
22+
- 'LICENSE'
23+
# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
24+
# we recommend testing at a regular interval not necessarily tied to code changes. This will
25+
# ensure you are alerted to something breaking due to an API change, even if the code did not
26+
# change.
27+
# schedule:
28+
# - cron: '0 13 * * *'
29+
jobs:
30+
# ensure the code builds...
31+
build:
32+
name: Build
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 5
35+
steps:
36+
37+
- name: Check out code into the Go module directory
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version-file: 'go.mod'
44+
id: go
45+
46+
- name: Get dependencies
47+
run: |
48+
go mod download
49+
50+
- name: Check dependencies
51+
run: |
52+
make depscheck
53+
54+
- name: Vet
55+
run: |
56+
make vet
57+
58+
- name: Build
59+
run: |
60+
make build
61+
62+
golangci-lint:
63+
needs: [build]
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-go@v5
68+
with:
69+
go-version-file: 'go.mod'
70+
71+
- id: golangci-lint-version
72+
working-directory: tools
73+
run: >-
74+
echo "version=$(
75+
go list -m all |
76+
grep github.com/golangci/golangci-lint |
77+
awk '{print $2}'
78+
)" >> $GITHUB_OUTPUT
79+
80+
- name: lint
81+
uses: golangci/golangci-lint-action@v6
82+
with:
83+
version: "${{ steps.golangci-lint-version.outputs.version }}"
84+
85+
importlint:
86+
needs: [build]
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: actions/setup-go@v5
91+
with:
92+
go-version-file: 'go.mod'
93+
94+
- run: cd tools && go install github.com/pavius/impi/cmd/impi
95+
96+
- name: Check dependencies
97+
run: make depscheck
98+
99+
- name: import lint
100+
run: |
101+
make importlint
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '34 8 * * 5'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
- name: Install Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version-file: go.mod
47+
48+
# Initializes the CodeQL tools for scanning.
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@v3
51+
with:
52+
languages: ${{ matrix.language }}
53+
# If you wish to specify custom queries, you can do so here or in a config file.
54+
# By default, queries listed here will override any specified in a config file.
55+
# Prefix the list here with "+" to use these queries and those in the config file.
56+
57+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
58+
# queries: security-extended,security-and-quality
59+
60+
61+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
62+
# If this step fails, then you should remove it and run the build manually (see below)
63+
- name: Autobuild
64+
uses: github/codeql-action/autobuild@v3
65+
66+
# ℹ️ Command-line programs to run using the OS shell.
67+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
68+
69+
# If the Autobuild fails above, remove it and uncomment the following three lines.
70+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
71+
72+
# - run: |
73+
# echo "Run, Build Application using script"
74+
# ./location_of_script_within_repo/buildscript.sh
75+
76+
- name: Perform CodeQL Analysis
77+
uses: github/codeql-action/analyze@v3

.github/workflows/gosec-scan.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Security Scan"
2+
3+
# Run workflow each time code is pushed to your repository and on a schedule.
4+
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
5+
on:
6+
push:
7+
branches: [ "main" ]
8+
pull_request:
9+
# The branches below must be a subset of the branches above
10+
branches: [ "main" ]
11+
schedule:
12+
- cron: '0 0 * * 0'
13+
14+
jobs:
15+
tests:
16+
runs-on: ubuntu-latest
17+
env:
18+
GO111MODULE: on
19+
steps:
20+
- name: Checkout Source
21+
uses: actions/checkout@v4
22+
- name: Run Gosec Security Scanner
23+
uses: securego/gosec@master
24+
with:
25+
# we let the report trigger content trigger a failure using the GitHub Security features.
26+
args: '-no-fail -fmt sarif -out results.sarif ./...'
27+
- name: Upload SARIF file
28+
uses: github/codeql-action/upload-sarif@v3
29+
with:
30+
# Path to SARIF file relative to the root of the repository
31+
sarif_file: results.sarif

0 commit comments

Comments
 (0)