📜 add coverage to README #14
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
# Copyright (c) 2023, Serhat Şevki Dinçer. | |
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
name: QA | |
on: | |
push: | |
branches: [ main, dev ] | |
permissions: | |
contents: read | |
env: | |
GOAMD64: v2 | |
jobs: | |
Tests: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
go: [ oldstable, stable ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run Tests | |
if: ${{ matrix.os != 'ubuntu-latest' || matrix.go != 'stable' }} | |
run: go test -timeout 5m -v | |
- name: Run Tests with Coverage | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == 'stable' }} | |
run: | | |
TESTS=$(go test -timeout 5m -v -cover) | |
COVER=$(echo "$TESTS" | sed -En 's#^coverage: (.+%) of statements$#\1#p') | |
echo "COVERAGE=$COVER" >> "$GITHUB_OUTPUT" | |
echo "$TESTS" | |
Benchmarks: | |
needs: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Run Benchmarks | |
run: cd bench && go test -timeout 5m -run ^$ -bench . -benchmem | |
Analysis: | |
needs: Benchmarks | |
permissions: | |
actions: read | |
security-events: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Initialize | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: go | |
- name: Analyze | |
uses: github/codeql-action/analyze@v3 |