Skip to content

Commit

Permalink
Merge pull request #395 from fairDataSociety/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
asabya authored Feb 20, 2023
2 parents 98e514b + c1fe26b commit 60e7c88
Show file tree
Hide file tree
Showing 204 changed files with 9,259 additions and 2,827 deletions.
12 changes: 8 additions & 4 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
version = 1

[[analyzers]]
name = "shell"
name = "go"
enabled = true

[analyzers.meta]
import_paths = ["github.com/fairdatasociety/fairOS-dfs"]

[[analyzers]]
name = "go"
name = "test-coverage"
enabled = true

[analyzers.meta]
import_root = "github.com/fairDataSociety/fairOS-dfs"
[[analyzers]]
name = "docker"
enabled = true
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ updates:
schedule:
interval: weekly
day: sunday
target-branch: "staging"
4 changes: 2 additions & 2 deletions .github/workflows/coverge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -24,6 +24,6 @@ jobs:
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: |
go test -coverprofile=cover.out ./...
go test -coverprofile=cover.out $(go list ./... | grep -v wasm)
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: [1.17]
go: [1.19]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Setup Go
Expand All @@ -39,11 +39,11 @@ jobs:
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Lint
if: matrix.os == 'ubuntu-latest'
run: make lint
- name: Vet
if: matrix.os == 'ubuntu-latest'
run: make vet
- name: Build
run: make build
- name: Test with Race Detector
if: matrix.os == 'ubuntu-latest'
run: make test-race
Expand Down
68 changes: 67 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -38,3 +38,69 @@ jobs:
run: |-
sudo rm -rf dist
make release
build-mobile:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
run: |
curl -o sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip sdk-tools.zip -d $HOME/android-sdk
echo "y" | $HOME/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk "platform-tools" "build-tools;30.0.3"
export PATH=$PATH:$HOME/android-sdk/platform-tools
rm sdk-tools.zip
go mod tidy
- name: Install gomobile
run: go install golang.org/x/mobile/cmd/gomobile@latest
- name: Build android aar
run: |
make android
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist --config .goreleaser-mobile.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-wasm:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Build wasm
run: |
make wasm
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist --config .goreleaser-wasm.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ cover.out

# goreleaser environment resources
.release-env
.docker-creds
.docker-creds

fairos.aar
fairos-sources.jar
fairos.wasm
fairos.wasm.gz
8 changes: 8 additions & 0 deletions .goreleaser-mobile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
project_name: fairos

release:
prerelease: auto
extra_files:
- glob: ./fairos.aar
builds:
- skip: true
9 changes: 9 additions & 0 deletions .goreleaser-wasm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project_name: fairos

release:
prerelease: auto
extra_files:
- glob: ./fairos.wasm
- glob: ./fairos.wasm.gz
builds:
- skip: true
8 changes: 4 additions & 4 deletions DISCLAIMER
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ performance of this software.


# Disclaimer of Endorsement
Reference herein to any specific commercial product, process, or service by trade
name, trademark, manufacturer, or otherwise, in this Work does not constitute an
endorsement, recommendation, or favoring by the any Government and
shall not be used for advertising or product endorsement purposes.
Reference herein to any specific commercial product, process, or service by trade
name, trademark, manufacturer, or otherwise, in this Work does not constitute an
endorsement, recommendation, or favoring by the any Government and
shall not be used for advertising or product endorsement purposes.
38 changes: 24 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
GO ?= go
GOLANGCI_LINT ?= $$($(GO) env GOPATH)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.47.2
GOLANGCI_LINT_VERSION ?= v1.50.0
GOGOPROTOBUF ?= protoc-gen-gogofaster
GOGOPROTOBUF_VERSION ?= v1.3.1

COMMIT ?= "$(shell git describe --long --dirty --always --match "" || true)"
VERSION ?= "$(shell git describe --tags --abbrev=0 || true)"
LDFLAGS ?= -s -w -X github.com/fairdatasociety/fairOS-dfs.commit="$(COMMIT)" -X github.com/fairdatasociety/fairOS-dfs.version="$(VERSION)"
DEST ?= "$(shell (go list ./... | grep -v wasm))"

.PHONY: all
all: build lint vet test-race binary
all: lint vet test-race binary

.PHONY: binary
binary: export CGO_ENABLED=1
Expand All @@ -23,7 +24,7 @@ dist:

.PHONY: lint
lint: linter
$(GOLANGCI_LINT) run
$(GOLANGCI_LINT) run --skip-dirs wasm

.PHONY: linter
linter:
Expand All @@ -36,33 +37,29 @@ swagger:

.PHONY: vet
vet:
$(GO) vet ./...
$(GO) vet "$(DEST)"

.PHONY: test-race
test-race:
$(GO) test -race -timeout 300000ms -v ./...
$(GO) test -race -timeout 300000ms -v "$(DEST)"

.PHONY: test
test:
$(GO) test -v ./...

.PHONY: build
build:
$(GO) build ./...
$(GO) test -v "$(DEST)"

.PHONY: githooks
githooks:
ln -f -s ../../.githooks/pre-push.bash .git/hooks/pre-push

.PHONY: protobuftools
protobuftools:
which protoac || ( echo "install protoc for your system from https://github.com/protocolbuffers/protobuf/releases" && exit 1)
which protoc || ( echo "install protoc for your system from https://github.com/protocolbuffers/protobuf/releases" && exit 1)
which $(GOGOPROTOBUF) || ( cd /tmp && GO111MODULE=on $(GO) get -u github.com/gogo/protobuf/$(GOGOPROTOBUF)@$(GOGOPROTOBUF_VERSION) )

.PHONY: protobuf
protobuf: GOFLAGS=-mod=mod # use modules for protobuf file include option
protobuf: protobuftools
$(GO) generate -run protoc ./...
$(GO) generate -run protoc "$(DEST)"

.PHONY: clean
clean:
Expand All @@ -77,17 +74,30 @@ release:
-v `pwd`:/go/src/github.com/fairDataSociety/fairOS-dfs \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/fairDataSociety/fairOS-dfs \
ghcr.io/goreleaser/goreleaser-cross:v1.19.0 release --rm-dist
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 release --rm-dist

.PHONY: release-dry-run
release-dry-run:
docker run --rm --privileged \
-v ~/go/pkg/mod:/go/pkg/mod \
-v ~/go/bin:/go/bin \
-v `pwd`:/go/src/github.com/fairDataSociety/fairOS-dfs \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/fairDataSociety/fairOS-dfs \
ghcr.io/goreleaser/goreleaser-cross:v1.19.0 release --rm-dist \
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 release --rm-dist \
--skip-validate=true \
--skip-publish

.PHONY: wasm
wasm:
@GOOS=js GOARCH=wasm $(GO) build -ldflags="-s -w" -o fairos.wasm ./wasm
@gzip -9 -v -c fairos.wasm > fairos.wasm.gz

.PHONY: android
android:
$(GO) get golang.org/x/mobile/bind
gomobile init
gomobile bind -androidapi 21 -o fairos.aar -target=android -ldflags "$(LDFLAGS)" github.com/fairdatasociety/fairOS-dfs/gomobile
$(GO) mod tidy

FORCE:
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

Latest documentation is available at [https://docs.fairos.fairdatasociety.org/docs/](https://docs.fairos.fairdatasociety.org/docs/)

![FairOS-dfs](https://github.com/fairDataSociety/fairOS-dfs/blob/master/docs/images/FairOS-dfs.png)
![FairOS-dfs](./docs/images/FairOS-dfs.png)

The Decentralised File System (dfs) is a file system built for the [FairOS](https://github.com/fairDataSociety/fairOS/blob/master/README.md).
It is a stateless thin layer which uses the building blocks provided by Swarm to provide high level functionalities like
- Exposing a logical file system
- Creation of logical drives
- User and Permission management
- Charging and Payments
- Mutable, Indexed data structures over immmutable file system
- Mutable, Indexed data structures over immutable file system

dfs can be used for the following use cases
1) Personal data store
Expand Down Expand Up @@ -62,13 +62,11 @@ To get the most out of your FairOS-dfs it is important that you configure FairOS
bee:
bee-api-endpoint: http://localhost:1633
postage-batch-id: ""
is-gateway-proxy: false
```

##### Configuration for FairOS-dfs
```
dfs:
data-dir: /Users/fairos/.fairOS/dfs
ports:
http-port: :9090
pprof-port: :9091
Expand Down Expand Up @@ -110,11 +108,9 @@ This is how a config file should look like
bee:
bee-api-endpoint: http://localhost:1633
postage-batch-id: <BATCH>
is-gateway-proxy: false
cookie-domain: localhost
cors-allowed-origins: []
dfs:
data-dir: /Users/username/.fairOS/dfs
ports:
http-port: :9090
pprof-port: :9091
Expand Down Expand Up @@ -158,13 +154,9 @@ Flags:
Global Flags:
--beeApi string full bee api endpoint (default "localhost:1633")
--config string config file (default "/Users/sabyasachipatra/.dfs.yaml")
--dataDir string store data in this dir (default "dataDirPath")
--verbosity string verbosity level (default "trace")
```

### Introduction to Key Value Store over Swarm
[![](https://j.gifs.com/6XZwvl.gif)](https://gateway.ethswarm.org/access/130dcf7d01442836bc14c8c38db32ebfc4d5771c28677438b6a2a2a078bd1414)

### HTTP APIs

https://docs.fairos.fairdatasociety.org/docs/fairOS-dfs/api-reference
Expand Down Expand Up @@ -214,5 +206,4 @@ network: "testnet"
bee:
bee-api-endpoint: http://localhost:1633 # bee running on mainnet
postage-batch-id: <BATCH>
is-gateway-proxy: false
```
Loading

0 comments on commit 60e7c88

Please sign in to comment.