Skip to content

Commit

Permalink
count loc in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
gernotstarke committed Jan 4, 2025
1 parent a8322f7 commit 94679e5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,23 @@ jobs:
label: Coverage
message: ${{ env.COVERAGE }}%
color: ${{ env.COVERAGE >= 80 && 'green' || env.COVERAGE >= 60 && 'yellow' || 'red' }}
if: always()
if: always()

- name: Install cloc
run: sudo apt-get install cloc

- name: Count Lines of Code
run: |
LOC=$(cloc --json --include-lang=Go . | jq '.SUM.code')
echo "LOC=${LOC}" >> $GITHUB_ENV
- name: Create Lines of Code Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.DYNAMIC_GIST_ACTION }}
gistID: ${{ secrets.DYNA_GIST_ID }}
filename: minion-loc.json
label: Lines of Code
message: ${{ env.LOC }}
color: lightblue
if: always()
15 changes: 15 additions & 0 deletions go-app/internal/domain/minionTypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,21 @@ func TestDefaultCanOverridePageCountPrefix(t *testing.T) {
assert.Equal(t, newPageCountPrefix, defaultConfig.PageCountPrefix)
}

func TestDefaultCanOverrideBlankPageText(t *testing.T) {
const newBlankPageText = "blankPage"

defaultConfig := NewDefaultConfig(language.English)
assert.Equal(t, DefaultBlankPageText, defaultConfig.BlankPageText)
assert.NotEqual(t, DefaultBlankPageText, newBlankPageText)

other := &MinionConfig{
BlankPageText: newBlankPageText,
}

assert.NoError(t, defaultConfig.MergeWith(other), "MergeWith should not return an error")
assert.Equal(t, newBlankPageText, defaultConfig.BlankPageText)
}

func TestMinionConfig_MergeWithMinimal(t *testing.T) {
minimalBaseConfig := &MinionConfig{SourceDir: "/original/source"}
other := &MinionConfig{
Expand Down

0 comments on commit 94679e5

Please sign in to comment.