Skip to content

Commit

Permalink
Merge pull request #435 from nextmv-io/merschformann/retire-deprecate…
Browse files Browse the repository at this point in the history
…d-move-packages

Removing deprecated packages and restructure for retiring plugins
  • Loading branch information
merschformann authored Mar 14, 2024
2 parents ad244af + 2b61a1e commit 9210e1c
Show file tree
Hide file tree
Showing 455 changed files with 91 additions and 66,980 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ jobs:
fail-fast: false
matrix:
MOD_PATH:
[./, ./route/google, ./route/here, ./route/osrm, ./route/routingkit]
[
./,
./measure/google,
./measure/here,
./measure/osrm,
./measure/routingkit,
]
steps:
- name: git clone
uses: actions/checkout@v4
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: go test
on: [push]
jobs:
sdk-go-build-test:
runs-on: ubuntu-latest
# Use a matrix strategy to test all the modules simultaneously.
strategy:
fail-fast: false
matrix:
MOD_PATH:
[
./,
./measure/google,
./measure/here,
./measure/osrm,
./measure/routingkit,
]
steps:
# Checks out the changes.
- name: git clone
uses: actions/checkout@v4

# Sets up Go with the version set before.
- name: set up go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache-dependency-path: |
**/go.sum
**/go.mod
# Builds the Go code.
- name: go build
run: go build -v ./...
working-directory: ${{ matrix.MOD_PATH }}

# Runs the Go tests.
- name: go test
run: go test ./...
working-directory: ${{ matrix.MOD_PATH }}
6 changes: 5 additions & 1 deletion .github/workflows/json-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ jobs:
run: npm install prettier@v2.7.1 --global

- name: lint .json files with prettier
run: prettier -c "**/*.json"
run: |
# Only lint if there are .json files in the repo.
if [ -n "$(find . -type f -name '*.json')" ]; then
prettier -c "**/*.json"
fi
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ jobs:
git rev-parse --short HEAD
- name: push release tag
- name: bump version and tag
run: |
git tag $VERSION
echo "Bumping version to $VERSION"
echo "$VERSION" > VERSION
git add VERSION
git commit -m "Bump version to $VERSION"
git push origin ${{ github.ref_name }}
git tag -s $VERSION -m "Release $VERSION"
git push origin $VERSION
working-directory: ./sdk

Expand Down
174 changes: 0 additions & 174 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,33 +165,11 @@ issues:
# Disable default exclude patterns to surface commonly-ignored linting errors.
exclude-use-default: false
exclude-rules:
# Many individual router tests use the same base and this implies
# duplication. The code is not abstracted into a single function to keep the
# testable examples in a nice compact format with all information provided in
# a single snippet.
- path: route/example_option_test\.go
linters:
- dupl
- path: route/example_router_test\.go
linters:
- dupl
# Deactivate lll in route/example_option_test.go
- path: route/example_option_test\.go
linters:
- lll
# Deactivate lll in route/router.go
- path: route/router\.go
linters:
- lll
# Tag should be 'measure' in both cases ByPoint and ByIndex
- path: measure/load\.go
linters:
- tagliatelle
text: measure
- path: route/load\.go
linters:
- tagliatelle
text: measure
# Using math/rand is fine here
- path: common/alias_test\.go
linters:
Expand All @@ -208,10 +186,6 @@ issues:
linters:
- gosec
text: G404
- path: route/osrm/matrix_test\.go
linters:
- gosec
text: G404

# Please note that other Go modules have issues that are ignored but are
# not listed here. The reason is that linting must be done standing on the
Expand All @@ -222,130 +196,6 @@ issues:
# you look for uses of //nolint you will find the other linting issues
# being excluided.

# TODO: fix cyclomatic complexity issues on these templates/legacy. This linter is
# ignored for expediency.
- path: templates/legacy/cloud-routing/helper\.go
linters:
- gocyclo
- path: templates/legacy/cloud-routing/schema\.go
linters:
- gocyclo
- path: templates/legacy/cloud-routing/solver\.go
linters:
- gocyclo
- path: templates/legacy/routing-informs/helper\.go
linters:
- gocyclo
- path: templates/legacy/routing-informs/schema\.go
linters:
- gocyclo
- path: templates/legacy/routing-informs/main\.go
linters:
- gocyclo
- path: templates/legacy/demo-routing/helper\.go
linters:
- gocyclo
- path: templates/legacy/demo-routing/schema\.go
linters:
- gocyclo
- path: templates/legacy/demo-routing/main\.go
linters:
- gocyclo
- path: templates/legacy/pager-duty/main\.go
linters:
- gocyclo
- path: templates/shift-scheduling/main\.go
linters:
- gocyclo
- nestif
- path: templates/order-fulfillment-gosdk/main\.go
linters:
- gocyclo
# json tags are too long and unmarshal does not throw an error where one is
# needed for the signature of the function.
- path: templates/shift-scheduling/schema\.go
linters:
- lll
- unparam
- path: templates/legacy/sudoku/main\.go
linters:
- gocyclo
- path: templates/legacy/unique-matrix-measure/main\.go
linters:
- gocyclo

# TODO: figure out a better way to Marshal to JSON with some sort of error
# checking.
- path: templates/legacy/cloud-routing/schema\.go
linters:
- unparam
text: cloudDuration

# The linter suggests switching an if-elseif-else statement to use switch.
# This is not reasonable right now because the conditions are complex.
- path: templates/legacy/cloud-routing/helper\.go
linters:
- gocritic
text: ifElseChain
- path: templates/legacy/routing-informs/helper\.go
linters:
- gocritic
text: ifElseChain
- path: templates/legacy/demo-routing/helper\.go
linters:
- gocritic
text: ifElseChain
- path: templates/legacy/cluster-tsp/schema\.go
linters:
- unparam
text: cloudDuration

# Now that route, store and dataframes are deprecated
# we get staticcheck errors.
- path: templates/legacy
linters:
- staticcheck
text: "SA1019:"
- path: route
linters:
- staticcheck
text: "SA1019:"
- path: route/google/client\.go
linters:
- staticcheck
text: "SA1019:"
- path: run/legacy_runner\.go
linters:
- staticcheck
text: "SA1019:"
- path: run/simple_runner\.go
linters:
- staticcheck
text: "SA1019:"
- path: run/runner_option_legacy\.go
linters:
- staticcheck
text: "SA1019:"
- path: store
linters:
- staticcheck
text: "SA1019:"
- path: measure/location\.go
linters:
- staticcheck
text: "SA1019:"
- path: measure/location_test\.go
linters:
- staticcheck
text: "SA1019:"

# The linter suggests switching an if-elseif-else statement to use switch.
# This is not reasonable right now because the conditions are complex.
- path: templates/legacy/cluster-tsp/helper\.go
linters:
- gocritic
text: ifElseChain

# Deactivating gocritic because of a gocritic bug that was fixed on October
# 6th, but the fix has not yet been released
# https://github.com/go-critic/go-critic/pull/1273
Expand All @@ -357,30 +207,6 @@ issues:
- path: run/http_runner_config\.go
linters:
- lll
# Deactivate line length because of go tags.
- path: mip/options\.go
linters:
- lll
# Although the name stutters, we need to call it mip.MipOptions because the
# mip package can also handle linear programs, so potentially we may have
# mip.LpOptions.
- path: mip/options\.go
linters:
- revive
text: "exported: type name will be used as mip.MipOptions by other packages, and that stutters"

# Deactivate line length in factory.
- path: 'nextroute/factory/.+\.go'
linters:
- lll
# Deactivate cyclomatic complexity in legacy fleet support.
- path: nextroute/schema/fleet.+\.go
linters:
- gocyclo
# We need to allow long lines for json and runner tags in nextroute options.
- path: nextroute/.+solver.*\.go
linters:
- lll

# The golden file testing framework is only used internally and doesn't need
# to meet the same standards as the rest of the codebase for now.
Expand Down
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@
Nextmv's SDK is a collection of Go APIs for solving decision automation
problems. Please find the following packages:

- [store][store]: an all-purpose modeling kit for decision automation problems,
serving as the core of Nextmv's SDK.
- [route][route]: a modeling kit for vehicle routing problems.
- [run][run]: convenient runners that read an input, run a solver and write an
output.
- [model][model]: modeling components such as integer domains and ranges.
- [mip][mip]: Mixed-Integer Programming API with various solvers.
- [templates][templates]: ready-to-go applications for solving various types of
decision automation problems. Designed to work with the [Nextmv CLI][cli].
- [inputs][inputs]: `.json` inputs for working with the Nextmv routing app.
Designed to work with the [Nextmv CLI][cli].
- [measure][measure]: measures for various distances between locations.
- [golden][golden]: tools for running tests with golden files.

Please visit the official [Nextmv docs][docs] for comprehensive information.

Expand All @@ -25,12 +18,7 @@ Nextmv's SDK is meant to be used in Go projects. To download please run:
go get github.com/nextmv-io/sdk
```

[store]: ./store
[route]: ./route
[run]: ./run
[model]: ./model
[mip]: ./mip
[templates]: ./templates
[inputs]: ./inputs
[measure]: ./measure
[golden]: ./golden
[docs]: https://docs.nextmv.io
[cli]: https://docs.nextmv.io/reference/cli
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.5-dev.0
v1.0.5-dev.2
16 changes: 0 additions & 16 deletions alns/alias.go

This file was deleted.

44 changes: 0 additions & 44 deletions cluster/kmeans/clustermodel.go

This file was deleted.

Loading

0 comments on commit 9210e1c

Please sign in to comment.