Skip to content

Commit

Permalink
TASK: fine-tuning of new release mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-daehne committed Feb 17, 2023
1 parent af8ec1b commit 3757d36
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 79 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
output.*
/build/
/dist/
45 changes: 22 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ You can download [the latest release](https://github.com/sandstorm/dependency-an

```shell
# download release
wget -O sda https://github.com/sandstorm/dependency-analysis/releases/download/v1.0.0/sda.X
chmod +x sda
# … or compile sda
open https://github.com/sandstorm/dependency-analysis/releases/

# … or install via homebrew
brew install sandstorm/tap/sandstorm-dependency-analysis

# … or compile sda locally
go build -o ~/bin/sda

# install GraphViz (with Homebrew on OSX)
Expand Down Expand Up @@ -90,7 +93,14 @@ docker run --rm \
- [--show-image (visualize and OSX only)](#--show-image-visualize-and-osx-only)
- [--show-node-labels (visualize only)](#--show-node-labels-visualize-only)
- [-T, --type string (visualize only)](#-t---type-string-visualize-only)
- [Prepare new release](#prepare-new-release)
- [Limitations](#limitations)
- [Code needs to be neatly formatted](#code-needs-to-be-neatly-formatted)
- [Imports only](#imports-only)
- [Commented lines](#commented-lines)
- [Unused imports](#unused-imports)
- [Developer documentation](#developer-documentation)
- [Start from source](#start-from-source)
- [Release](#release)
- [Add a new command](#add-a-new-command)
- [Helpful development commands](#helpful-development-commands)
- [Documentation of Libraries and Tools](#documentation-of-libraries-and-tools)
Expand Down Expand Up @@ -344,22 +354,22 @@ Unused imports are treated as normal imports.
* [install Golang](https://golangdocs.com/install-go-mac-os)
* `brew install graphviz`
* [install the Sandstorm `dev` script helper](https://github.com/sandstorm/dev-script-runner)
## Start from source
```sh
go run .
dev run
# or
go run . --help
# or
go test ./parsing
dev run --help
```
## Prepare new release
## Release
```sh
# adjust version as needed
./release.sh v1.0.0
git tag v1.0.0
dev release
```
## Add a new command
Expand All @@ -373,19 +383,8 @@ cobra-cli add helloWorld
## Helpful development commands
```sh
# auto-format all .go file
find . -type f -name '*.go' | xargs -Ifile go fmt file
# or
go fmt ./analysis
# print docs
go doc -all ./dataStructures
# or
go doc ./dataStructures
# docs in browser
go install golang.org/x/tools/cmd/godoc@latest
godoc -http=:8080
# see all dev scripts
dev help
# visualize all Java projects in current folder
find . -type d | grep -iE 'src/main/java$' | xargs -Isrc bash -c 'export project=$(echo src | cut -d / -f 2); sda visualize src -o $project.svg -l $project'
Expand Down
20 changes: 9 additions & 11 deletions analysis/graphAnalyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,15 @@ func calculateWeightsByDescendants(target *dataStructures.WeightedStringGraph, n
// A graph in the shape of an eight contains three cycles, but we are
// only interested in the two shorter ones.
//
// ┌───────┬────────┐
// │ │ │
// ▼ │ ▼
//
// ┌───┐ ┌───┐ ┌───┐
// │ A │ │ B │ │ C │
// └───┘ └───┘ └───┘
//
// │ ▲ │
// │ │ │
// └───────┴────────┘
// | ┌───────┬────────┐
// | │ │ │
// | ▼ │ ▼
// | ┌───┐ ┌───┐ ┌───┐
// | │ A │ │ B │ │ C │
// | └───┘ └───┘ └───┘
// | │ ▲ │
// | │ │ │
// | └───────┴────────┘
//
// Cycles:
// * A -> B -> A (considered)
Expand Down
19 changes: 18 additions & 1 deletion dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ set -e

######### TASKS #########

# Starts the project from source
function run() {
go run . $@
}

# Compiles the project into a local binary
function build() {
go build .
Expand Down Expand Up @@ -42,9 +47,21 @@ function test() {
# Builds the project locall and creates a release
function release() {
test
docker build -t sandstormmedia/dependency-analysis:latest .
goreleaser release --clean
_log_green "done"
_log_yellow "TODO: implement docker image releases"
_log_yellow "Manual steps:"
_log_yellow " - docker tag sandstormmedia/dependency-analysis:latest sandstormmedia/dependency-analysis:version-goes-here"
_log_yellow " - docker push sandstormmedia/dependency-analysis:latest"
_log_yellow " - docker push sandstormmedia/dependency-analysis:the-version"
}

# Docs in the browser at localhost:8080
function docs() {
which godoc || go install golang.org/x/tools/cmd/godoc@latest
_log_green "Please open http://localhost:8080/pkg/github.com/sandstorm/dependency-analysis/"
_log_green "Terminate with Ctrl + C"
godoc -http=:8080
}

_log_green "---------------------------- RUNNING TASK: $1 ----------------------------"
Expand Down
44 changes: 0 additions & 44 deletions release.sh

This file was deleted.

0 comments on commit 3757d36

Please sign in to comment.