Skip to content

Commit 2386ee4

Browse files
committed
chore: add basic git workflows and dependabot config
1 parent 9e621c2 commit 2386ee4

7 files changed

Lines changed: 194 additions & 0 deletions

File tree

.github/dependabot.yml

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

.github/workflows/build.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build
2+
on: pull_request
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v3
9+
- name: Install Go
10+
uses: actions/setup-go@v3
11+
with:
12+
go-version: "^1.18"
13+
- name: Set up environment
14+
run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
15+
- name: Run GoReleaser
16+
uses: goreleaser/goreleaser-action@v3
17+
with:
18+
version: latest
19+
args: build --snapshot --rm-dist
20+
- name: Tar up binaries
21+
# work around limitations in the upload/download artifact actions
22+
# https://github.com/actions/download-artifact#limitations
23+
run: tar -cvf dist.tar dist
24+
- name: Upload binaries tar file
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: dist.tar
28+
path: dist.tar

.github/workflows/coverage.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Coverage
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
coverage:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
- name: Configure git
14+
run: |
15+
git config --global user.name "$GITHUB_ACTOR"
16+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
17+
- name: Set up go
18+
uses: actions/setup-go@v3
19+
with:
20+
go-version: "^1.18"
21+
- name: Install Dependencies
22+
run: sudo apt-get update && sudo apt-get -u install libpcsclite-dev
23+
- name: Calculate coverage
24+
run: |
25+
go test -v -covermode=count -coverprofile=coverage.out.raw -coverpkg=./... ./...
26+
grep -v mock_ coverage.out.raw > coverage.out
27+
- name: Convert coverage to lcov
28+
uses: jandelgado/gcov2lcov-action@v1
29+
- name: Coveralls
30+
uses: coverallsapp/github-action@1.1.3
31+
with:
32+
github-token: ${{ secrets.github_token }}
33+
path-to-lcov: coverage.lcov

.github/workflows/lint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
on: pull_request
3+
jobs:
4+
golangci-lint:
5+
name: lint
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v3
10+
- name: Install Go
11+
uses: actions/setup-go@v3
12+
with:
13+
go-version: "^1.18"
14+
- name: golangci-lint
15+
uses: golangci/golangci-lint-action@v3
16+
with:
17+
args: --timeout=180s
18+
commitlint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- name: Lint commit messages
26+
uses: wagoid/commitlint-github-action@v5

.github/workflows/release.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
tag:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
new-tag: ${{ steps.bump-tag.outputs.new }}
11+
new-tag-version: ${{ steps.bump-tag.outputs.new_tag_version }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
- name: Configure Git
18+
run: |
19+
git config --global user.name "$GITHUB_ACTOR"
20+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
21+
- name: Install Go
22+
uses: actions/setup-go@v3
23+
with:
24+
go-version: "^1.18"
25+
- name: Install ccv
26+
run: >
27+
curl -sSL https://github.com/smlx/ccv/releases/download/v0.3.2/ccv_0.3.2_linux_amd64.tar.gz
28+
| sudo tar -xz -C /usr/local/bin ccv
29+
- name: Bump tag if necessary
30+
id: bump-tag
31+
run: |
32+
if [ -z $(git tag -l $(ccv)) ]; then
33+
git tag $(ccv)
34+
git push --tags
35+
echo "::set-output name=new::true"
36+
echo "::set-output name=new_tag_version::$(git tag --points-at HEAD)"
37+
fi
38+
release:
39+
needs: tag
40+
if: needs.tag.outputs.new-tag == 'true'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
with:
46+
fetch-depth: 0
47+
- name: Install Go
48+
uses: actions/setup-go@v3
49+
with:
50+
go-version: "^1.18"
51+
- name: Set up environment
52+
run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
53+
- name: Run GoReleaser
54+
uses: goreleaser/goreleaser-action@v3
55+
with:
56+
version: latest
57+
args: release --rm-dist
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tag to Release
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Install Go
13+
uses: actions/setup-go@v3
14+
with:
15+
go-version: "^1.18"
16+
- name: Set up environment
17+
run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV
18+
- name: Run GoReleaser
19+
uses: goreleaser/goreleaser-action@v3
20+
with:
21+
version: latest
22+
args: release --rm-dist
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Test
2+
on: pull_request
3+
jobs:
4+
go-test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v3
9+
- name: Install Go
10+
uses: actions/setup-go@v3
11+
with:
12+
go-version: "^1.18"
13+
- name: Run Tests
14+
run: go test -v ./...

0 commit comments

Comments
 (0)