diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6798cb2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: +- package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..ee033d2 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,53 @@ +name: "Code scanning - action" + +on: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + schedule: + - cron: '0 11 * * 2' + +jobs: + CodeQL-Build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..8186943 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,35 @@ +name: Go + +on: + push: + pull_request: + schedule: + - cron: '5 10 * * SUN' + +jobs: + + build: + strategy: + matrix: + go-version: [1.19.x, 1.20.x] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + name: "Build ${{ matrix.go-version }} test on ${{ matrix.platform }}" + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Get dependencies + run: go get -v -t -d ./... + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -race -v ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..18ed529 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,18 @@ +name: golangci-lint + +on: + push: + pull_request: + schedule: + - cron: '5 5 * * SUN' + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest diff --git a/README.md b/README.md index d89c6d8..8f78424 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# xgb2shap +# xgbshap + +[![GoDoc](https://godoc.org/github.com/maxmind/xgbshap?status.png)](https://pkg.go.dev/github.com/maxmind/xgbshap) This is a Go package for calculating feature contributions for [XGBoost](https://github.com/dmlc/xgboost) models. The code is ported from diff --git a/contributions.go b/contributions.go index 61248bf..ff86c01 100644 --- a/contributions.go +++ b/contributions.go @@ -2,7 +2,7 @@ package xgbshap // Much of this code is ported from the xgboost C++ code. // -// # Copyright by XGBoost Contributors 2017-2023 +// Copyright by XGBoost Contributors 2017-2023 // // xgboost's code is Apache 2.0 licensed. diff --git a/predictor.go b/predictor.go index 58508ac..008b15b 100644 --- a/predictor.go +++ b/predictor.go @@ -1,11 +1,11 @@ // Package xgbshap calculates feature contributions for XGBoost models. -// +package xgbshap + // Much of this code is ported from the xgboost C++ code. // -// # Copyright by XGBoost Contributors 2017-2023 +// Copyright by XGBoost Contributors 2017-2023 // // xgboost's code is Apache 2.0 licensed. -package xgbshap import ( "fmt"