Skip to content

Commit

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

* Add storj back

* Update comment for doc
  • Loading branch information
Joey-1445601153 authored Oct 21, 2021
1 parent 429fc4f commit 78cb8c4
Show file tree
Hide file tree
Showing 16 changed files with 1,379 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ updates:
directory: "/services/qingstor"
schedule:
interval: daily
- package-ecosystem: gomod
directory: "/services/storj"
schedule:
interval: daily
40 changes: 40 additions & 0 deletions .github/workflows/services-test-storj.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Services Test Storj"

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

jobs:
services_test_storj:
name: "Services Test Storj"
runs-on: self-hosted

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

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

- name: Load secret
uses: 1password/load-secrets-action@v1
env:
STORAGE_STORJ_CREDENTIAL: op://Engineering/Storj/testing/credential
STORAGE_STORJ_NAME: op://Engineering/Storj/testing/name
STORAGE_STORJ_LOCATION: op://Engineering/Storj/testing/location

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

- name: Test
env:
STORAGE_STORJ_INTEGRATION_TEST: on
working-directory: services/storj
run: make integration_test
4 changes: 4 additions & 0 deletions services/storj/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage.*
bin/
Makefile.env
.vscode/
43 changes: 43 additions & 0 deletions services/storj/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/storj/Makefile.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export STORAGE_STORJ_INTEGRATION_TEST=on
export STORAGE_STORJ_CREDENTIAL=apikey:key
export STORAGE_STORJ_NAME=bucketname
export STORAGE_STORJ_LOCATION=location
38 changes: 38 additions & 0 deletions services/storj/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[![Services Test Storj](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-storj.yml/badge.svg)](https://github.com/beyondstorage/go-storage/actions/workflows/services-test-storj.yml)

# storj

[Storj DCS] (Decentralized Cloud Storage) support for [go-storage].

[Storj DCS]: https://www.storj.io
[go-storage]: https://github.com/beyondstorage/go-storage

## Install

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

## Usage

```go
import (
"log"

_ "go.beyondstorage.io/services/storj"
"go.beyondstorage.io/v5/services"
)
s
func main() {
store, err := services.NewStoragerFromString("storj://bucket_name/path/to/workdir")
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/storj) about go-service-storj.
6 changes: 6 additions & 0 deletions services/storj/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Package storj provided support for Storj Decentralized Cloud Storage(https://www.storj.io).
*/
package storj

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

0 comments on commit 78cb8c4

Please sign in to comment.