Skip to content

Commit ead76e3

Browse files
hbelmiroCopilot
andauthored
Added CI (#1)
* Added CI Signed-off-by: Helber Belmiro <helber.belmiro@gmail.com> * Update .github/workflows/ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Helber Belmiro <helber.belmiro@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a5d84a8 commit ead76e3

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

.github/dependabot.yml

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

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
ci:
11+
name: CI
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Check out code
16+
uses: actions/checkout@v4
17+
18+
- name: Cache Go modules
19+
uses: actions/cache@v3
20+
with:
21+
path: |
22+
~/.cache/go-build
23+
~/go/pkg/mod
24+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
25+
restore-keys: |
26+
${{ runner.os }}-go-
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v4
30+
with:
31+
go-version-file: 'go.mod'
32+
33+
- name: Check formatting
34+
run: |
35+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
36+
echo "Code is not formatted. Please run 'gofmt -s -w .'"
37+
gofmt -s -l .
38+
exit 1
39+
fi
40+
41+
- name: Run go vet
42+
run: go vet ./...
43+
44+
- name: Run tests
45+
run: go test ./...
46+
47+
- name: Build
48+
run: go build -v ./...

.github/workflows/codeql.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 6 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'go' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@v3
36+
37+
- name: Perform CodeQL Analysis
38+
uses: github/codeql-action/analyze@v3
39+
with:
40+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)