-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from smlx/update-ci
Update CI workflows
- Loading branch information
Showing
23 changed files
with
339 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Taken from: https://github.com/wagoid/commitlint-github-action/blob/7f0a61df502599e1f1f50880aaa7ec1e2c0592f2/commitlint.config.mjs */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { maxLineLength } from '@commitlint/ensure' | ||
|
||
const bodyMaxLineLength = 100 | ||
|
||
const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => { | ||
const { type, scope, body } = parsedCommit | ||
const isDepsCommit = | ||
type === 'chore' && (scope === 'deps' || scope === 'deps-dev') | ||
|
||
return [ | ||
isDepsCommit || !body || maxLineLength(body, bodyMaxLineLength), | ||
`body's lines must not be longer than ${bodyMaxLineLength}`, | ||
] | ||
} | ||
|
||
export default { | ||
extends: ['@commitlint/config-conventional'], | ||
plugins: ['commitlint-plugin-function-rules'], | ||
rules: { | ||
'body-max-line-length': [0], | ||
'function-rules/body-max-line-length': [ | ||
2, | ||
'always', | ||
validateBodyMaxLengthIgnoringDeps, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
commit-message: | ||
prefix: chore | ||
include: scope | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" | ||
update-types: | ||
- "minor" | ||
- "patch" | ||
- package-ecosystem: docker | ||
commit-message: | ||
prefix: chore | ||
include: scope | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
groups: | ||
docker: | ||
patterns: | ||
- "*" | ||
update-types: | ||
- "minor" | ||
- "patch" | ||
- package-ecosystem: gomod | ||
commit-message: | ||
prefix: chore | ||
include: scope | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
groups: | ||
gomod: | ||
patterns: | ||
- "*" | ||
update-types: | ||
- "minor" | ||
- "patch" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://github.com/cncf/foundation/blob/main/allowed-third-party-license-policy.md | ||
allow-licenses: | ||
- 'Apache-2.0' | ||
- 'BSD-2-Clause' | ||
- 'BSD-2-Clause-FreeBSD' | ||
- 'BSD-3-Clause' | ||
- 'ISC' | ||
- 'MIT' | ||
- 'PostgreSQL' | ||
- 'Python-2.0' | ||
- 'X11' | ||
- 'Zlib' | ||
|
||
allow-dependencies-licenses: | ||
# this action is GPL-3 but it is only used in CI | ||
# https://github.com/actions/dependency-review-action/issues/530#issuecomment-1638291806 | ||
- pkg:githubactions/vladopajic/go-test-coverage@bcd064e5ceef1ccec5441519eb054263b6a44787 | ||
# this package is MPL-2.0 and has a CNCF exception | ||
# https://github.com/cncf/foundation/blob/9b8c9173c2101c1b4aedad3caf2c0128715133f6/license-exceptions/cncf-exceptions-2022-04-12.json#L43C17-L43C47 | ||
- pkg:golang/github.com/go-sql-driver/mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
name: Build | ||
on: pull_request | ||
name: build | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
permissions: {} | ||
jobs: | ||
build: | ||
build-snapshot: | ||
permissions: | ||
contents: read | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version: stable | ||
- name: Install Dependencies (ubuntu) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt-get update && sudo apt-get -u install libpcsclite-dev | ||
- name: Set up environment | ||
run: echo "GOVERSION=$(go version)" >> $GITHUB_ENV | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
- uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | ||
id: goreleaser | ||
with: | ||
version: latest | ||
args: build --snapshot --rm-dist --config .goreleaser.${{ matrix.os }}.yml | ||
args: build --clean --verbose --snapshot --config .goreleaser.${{ matrix.os }}.yaml | ||
check-tag: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
fetch-depth: 0 | ||
- id: ccv | ||
uses: smlx/ccv@d3de774e9b607b079940a7a86952f44643743336 # v0.9.0 | ||
with: | ||
write-tag: false | ||
- run: | | ||
echo "new-tag=$NEW_TAG" | ||
echo "new-tag-version=$NEW_TAG_VERSION" | ||
env: | ||
NEW_TAG: ${{steps.ccv.outputs.new-tag}} | ||
NEW_TAG_VERSION: ${{steps.ccv.outputs.new-tag-version}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
name: Coverage | ||
name: coverage | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
jobs: | ||
coverage: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Configure git | ||
run: | | ||
git config --global user.name "$GITHUB_ACTOR" | ||
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Set up go | ||
uses: actions/setup-go@v5 | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version: stable | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get -u install libpcsclite-dev | ||
- name: Calculate coverage | ||
run: | | ||
go test -v -covermode=count -coverprofile=coverage.out.raw -coverpkg=./... ./... | ||
grep -v mock_ coverage.out.raw > coverage.out | ||
- name: Convert coverage to lcov | ||
uses: jandelgado/gcov2lcov-action@v1.0.9 | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@v2.2.3 | ||
go test -v -covermode=atomic -coverprofile=cover.out.raw -coverpkg=./... ./... | ||
# remove generated code from coverage calculation | ||
grep -Ev 'internal/mock|_enumer.go' cover.out.raw > cover.out | ||
- name: Generage coverage badge | ||
uses: vladopajic/go-test-coverage@1079cd4e58dda229c04ffdb6324fc3756b8542ff # v2.10.1 | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
profile: cover.out | ||
local-prefix: github.com/${{ github.repository }} | ||
git-token: ${{ secrets.GITHUB_TOKEN }} | ||
# orphan branch for storing badges | ||
git-branch: badges |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: dependency review | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
permissions: {} | ||
jobs: | ||
dependency-review: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 | ||
with: | ||
config-file: .github/dependency-review-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
name: Lint | ||
on: pull_request | ||
name: lint | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
permissions: {} | ||
jobs: | ||
golangci-lint: | ||
name: lint | ||
lint-go: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get -u install libpcsclite-dev | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version: stable | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v5 | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get -u install libpcsclite-dev | ||
- uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 | ||
with: | ||
version: latest | ||
commitlint: | ||
args: --timeout=180s --enable gocritic | ||
lint-commits: | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
fetch-depth: 0 | ||
- name: Lint commit messages | ||
uses: wagoid/commitlint-github-action@v5.4.5 | ||
- uses: wagoid/commitlint-github-action@7f0a61df502599e1f1f50880aaa7ec1e2c0592f2 # v6.0.1 | ||
with: | ||
configFile: .github/commitlint.config.mjs | ||
lint-actions: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- uses: docker://rhysd/actionlint:1.7.0@sha256:601d6faeefa07683a4a79f756f430a1850b34d575d734b1d1324692202bf312e # v1.7.0 | ||
with: | ||
args: -color |
Oops, something went wrong.