Skip to content

Commit

Permalink
feat: added github apps and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
brittonhayes committed May 12, 2022
1 parent 0685c03 commit d15b4c0
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/.semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enabled: true
titleAndCommits: true
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: true
13 changes: 13 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: reviewdog

on: [pull_request]

jobs:
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test

on: [pull_request]

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Test
run: |
go test -race ./... -coverprofile cover.out
- name: Coverage
run: go tool cover -func cover.out
4 changes: 2 additions & 2 deletions cmd/roll/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func main() {
}))

log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
zerolog.SetGlobalLevel(zerolog.InfoLevel)
zerolog.SetGlobalLevel(zerolog.Disabled)
if *&CLI.Verbose {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}

p, err := parse.NewParser(CLI.Dice)
Expand Down
8 changes: 4 additions & 4 deletions parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewParser(s string) (*Parser, error) {
}
}

log.Debug().Msgf("found %q", p.String())
log.Info().Msgf("found %q", p.String())

return p, nil
}
Expand All @@ -100,17 +100,17 @@ func (p *Parser) Roll() int {
results := 0
for i, die := range p.Dice {
roll := die.Roll()
log.Debug().Msgf("rolled %d with %s", roll, p.Dice[i])
log.Info().Msgf("rolled %d with %s", roll, p.Dice[i])

results += roll
}

switch p.Operator {
case "+":
log.Debug().Msgf("adding %d", p.Modifier)
log.Info().Msgf("adding %d", p.Modifier)
return results + p.Modifier
case "-":
log.Debug().Msgf("subtracting %d", p.Modifier)
log.Info().Msgf("subtracting %d", p.Modifier)
return results - p.Modifier
default:
return results
Expand Down
2 changes: 1 addition & 1 deletion parse/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func init() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
zerolog.SetGlobalLevel(zerolog.Disabled)
}

func TestMatch_valid(t *testing.T) {
Expand Down

0 comments on commit d15b4c0

Please sign in to comment.