Skip to content

Commit 559f1fa

Browse files
authored
Merge pull request #2 from scala-network/v2.0
V2.0
2 parents f266c67 + 8a65884 commit 559f1fa

File tree

26 files changed

+2106
-371906
lines changed

26 files changed

+2106
-371906
lines changed

.github/workflows/build-cd.yml

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
tags:
55
- '*'
6-
76
jobs:
87
create-release:
98
name: Create release
@@ -26,7 +25,7 @@ jobs:
2625
body_path: CHANGELOG.md
2726
- id: step_upload_url
2827
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"
29-
28+
3029
build-and-publish:
3130
name: Publish release
3231
needs: create-release
@@ -40,55 +39,44 @@ jobs:
4039
- name: Install go
4140
uses: actions/setup-go@v2
4241
with:
43-
go-version: '1.13'
44-
- name: Install dependencies for linux build
45-
if: ${{ matrix.os == 'ubuntu-latest' }}
46-
run: |
47-
sudo apt update && sudo apt install -y build-essential zip
48-
- name: Install dependencies for windows build
49-
if: ${{ matrix.os == 'ubuntu-18.04' }}
42+
go-version: '1.16'
43+
44+
- name: Install dependencies for macOS build
45+
if: ${{ matrix.os == 'macos-latest' }}
5046
run: |
51-
sudo apt update && sudo apt install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64
52-
- name: Install go dependencies
47+
go mod download
48+
- name: Build and package artifacts for macOS build
49+
if: ${{ matrix.os == 'macos-latest' }}
5350
run: |
54-
go get github.com/sirupsen/logrus
55-
go get github.com/ipfs/go-ipfs-api
56-
go get github.com/mjibson/esc
57-
58-
- name: Build libipfs for linux
59-
if: ${{ matrix.os == 'ubuntu-latest' }}
60-
run: make build_linux
61-
62-
- name: Build libipfs for windows
63-
if: ${{ matrix.os == 'ubuntu-18.04' }}
64-
run: make build_windows
65-
66-
- name: Build libipfs for macOS
51+
make build_macos_x64
52+
mkdir libipfs${{ github.event.release.tag_name }}-macOS-x64/
53+
cp -rf ./bin/libipfs-mac* libipfs${{ github.event.release.tag_name }}-macOS-x64/
54+
zip -r libipfs${{ github.event.release.tag_name }}-macOS-x64.zip libipfs${{ github.event.release.tag_name }}-macOS-x64/
55+
- name: Upload macOS build artifacts
6756
if: ${{ matrix.os == 'macos-latest' }}
68-
run: make build_macos
57+
uses: actions/upload-release-asset@v1
58+
env:
59+
GITHUB_TOKEN: ${{ github.token }}
60+
with:
61+
upload_url: ${{ needs.create-release.outputs.upload_url }}
62+
asset_path: ./libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
63+
asset_name: libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
64+
asset_content_type: application/zip
6965

70-
- name: Pacakge artifacts linux
66+
- name: Install dependencies for linux build
67+
if: ${{ matrix.os == 'ubuntu-latest' }}
68+
run: |
69+
sudo apt update && sudo apt install -y build-essential zip
70+
go mod download
71+
72+
- name: Build and package artifacts for linux build
7173
if: ${{ matrix.os == 'ubuntu-latest' }}
7274
run: |
75+
make build_linux
7376
mkdir libipfs${{ github.event.release.tag_name }}-linux-x64/
7477
cp -rf ./bin/libipfs-linux* libipfs${{ github.event.release.tag_name }}-linux-x64/
7578
zip -r libipfs${{ github.event.release.tag_name }}-linux-x64.zip libipfs${{ github.event.release.tag_name }}-linux-x64/
76-
77-
- name: Pacakge artifacts windows
78-
if: ${{ matrix.os == 'ubuntu-18.04' }}
79-
run: |
80-
mkdir libipfs${{ github.event.release.tag_name }}-win-x64/
81-
cp -rf ./bin/libipfs-win* libipfs${{ github.event.release.tag_name }}-win-x64/
82-
zip -r libipfs${{ github.event.release.tag_name }}-win-x64.zip libipfs${{ github.event.release.tag_name }}-win-x64/
83-
84-
- name: Pacakge artifacts macOS
85-
if: ${{ matrix.os == 'macos-latest' }}
86-
run: |
87-
mkdir libipfs${{ github.event.release.tag_name }}-macOS-x64/
88-
cp -rf ./bin/libipfs-mac* libipfs${{ github.event.release.tag_name }}-macOS-x64/
89-
zip -r libipfs${{ github.event.release.tag_name }}-macOS-x64.zip libipfs${{ github.event.release.tag_name }}-macOS-x64/
90-
91-
- name: Upload aritifacts for linux
79+
- name: Upload linux build artifacts
9280
if: ${{ matrix.os == 'ubuntu-latest' }}
9381
uses: actions/upload-release-asset@v1
9482
env:
@@ -99,7 +87,21 @@ jobs:
9987
asset_name: libipfs${{ github.event.release.tag_name }}-linux-x64.zip
10088
asset_content_type: application/zip
10189

102-
- name: Upload aritifacts for windows
90+
- name: Install dependencies for windows build
91+
if: ${{ matrix.os == 'ubuntu-18.04' }}
92+
run: |
93+
sudo apt update && sudo apt install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64
94+
go mod download
95+
96+
- name: Build and package artifacts for windows build
97+
if: ${{ matrix.os == 'ubuntu-18.04' }}
98+
run: |
99+
make build_windows
100+
mkdir libipfs${{ github.event.release.tag_name }}-win-x64/
101+
cp -rf ./bin/libipfs-win* libipfs${{ github.event.release.tag_name }}-win-x64/
102+
zip -r libipfs${{ github.event.release.tag_name }}-win-x64.zip libipfs${{ github.event.release.tag_name }}-win-x64/
103+
104+
- name: Upload windows build artifacts
103105
if: ${{ matrix.os == 'ubuntu-18.04' }}
104106
uses: actions/upload-release-asset@v1
105107
env:
@@ -108,15 +110,4 @@ jobs:
108110
upload_url: ${{ needs.create-release.outputs.upload_url }}
109111
asset_path: ./libipfs${{ github.event.release.tag_name }}-win-x64.zip
110112
asset_name: libipfs${{ github.event.release.tag_name }}-win-x64.zip
111-
asset_content_type: application/zip
112-
113-
- name: Upload aritifacts for macOS
114-
if: ${{ matrix.os == 'macos-latest' }}
115-
uses: actions/upload-release-asset@v1
116-
env:
117-
GITHUB_TOKEN: ${{ github.token }}
118-
with:
119-
upload_url: ${{ needs.create-release.outputs.upload_url }}
120-
asset_path: ./libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
121-
asset_name: libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
122-
asset_content_type: application/zip
113+
asset_content_type: application/zip

.github/workflows/build-ci.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ jobs:
1515
run: sudo apt update && sudo apt install -y build-essential
1616
- name: Install go dependencies
1717
run: |
18-
go get github.com/sirupsen/logrus
19-
go get github.com/ipfs/go-ipfs-api
20-
go get github.com/mjibson/esc
18+
go mod download
2119
- name: Build libipfs
2220
run: make build_linux
2321

@@ -34,25 +32,21 @@ jobs:
3432
run: sudo apt update && sudo apt install -y build-essential gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64
3533
- name: Install go dependencies
3634
run: |
37-
go get github.com/sirupsen/logrus
38-
go get github.com/ipfs/go-ipfs-api
39-
go get github.com/mjibson/esc
35+
go mod download
4036
- name: Build libipfs
4137
run: make build_windows
4238

43-
build-macos:
39+
build-macos-x64:
4440
runs-on: macOS-latest
4541
steps:
4642
- name: Install Go
4743
uses: actions/setup-go@v2
4844
with:
49-
go-version: '1.13'
45+
go-version: '1.16'
5046
- name: Checkout code
5147
uses: actions/checkout@v2
5248
- name: Install go dependencies
5349
run: |
54-
go get github.com/sirupsen/logrus
55-
go get github.com/ipfs/go-ipfs-api
56-
go get github.com/mjibson/esc
50+
go mod download
5751
- name: Build libipfs
58-
run: make build_macos
52+
run: make build_macos_x64

.gitignore

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
# Binaries for programs and plugins
2-
*.dll
3-
*.so
4-
*.dylib
5-
6-
# Test binary, build with `go test -c`
7-
*.test
8-
9-
# Output of the go coverage tool, specifically when used with LiteIDE
10-
*.out
11-
/.project
12-
13-
# Build output
141
bin/
15-
16-
src/ipfs/pack.go
17-
18-
example/ipfs/
19-
example/libipfs-linux.a
20-
example/libipfs-linux.h
21-
example/usage
2+
example/.libipfs-repo/
3+
example/libipfs-*
4+
example/test-download.jpg
5+
.vscode/

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
Changelog
2-
[1.0.1] - 29-05-2021
3-
Features
4-
5-
Use go version 1.13
1+
Changelog
2+
[2.0.0] - 21-08-2021
3+
Features
4+
5+
* No longer embeds IPFS binary
6+
* Only single port exposed (11816 for P2P communication)
7+
* Faster to use and build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2018-2020, The Scala Network
3+
Copyright (c) 2018-2021, The Scala Network Project
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

Makefile

100644100755
Lines changed: 43 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,43 @@
1-
#
2-
# A simple Makefile to easily build, test and run the code
3-
#
4-
5-
.PHONY: default build fmt lint run run_race test clean vet docker_build docker_run docker_clean
6-
7-
APP_NAME := libipfs
8-
9-
default: build
10-
11-
# Embeds the ipfs binary for Linux
12-
package_linux:
13-
esc -pkg ipfs -o src/ipfs/pack.go pack/linux
14-
15-
# Embeds the ipfs binary for Windows
16-
package_windows:
17-
esc -pkg ipfs -o src/ipfs/pack.go pack/windows
18-
19-
# Embeds the ipfs binary for MacOS
20-
package_macos:
21-
esc -pkg ipfs -o src/ipfs/pack.go pack/darwin
22-
23-
# Builds as executable for testing
24-
build_test_linux:
25-
GOOS=linux \
26-
GOARCH=amd64 \
27-
go build -o ./bin/${APP_NAME}-linux-test ./src/*.go
28-
29-
build_linux: package_linux
30-
CGO_ENABLED=1 \
31-
GOOS=linux \
32-
GOARCH=amd64 \
33-
go build -buildmode=c-archive -o ./bin/libipfs-linux.a ./src/libipfs.go
34-
35-
build_windows: package_windows
36-
CGO_ENABLED=1 \
37-
GOOS=windows \
38-
GOARCH=amd64 \
39-
CC=x86_64-w64-mingw32-gcc \
40-
go build -buildmode=c-archive -o ./bin/libipfs-windows.a ./src/libipfs.go
41-
42-
build_macos: package_macos
43-
CGO_ENABLED=1 \
44-
GOOS=darwin \
45-
GOARCH=amd64 \
46-
go build -buildmode=c-archive -o ./bin/libipfs-macos.a ./src/libipfs.go
47-
48-
build: build_linux \
49-
build_windows \
50-
build_macos
51-
52-
run: build_test_linux
53-
LOG_FORMAT=Text \
54-
LOG_LEVEL=Debug \
55-
./bin/${APP_NAME}-linux-test
56-
57-
run_race:
58-
GOOS=linux \
59-
GOARCH=amd64 \
60-
go run -race ./src/*.go
61-
62-
clean:
63-
rm ./bin/*
1+
#
2+
# A simple Makefile to easily build, test and run the code
3+
#
4+
5+
.PHONY: default build fmt lint run run_race test clean vet docker_build docker_run docker_clean
6+
7+
LIB_NAME := libipfs
8+
9+
default: build
10+
11+
clean:
12+
rm -rf bin/ && mkdir bin/
13+
14+
build_linux:
15+
CGO_ENABLED=1 \
16+
GOOS=linux \
17+
GOARCH=amd64 \
18+
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-linux.a ./src/${LIB_NAME}.go
19+
20+
build_windows:
21+
CGO_ENABLED=1 \
22+
GOOS=windows \
23+
GOARCH=amd64 \
24+
CC=x86_64-w64-mingw32-gcc \
25+
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-windows.a ./src/${LIB_NAME}.go
26+
27+
build_macos_x64:
28+
CGO_ENABLED=1 \
29+
GOOS=darwin \
30+
GOARCH=amd64 \
31+
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-macos-x64.a ./src/${LIB_NAME}.go
32+
33+
build_macos_arm64:
34+
CGO_ENABLED=1 \
35+
GOOS=darwin \
36+
GOARCH=arm64 \
37+
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-macos-arm64.a ./src/${LIB_NAME}.go
38+
39+
build: clean \
40+
build_linux \
41+
build_windows \
42+
build_macos_x64 \
43+
build_macos_arm64

0 commit comments

Comments
 (0)