Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(release): v0.1.0-beta.4 #10

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.sh text eol=lf
*.go text eol=lf
*.ps1 text eol=lf
*.md text eol=lf

# Declare files that will always have CRLF line endings on checkout.
*.{cmd,[cC][mM][dD]} text eol=crlf
Expand Down
97 changes: 97 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

---
name: 🧪 Test

on:
pull_request:
branches:
- main
types:
- opened
- synchronize
schedule:
- cron: "0 2 * * *"
workflow_dispatch:

concurrency:
group: ${{ format('{0}-{1}-{2}-{3}-{4}', github.workflow, github.event_name, github.ref, github.base_ref || null, github.head_ref || null) }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
checks: write

jobs:
test:
name: 🧪 Test
runs-on: ubuntu-latest
steps:
- name: ⤵️ Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: 🚧 Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: go.mod
cache: false

- name: 🚧 Setup Task
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
with:
repo-token: ${{ github.token }}

- name: 🔨 Setup Test tools
run: task test:tools

- name: 🧪 Run fake tests
run: task test

- name: 📢 Publish test results
if: always()
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
with:
name: 📜 Test results
reporter: jest-junit
path: testresults.xml

- name: ⚙️ Get Coverage summary
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: "40 60"

- name: 📢 Publish coverage results
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

- name: 📤 Upload test results
if: always()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: test-results
path: testresults.xml
if-no-files-found: warn
overwrite: true

- name: 📤 Upload coverage results
if: always()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: test-coverage-results
path: |
coverage.html
coverage.json
coverage.out
coverage.txt
coverage.xml
code-coverage-results.md
if-no-files-found: warn
overwrite: true
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# Test results
testresults.xml
coverage.out
coverage.json
coverage.txt
coverage.xml
coverage.html
code-coverage-results.md
62 changes: 62 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
# docs: https://taskfile.dev
#
# Windows:
# winget install Task.Task
#
# Linux:
# sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
# echo 'command -v task >/dev/null || export PATH="$PATH:$HOME/.local/bin"' >> ~/.profile
# source ~/.profile
#
# macOS:
# brew install go-task/tap/go-task
---
version: "3"

vars:
PWSH: pwsh -NonInteractive -NoProfile -NoLogo -Command

tasks:
test:
desc: Run tests
cmds:
- go clean -testcache
- '{{if eq .GITHUB_ACTIONS "true"}}gotestsum --format-hivis --format github-actions --junitfile "testresults.xml" -- ./... -p 4 -timeout 10m -coverprofile="coverage.out" -covermode atomic{{end}}'
- '{{if ne .GITHUB_ACTIONS "true"}}gotestsum --format-hivis --format pkgname-and-test-fails --junitfile "testresults.xml" -- ./... -p 4 -timeout 10m -coverprofile="coverage.out" -covermode atomic{{end}}'
- task: test:getcover

test:getcover:
desc: Get test coverage results
internal: true
cmds:
- gocov convert coverage.out > coverage.json
- gocov report coverage.json > coverage.txt
- cmd: |
{{ .PWSH }} 'Get-Content coverage.json | gocov-xml > coverage.xml'
platforms: [windows]
- cmd: gocov-xml < coverage.json > coverage.xml
platforms: [linux, darwin]
- go tool cover -html coverage.out -o coverage.html

test:tools:
desc: Install Test Tools
dir: "{{.goSdkOutput}}"
cmds:
- for: [gotestsum, gocov, gocov-xml]
task: install:{{.ITEM}}

install:gotestsum:
desc: Install GoTestSum
cmds:
- go install gotest.tools/gotestsum@latest

install:gocov:
desc: Install gocov
cmds:
- go install github.com/axw/gocov/gocov@latest

install:gocov-xml:
desc: Install gocov-xml
cmds:
- go install github.com/AlekSi/gocov-xml@latest
68 changes: 66 additions & 2 deletions fabric/core/fake/jobscheduler_server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading