Skip to content

Commit

Permalink
build: add scop and nfpm (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravisuhag authored Aug 21, 2022
1 parent feed51c commit 31d262e
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 45 deletions.
32 changes: 20 additions & 12 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
project_name: guardian

release:
prerelease: auto

before:
hooks:
- go mod tidy
- make clean

builds:
- main: ./main.go
id: "guardian"
- id: "guardian"
main: ./main.go
binary: guardian
flags:
- -a
Expand All @@ -22,7 +19,6 @@ builds:
goarch: [amd64, 386, arm, arm64]
env:
- CGO_ENABLED=0

archives:
- replacements:
darwin: macos
Expand All @@ -33,21 +29,17 @@ archives:
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^build:"

checksum:
name_template: "checksums.txt"

snapshot:
name_template: "{{ .Tag }}-next"

dockers:
- goos: linux
goarch: amd64
Expand All @@ -58,11 +50,27 @@ dockers:
- "docker.io/odpf/{{.ProjectName}}:latest"
- "docker.io/odpf/{{.ProjectName}}:{{ .Version }}"
- "docker.io/odpf/{{.ProjectName}}:{{ .Tag }}-amd64"

nfpms:
- maintainer: ODPF
description: Universal data access tool
homepage: https://github.com/odpf/guardian
license: Apache 2.0
formats:
- deb
- rpm
replacements:
darwin: macOS
scoop:
bucket:
owner: odpf
name: scoop-bucket
homepage: "https://github.com/odpf/guardian"
description: "Universal data access tool"
license: Apache 2.0
brews:
- name: guardian
homepage: "https://github.com/odpf/guardian"
description: "Universal data access tool."
description: "Universal data access tool"
tap:
owner: odpf
name: homebrew-tap
Expand Down
129 changes: 96 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,82 @@ Download the appropriate version for your platform from [releases](https://githu
You don’t need to install it into a global location. This works well for shared hosts and other systems where you don’t have a privileged account.
Ideally, you should install it somewhere in your PATH for easy use. `/usr/local/bin` is the most probable location.

#### Homebrew
#### macOS

`guardian` is available via a Homebrew Tap, and as downloadable binary from the [releases](https://github.com/odpf/guardian/releases/latest) page:

```sh
brew install odpf/tap/guardian
```

To upgrade to the latest version:

```
brew upgrade guardian
```

Check for installed guardian version

```sh
# Install guardian (requires homebrew installed)
$ brew install odpf/tap/guardian
guardian version
```

#### Windows

`guardian` is available via [scoop](https://scoop.sh/), and as a downloadable binary from the [releases](https://github.com/odpf/guardian/releases/latest) page:

```
scoop bucket add guardian https://github.com/odpf/scoop-bucket.git
```

To upgrade to the latest version:

```
scoop update guardian
```

#### Docker

We provide ready to use Docker container images. To pull the latest image:

```
docker pull odpf/guardian:latest
```

To pull a specific version:

```
docker pull odpf/guardian:v0.3.2
```

# Upgrade guardian (requires homebrew installed)
$ brew upgrade guardian
If you like to have a shell alias that runs the latest version of pscale from docker whenever you type `pscale`:

# Check for installed guardian version
$ guardian version
```
mkdir -p $HOME/.config/odpf
alias guardian="docker run -e HOME=/tmp -v $HOME/.config/odpf:/tmp/.config/odpf --user $(id -u):$(id -g) --rm -it -p 3306:3306/tcp odpf/guardian:latest"
```

## Usage

Guardian is purely API-driven. It is very easy to get started with Guardian. It provides CLI, HTTP and GRPC APIs for simpler developer experience.

### CLI
#### CLI

Guardian CLI is fully featured and simple to use, even for those who have very limited experience working from the command line. Run `guardian --help` to see list of all available commands and instructions to use.

List of commands

```
guardian --help
```
# List of commands
$ guardian --help

# Print command reference
$ guardian reference
Print command reference

```sh
guardian reference
```

### API
#### API

Guardian provides a fully-featured GRPC and HTTP API to interact with Guardian server. Both APIs adheres to a set of standards that are rigidly followed. Please refer to [proton](https://github.com/odpf/proton/tree/main/odpf/guardian/v1beta1) for GRPC API definitions.

Expand All @@ -81,38 +127,55 @@ Guardian provides a fully-featured GRPC and HTTP API to interact with Guardian s

</details>

```sh
# Clone the repo
$ git clone [email protected]:odpf/guardian.git
Clone the repo

# Install all the golang dependencies
$ make install
```
git clone [email protected]:odpf/guardian.git
```

# Check all build commands available
$ make help
Install all the golang dependencies

# Build meteor binary file
$ make build
```
make install
```

# Init config
$ cp internal/server/config.yaml config.yaml
$ ./guardian config init
Build guardian binary file

```
make build
```

# Run database migrations
$ ./guardian server migrate
Init config

# Start guardian server
$ ./guardian server start
```
cp internal/server/config.yaml config.yaml
./guardian config init
```

Run database migrations

```
./guardian server migrate -c config.yaml
```

Start guardian server

```
./guardian server start -c config.yaml
```

## Running tests

Running all unit tests

```sh
# Running all unit tests
$ make test
make test
```

Print code coverage

# Print code coverage
$ make coverage
```
make coverage
```

## Contribute
Expand Down

0 comments on commit 31d262e

Please sign in to comment.