Skip to content

Commit

Permalink
feat(services/minio): Move services minio back (#913)
Browse files Browse the repository at this point in the history
* minio

* Add badge for README

* Move minio back

* Move minio back

* Add empty line at the end of file
  • Loading branch information
Joey-1445601153 committed Oct 20, 2021
1 parent 4052e6a commit a9b2659
Show file tree
Hide file tree
Showing 20 changed files with 1,947 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ updates:
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/services/memory"
schedule:
interval: daily
directory: "/services/memory"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/services/minio"
schedule:
interval: daily
45 changes: 45 additions & 0 deletions .github/workflows/services-test-minio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Services Test Minio"

on:
push:
paths:
- 'services/minio/**'
pull_request:
paths:
- 'services/minio/**'

jobs:
integration_test:
name: "Integration Test"
runs-on: ubuntu-latest

services:
minio:
image: wktk/minio-server
ports:
- 9000:9000
env:
MINIO_ACCESS_KEY: "minioadmin"
MINIO_SECRET_KEY: "minioadmin"

strategy:
matrix:
go: [ "1.15", "1.16" ]

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Checkout repository
uses: actions/checkout@v2

- name: Test
env:
STORAGE_MINIO_INTEGRATION_TEST: "on"
STORAGE_MINIO_CREDENTIAL: "hmac:minioadmin:minioadmin"
STORAGE_MINIO_NAME: "test-bucket"
STORAGE_MINIO_ENDPOINT: "http:127.0.0.1:9000"
working-directory: services/minio
run: make integration_test
4 changes: 4 additions & 0 deletions services/minio/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage.*
bin/
.idea
Makefile.env
29 changes: 29 additions & 0 deletions services/minio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [v0.2.0] - 2021-09-13

### Changed

- ci: Enable auto merge for Dependabot
- docs: Update README (#25)

### Fixed

- fix: Regenerate code

### Upgraded

- build(deps): Bump github.com/minio/minio-go/v7 from 7.0.12 to 7.0.13 (#23)

## v0.1.0 - 2021-07-26

### Added

- Implement MinIO Servicer, Storager, Copier, Reacher.

[v0.2.0]: https://github.com/beyondstorage/go-service-minio/compare/v0.1.0...v0.2.0
43 changes: 43 additions & 0 deletions services/minio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SHELL := /bin/bash

-include Makefile.env

.PHONY: all check format lint build test generate tidy

help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " check to do static check"
@echo " build to create bin directory and build"
@echo " generate to generate code"
@echo " test to run test"

check: vet

format:
go fmt ./...

vet:
go vet ./...

generate:
@echo "generate code"
go generate ./...
go fmt ./...

build: tidy generate check
go build ./...

test:
go test -race -coverprofile=coverage.txt -covermode=atomic -v .
go tool cover -html="coverage.txt" -o "coverage.html"

integration_test:
go test -race -count=1 -covermode=atomic -v ./tests

tidy:
go mod tidy
go mod verify

clean:
@echo "clean generated files"
find . -type f -name 'generated.go' -delete
4 changes: 4 additions & 0 deletions services/minio/Makefile.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export STORAGE_MINIO_INTEGRATION_TEST=on
export STORAGE_MINIO_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_MINIO_NAME=bucketname
export STORAGE_MINIO_ENDPOINT=http:host:port
37 changes: 37 additions & 0 deletions services/minio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[![Services Test Minio](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-minio.yml/badge.svg)](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-minio.yml)

# minio

[MinIO](https://min.io/) is an open source cloud-native high-performance object storage service.
This project will use minio's native SDK to implement [go-storage](https://github.com/beyondstorage/go-storage/),
enabling users to manipulate data on minio servers through a unified interface.

## Install

```go
go get go.beyondstorage.io/services/minio
```

## Usage

```go
import (
"log"

_ "go.beyondstorage.io/services/minio"
"go.beyondstorage.io/v5/services"
)

func main() {
store, err := services.NewStoragerFromString("minio://<bucket_name>/<work_dir>?credential=hmac:<access_key>:<secret_key>&endpoint=https:<host>:<port>")
if err != nil {
log.Fatal(err)
}

// Write data from io.Reader into hello.txt
n, err := store.Write("hello.txt", r, length)
}
```

- See more examples in [go-storage-example](https://github.com/beyondstorage/go-storage-example).
- Read [more docs](https://beyondstorage.io/docs/go-storage/services/minio) about go-service-minio.
6 changes: 6 additions & 0 deletions services/minio/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Package minio provided support for minio by go-storage.
*/
package minio

//go:generate go run -tags tools go.beyondstorage.io/v5/cmd/definitions service.toml
Loading

0 comments on commit a9b2659

Please sign in to comment.