Skip to content

Commit 569fc86

Browse files
authored
Merge pull request #415 from fairDataSociety/staging
Staging
2 parents e271fcd + 149da1d commit 569fc86

File tree

167 files changed

+4983
-785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+4983
-785
lines changed

.github/workflows/coverge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Go
1616
uses: actions/setup-go@v1
1717
with:
18-
go-version: 1.17
18+
go-version: 1.19
1919
- name: Checkout
2020
uses: actions/checkout@v2
2121
with:
@@ -24,6 +24,6 @@ jobs:
2424
env:
2525
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
2626
run: |
27-
go test -coverprofile=cover.out ./...
27+
go test -coverprofile=cover.out $(go list ./... | grep -v wasm)
2828
curl https://deepsource.io/cli | sh
2929
./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
1616
matrix:
17-
go: [1.17]
17+
go: [1.19]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
steps:
2020
- name: Setup Go
@@ -39,11 +39,11 @@ jobs:
3939
${{ runner.OS }}-build-
4040
${{ runner.OS }}-
4141
- name: Lint
42+
if: matrix.os == 'ubuntu-latest'
4243
run: make lint
4344
- name: Vet
45+
if: matrix.os == 'ubuntu-latest'
4446
run: make vet
45-
- name: Build
46-
run: make build
4747
- name: Test with Race Detector
4848
if: matrix.os == 'ubuntu-latest'
4949
run: make test-race

.github/workflows/release.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Go
1919
uses: actions/setup-go@v2
2020
with:
21-
go-version: 1.18
21+
go-version: 1.19
2222
- name: Checkout
2323
uses: actions/checkout@v2
2424
with:
@@ -38,3 +38,48 @@ jobs:
3838
run: |-
3939
sudo rm -rf dist
4040
make release
41+
42+
build-mobile:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Setup Java
46+
uses: actions/setup-java@v3
47+
with:
48+
distribution: 'temurin'
49+
java-version: '17'
50+
51+
- name: Setup Android SDK
52+
run: |
53+
curl -o sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
54+
unzip sdk-tools.zip -d $HOME/android-sdk
55+
echo "y" | $HOME/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk "platform-tools" "build-tools;30.0.3"
56+
export PATH=$PATH:$HOME/android-sdk/platform-tools
57+
- name: Install gomobile
58+
run: go install golang.org/x/mobile/cmd/gomobile@latest
59+
- name: Build android aar
60+
run: |
61+
make android
62+
- name: Run GoReleaser
63+
uses: goreleaser/goreleaser-action@v2
64+
with:
65+
distribution: goreleaser
66+
version: latest
67+
args: release --rm-dist --config .goreleaser-mobile.yaml
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
71+
build-wasm:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Build wasm
75+
run: |
76+
make wasm
77+
- name: Run GoReleaser
78+
uses: goreleaser/goreleaser-action@v2
79+
with:
80+
distribution: goreleaser
81+
version: latest
82+
args: release --rm-dist --config .goreleaser-wasm.yaml
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ cover.out
3232

3333
# goreleaser environment resources
3434
.release-env
35-
.docker-creds
35+
.docker-creds
36+
37+
fairos.aar
38+
fairos-sources.jar

.goreleaser-mobile.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
project_name: fairos
2+
3+
release:
4+
prerelease: auto
5+
extra_files:
6+
- glob: ./fairos.aar
7+
builds:
8+
- skip: true

.goreleaser-wasm.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
project_name: fairos
2+
3+
release:
4+
prerelease: auto
5+
extra_files:
6+
- glob: ./dist/fairos.wasm
7+
- glob: ./dist/fairos.wasm.gz
8+
builds:
9+
- skip: true

DISCLAIMER

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,3 @@ Reference herein to any specific commercial product, process, or service by trad
2929
name, trademark, manufacturer, or otherwise, in this Work does not constitute an
3030
endorsement, recommendation, or favoring by the any Government and
3131
shall not be used for advertising or product endorsement purposes.
32-
=======
33-
# DISCLAIMER
34-
Account integrity persistence and security are not assured. Expect that funds
35-
used for account might be lost, as well as any data the account uses.
36-
37-
Use of this service is limited only to **non-sensitive and publicly available
38-
data**. Users must not use, share, or store any kind of sensitive data like
39-
health status, provision or payment of healthcare, Personally Identifiable
40-
Information (PII) and/or Protected Health Information (PHI), etc. under **ANY**
41-
circumstance.
42-
43-
Administrators for this service can not moderate any information
44-
used, shared, or stored with this service at any time. Any user that cannot
45-
abide by this disclaimer and Code of Conduct must refrain from using this service.
46-
47-
The material embodied in this software is provided to you "as-is" and without
48-
warranty of any kind, express, implied or otherwise, including without
49-
limitation, any warranty of fitness for a particular purpose. In no event shall
50-
the any government be liable to you or anyone else for any direct, special, incidental,
51-
indirect or consequential damages of any kind, or any damages whatsoever,
52-
including without limitation, loss of profit, loss of use, savings or revenue,
53-
or the claims of third parties, whether or not any government has
54-
been advised of the possibility of such loss, however caused and on any theory
55-
of liability, arising out of or in connection with the possession, use or
56-
performance of this software.
57-
58-
59-
# Disclaimer of Endorsement
60-
Reference herein to any specific commercial product, process, or service by trade
61-
name, trademark, manufacturer, or otherwise, in this Work does not constitute an
62-
endorsement, recommendation, or favoring by the any Government and
63-
shall not be used for advertising or product endorsement purposes.

Makefile

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ GOGOPROTOBUF_VERSION ?= v1.3.1
77
COMMIT ?= "$(shell git describe --long --dirty --always --match "" || true)"
88
VERSION ?= "$(shell git describe --tags --abbrev=0 || true)"
99
LDFLAGS ?= -s -w -X github.com/fairdatasociety/fairOS-dfs.commit="$(COMMIT)" -X github.com/fairdatasociety/fairOS-dfs.version="$(VERSION)"
10+
DEST ?= "$(shell (go list ./... | grep -v wasm))"
1011

1112
.PHONY: all
12-
all: build lint vet test-race binary
13+
all: lint vet test-race binary
1314

1415
.PHONY: binary
1516
binary: export CGO_ENABLED=1
@@ -23,7 +24,7 @@ dist:
2324

2425
.PHONY: lint
2526
lint: linter
26-
$(GOLANGCI_LINT) run
27+
$(GOLANGCI_LINT) run --skip-dirs wasm
2728

2829
.PHONY: linter
2930
linter:
@@ -36,19 +37,15 @@ swagger:
3637

3738
.PHONY: vet
3839
vet:
39-
$(GO) vet ./...
40+
$(GO) vet "$(DEST)"
4041

4142
.PHONY: test-race
4243
test-race:
43-
$(GO) test -race -timeout 300000ms -v ./...
44+
$(GO) test -race -timeout 300000ms -v "$(DEST)"
4445

4546
.PHONY: test
4647
test:
47-
$(GO) test -v ./...
48-
49-
.PHONY: build
50-
build:
51-
$(GO) build ./...
48+
$(GO) test -v "$(DEST)"
5249

5350
.PHONY: githooks
5451
githooks:
@@ -62,7 +59,7 @@ protobuftools:
6259
.PHONY: protobuf
6360
protobuf: GOFLAGS=-mod=mod # use modules for protobuf file include option
6461
protobuf: protobuftools
65-
$(GO) generate -run protoc ./...
62+
$(GO) generate -run protoc "$(DEST)"
6663

6764
.PHONY: clean
6865
clean:
@@ -77,17 +74,36 @@ release:
7774
-v `pwd`:/go/src/github.com/fairDataSociety/fairOS-dfs \
7875
-v /var/run/docker.sock:/var/run/docker.sock \
7976
-w /go/src/github.com/fairDataSociety/fairOS-dfs \
80-
ghcr.io/goreleaser/goreleaser-cross:v1.19.0 release --rm-dist
77+
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 release --rm-dist
8178

8279
.PHONY: release-dry-run
8380
release-dry-run:
8481
docker run --rm --privileged \
8582
-v ~/go/pkg/mod:/go/pkg/mod \
83+
-v ~/go/bin:/go/bin \
8684
-v `pwd`:/go/src/github.com/fairDataSociety/fairOS-dfs \
8785
-v /var/run/docker.sock:/var/run/docker.sock \
8886
-w /go/src/github.com/fairDataSociety/fairOS-dfs \
89-
ghcr.io/goreleaser/goreleaser-cross:v1.19.0 release --rm-dist \
87+
ghcr.io/goreleaser/goreleaser-cross:v1.19.5 release --rm-dist \
9088
--skip-validate=true \
9189
--skip-publish
9290

91+
92+
BUILD_DIR := $(PWD)
93+
BIN_PATH := $(BUILD_DIR)/dist
94+
EXEC_NAME := fairos.wasm
95+
GZIP_EXEC_NAME := $(EXEC_NAME).gz
96+
97+
.PHONY: wasm
98+
wasm:
99+
@GOOS=js GOARCH=wasm $(GO) build -ldflags="-s -w" -o $(BIN_PATH)/$(EXEC_NAME)
100+
@gzip -9 -v -c $(BIN_PATH)/$(EXEC_NAME) > $(BIN_PATH)/$(GZIP_EXEC_NAME)
101+
102+
.PHONY: android
103+
android:
104+
$(GO) get golang.org/x/mobile/bind
105+
gomobile init
106+
gomobile bind -androidapi 21 -o fairos.aar -target=android -ldflags "$(LDFLAGS)" github.com/fairdatasociety/fairOS-dfs/gomobile
107+
$(GO) mod tidy
108+
93109
FORCE:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ It is a stateless thin layer which uses the building blocks provided by Swarm to
1919
- Creation of logical drives
2020
- User and Permission management
2121
- Charging and Payments
22-
- Mutable, Indexed data structures over immmutable file system
22+
- Mutable, Indexed data structures over immutable file system
2323

2424
dfs can be used for the following use cases
2525
1) Personal data store

cmd/common/request.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,41 @@ limitations under the License.
1616

1717
package common
1818

19+
// UserSignupRequest
1920
type UserSignupRequest struct {
2021
UserName string `json:"userName,omitempty"`
2122
Password string `json:"password,omitempty"`
2223
Mnemonic string `json:"mnemonic,omitempty"`
2324
}
2425

26+
// UserLoginRequest
2527
type UserLoginRequest struct {
2628
UserName string `json:"userName,omitempty"`
2729
Password string `json:"password,omitempty"`
2830
}
2931

32+
// PodRequest
3033
type PodRequest struct {
3134
PodName string `json:"podName,omitempty"`
3235
Password string `json:"password,omitempty"`
3336
Reference string `json:"reference,omitempty"`
3437
SharedPodName string `json:"sharedPodName,omitempty"`
3538
}
3639

40+
// PodShareRequest
3741
type PodShareRequest struct {
3842
PodName string `json:"podName,omitempty"`
3943
SharedPodName string `json:"sharedPodName,omitempty"`
4044
}
4145

46+
// PodReceiveRequest
4247
type PodReceiveRequest struct {
4348
PodName string `json:"podName,omitempty"`
4449
Reference string `json:"sharingRef,omitempty"`
4550
SharedPodName string `json:"sharedPodName,omitempty"`
4651
}
4752

53+
// FileSystemRequest
4854
type FileSystemRequest struct {
4955
PodName string `json:"podName,omitempty"`
5056
DirectoryPath string `json:"dirPath,omitempty"`
@@ -54,18 +60,21 @@ type FileSystemRequest struct {
5460
Destination string `json:"destUser,omitempty"`
5561
}
5662

63+
// RenameRequest
5764
type RenameRequest struct {
5865
PodName string `json:"podName,omitempty"`
5966
OldPath string `json:"oldPath,omitempty"`
6067
NewPath string `json:"newPath,omitempty"`
6168
}
6269

70+
// FileReceiveRequest
6371
type FileReceiveRequest struct {
6472
PodName string `json:"podName,omitempty"`
6573
SharingReference string `json:"sharingRef,omitempty"`
6674
DirectoryPath string `json:"dirPath,omitempty"`
6775
}
6876

77+
// KVRequest
6978
type KVRequest struct {
7079
PodName string `json:"podName,omitempty"`
7180
TableName string `json:"tableName,omitempty"`
@@ -78,6 +87,7 @@ type KVRequest struct {
7887
Memory string `json:"memory,omitempty"`
7988
}
8089

90+
// DocRequest
8191
type DocRequest struct {
8292
PodName string `json:"podName,omitempty"`
8393
TableName string `json:"tableName,omitempty"`

0 commit comments

Comments
 (0)