Skip to content

Commit 0a648ed

Browse files
committed
chore: add .github ci
Signed-off-by: Christian Stewart <christian@paral.in>
1 parent 5fe42fa commit 0a648ed

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

.github/dependabot.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: daily

.github/workflows/codeql-analysis.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "master" ]
9+
schedule:
10+
- cron: '41 13 * * 6'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'go' ]
25+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
26+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v3
31+
32+
# Initializes the CodeQL tools for scanning.
33+
- name: Initialize CodeQL
34+
uses: github/codeql-action/init@v2
35+
with:
36+
languages: ${{ matrix.language }}
37+
# If you wish to specify custom queries, you can do so here or in a config file.
38+
# By default, queries listed here will override any specified in a config file.
39+
# Prefix the list here with "+" to use these queries and those in the config file.
40+
41+
# 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
42+
# queries: security-extended,security-and-quality
43+
44+
45+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
46+
# If this step fails, then you should remove it and run the build manually (see below)
47+
- name: Autobuild
48+
uses: github/codeql-action/autobuild@v2
49+
50+
# ℹ️ Command-line programs to run using the OS shell.
51+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
52+
53+
# If the Autobuild fails above, remove it and uncomment the following three lines.
54+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
55+
56+
# - run: |
57+
# echo "Run, Build Application using script"
58+
# ./location_of_script_within_repo/buildscript.sh
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@v2

.github/workflows/tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "master" ]
9+
10+
# Builds images for target boards.
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
go: ['1.19']
17+
timeout-minutes: 10
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Setup Go ${{ matrix.go }}
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version: ${{ matrix.go }}
24+
# Cache go build cache, used to speedup go test
25+
# https://markphelps.me/posts/speed-up-your-go-builds-with-actions-cache/
26+
- id: go-cache-paths
27+
run: |
28+
echo "::set-output name=go-build::$(go env GOCACHE)"
29+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
30+
- name: Go Build Cache
31+
uses: actions/cache@v3
32+
with:
33+
path: ${{ steps.go-cache-paths.outputs.go-build }}
34+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
35+
# Cache go mod cache, used to speedup builds
36+
- name: Go Mod Cache
37+
uses: actions/cache@v3
38+
with:
39+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
40+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
41+
- name: Vendor Go
42+
run: go mod vendor
43+
- name: Test Go
44+
run: go test -v ./...

0 commit comments

Comments
 (0)