Add option to filter by entry type #456
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
name: CI | |
on: push | |
env: | |
GO_VERSION: '1.22' | |
STATIC_CHECK_VERSION: '2023.1.6' | |
COUNT_LOC_DOCKER_IMAGE: 'aldanial/cloc:1.98' | |
jobs: | |
statistics: | |
name: Statistics | |
runs-on: ubuntu-latest | |
env: | |
TARGET: klog/ | |
TEST_FILE_PATTERN: .*_test\.go | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare tooling | |
run: docker pull "${COUNT_LOC_DOCKER_IMAGE}" | |
- name: LOC of source files | |
run: docker run --rm -v $(pwd):/wdir:ro -w /wdir "${COUNT_LOC_DOCKER_IMAGE}" --not-match-f="${TEST_FILE_PATTERN}" "${TARGET}" | |
- name: LOC of test files | |
run: docker run --rm -v $(pwd):/wdir:ro -w /wdir "${COUNT_LOC_DOCKER_IMAGE}" --match-f="${TEST_FILE_PATTERN}" "${TARGET}" | |
benchmark: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build | |
run: | | |
source ./run.sh && run::build | |
mv out/klog /usr/local/bin/klog | |
- name: Run benchmark | |
run: cd .github/ && ./benchmark.sh | |
format: | |
name: Static analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Check format | |
run: | | |
source ./run.sh | |
dirty_files="$(run::format)" | |
if [[ "${dirty_files}" != "" ]]; then $(exit 1); fi | |
- name: Run linters | |
run: | | |
go install "honnef.co/go/tools/cmd/staticcheck@${STATIC_CHECK_VERSION}" | |
source ./run.sh | |
run::lint | |
test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Print info about environment | |
run: go version | |
- name: Install dependencies | |
run: source ./run.sh && run::install | |
- name: Run unit tests | |
run: source ./run.sh && run::test |