-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include QoP and add Github workflows
- Loading branch information
1 parent
5edceeb
commit c1e5ea9
Showing
10 changed files
with
186 additions
and
14 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,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 99 |
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,22 @@ | ||
#!/bin/bash | ||
|
||
TMPDIR=$(mktemp -d) | ||
|
||
cleanup() { | ||
rm -rf "${TMPDIR}" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
|
||
gofmt -l -d . >${TMPDIR}/fmt.out | ||
|
||
if [ -s ${TMPDIR}/fmt.out ]; | ||
then | ||
echo "The following files are not formatted correctly:" | ||
cat ${TMPDIR}/fmt.out | ||
exit 1 | ||
fi | ||
|
||
echo "gofmt-output=gofmt step successful" >>$GITHUB_OUTPUT | ||
exit 0 |
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,57 @@ | ||
name: Checks | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
consistency-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
|
||
- name: Code format check | ||
run: ./.github/scripts/gofmt | ||
|
||
- uses: dominikh/staticcheck-action@v1.3.1 | ||
with: | ||
working-directory: v3 | ||
|
||
basic-tests: | ||
name: Basic tests | ||
strategy: | ||
matrix: | ||
# os: ['windows-latest', 'ubuntu-latest'] | ||
os: ['ubuntu-latest'] | ||
go-version: ['1.21.x', '1.22.x' ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Generate test includes | ||
run: | | ||
echo pkgs=$(cd v3 && go list ./... | grep -v /examples/) >> "$GITHUB_ENV" | ||
- name: Run tests | ||
run: cd v3 && go test $pkgs -count 100 -coverprofile=../cover.out -covermode=atomic | ||
|
||
- name: Check test coverage | ||
uses: vladopajic/go-test-coverage@v2 | ||
with: | ||
config: ./.testcoverage.yml |
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,55 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go '1.22.x' | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22.x' | ||
- name: Generate test includes | ||
run: | | ||
echo pkgs=$(go list ./... | grep -v /examples/) >> "$GITHUB_ENV" | ||
- name: Generate coverage profile | ||
run: | | ||
go test $pkgs -count 100 -coverprofile=./cover.out -covermode=atomic | ||
- name: Generate report | ||
run: | | ||
mkdir -p ./coverage | ||
go tool cover -html=cover.out -o ./coverage/coverage.html | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./coverage | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,27 @@ | ||
# (mandatory) | ||
# Path to coverprofile file (output of `go test -coverprofile` command). | ||
# | ||
# For cases where there are many coverage profiles, such as when running | ||
# unit tests and integration tests separately, you can combine all those | ||
# profiles into one. In this case, the profile should have a comma-separated list | ||
# of profile files, e.g., 'cover_unit.out,cover_integration.out'. | ||
profile: cover.out | ||
|
||
# (optional; but recommended to set) | ||
# When specified reported file paths will not contain local prefix in the output | ||
local-prefix: "github.com/jake-scott/go-functional" | ||
|
||
# Holds coverage thresholds percentages, values should be in range [0-100] | ||
threshold: | ||
# (optional; default 0) | ||
# The minimum coverage that each file should have | ||
file: 75 | ||
|
||
# (optional; default 0) | ||
# The minimum coverage that each package should have | ||
package: 85 | ||
|
||
# (optional; default 0) | ||
# The minimum total coverage project should have | ||
total: 95 | ||
|
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
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