Skip to content

Commit

Permalink
Add deadcode analysis CI check
Browse files Browse the repository at this point in the history
Fail the build if any dead code is detected.
  • Loading branch information
andrew-farries committed Jan 25, 2024
1 parent 908485f commit 5ec42fb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,30 @@ jobs:
exit 1
fi
dead-code-check:
name: dead code check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install deadcode tool
run: |
go install golang.org/x/tools/cmd/deadcode@latest
- name: Run deadcode analysis
run: |
deadcode > deadcode-out
if [ ! -s deadcode-out ]; then
echo "Dead code analysis failed!"
echo "Dead code analysis found the following dead code:"
cat deadcode-out
fi
license-check:
name: license check
runs-on: ubuntu-latest
Expand Down

0 comments on commit 5ec42fb

Please sign in to comment.