Skip to content

V2.0 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 46 additions & 55 deletions .github/workflows/build-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
tags:
- '*'

jobs:
create-release:
name: Create release
Expand All @@ -26,7 +25,7 @@ jobs:
body_path: CHANGELOG.md
- id: step_upload_url
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"

build-and-publish:
name: Publish release
needs: create-release
Expand All @@ -40,55 +39,44 @@ jobs:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.13'
- name: Install dependencies for linux build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update && sudo apt install -y build-essential zip
- name: Install dependencies for windows build
if: ${{ matrix.os == 'ubuntu-18.04' }}
go-version: '1.16'

- name: Install dependencies for macOS build
if: ${{ matrix.os == 'macos-latest' }}
run: |
sudo apt update && sudo apt install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64
- name: Install go dependencies
go mod download
- name: Build and package artifacts for macOS build
if: ${{ matrix.os == 'macos-latest' }}
run: |
go get github.com/sirupsen/logrus
go get github.com/ipfs/go-ipfs-api
go get github.com/mjibson/esc

- name: Build libipfs for linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: make build_linux

- name: Build libipfs for windows
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: make build_windows

- name: Build libipfs for macOS
make build_macos_x64
mkdir libipfs${{ github.event.release.tag_name }}-macOS-x64/
cp -rf ./bin/libipfs-mac* libipfs${{ github.event.release.tag_name }}-macOS-x64/
zip -r libipfs${{ github.event.release.tag_name }}-macOS-x64.zip libipfs${{ github.event.release.tag_name }}-macOS-x64/
- name: Upload macOS build artifacts
if: ${{ matrix.os == 'macos-latest' }}
run: make build_macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
asset_name: libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
asset_content_type: application/zip

- name: Pacakge artifacts linux
- name: Install dependencies for linux build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update && sudo apt install -y build-essential zip
go mod download

- name: Build and package artifacts for linux build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
make build_linux
mkdir libipfs${{ github.event.release.tag_name }}-linux-x64/
cp -rf ./bin/libipfs-linux* libipfs${{ github.event.release.tag_name }}-linux-x64/
zip -r libipfs${{ github.event.release.tag_name }}-linux-x64.zip libipfs${{ github.event.release.tag_name }}-linux-x64/

- name: Pacakge artifacts windows
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: |
mkdir libipfs${{ github.event.release.tag_name }}-win-x64/
cp -rf ./bin/libipfs-win* libipfs${{ github.event.release.tag_name }}-win-x64/
zip -r libipfs${{ github.event.release.tag_name }}-win-x64.zip libipfs${{ github.event.release.tag_name }}-win-x64/

- name: Pacakge artifacts macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
mkdir libipfs${{ github.event.release.tag_name }}-macOS-x64/
cp -rf ./bin/libipfs-mac* libipfs${{ github.event.release.tag_name }}-macOS-x64/
zip -r libipfs${{ github.event.release.tag_name }}-macOS-x64.zip libipfs${{ github.event.release.tag_name }}-macOS-x64/

- name: Upload aritifacts for linux
- name: Upload linux build artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-release-asset@v1
env:
Expand All @@ -99,7 +87,21 @@ jobs:
asset_name: libipfs${{ github.event.release.tag_name }}-linux-x64.zip
asset_content_type: application/zip

- name: Upload aritifacts for windows
- name: Install dependencies for windows build
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: |
sudo apt update && sudo apt install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wine64
go mod download

- name: Build and package artifacts for windows build
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: |
make build_windows
mkdir libipfs${{ github.event.release.tag_name }}-win-x64/
cp -rf ./bin/libipfs-win* libipfs${{ github.event.release.tag_name }}-win-x64/
zip -r libipfs${{ github.event.release.tag_name }}-win-x64.zip libipfs${{ github.event.release.tag_name }}-win-x64/

- name: Upload windows build artifacts
if: ${{ matrix.os == 'ubuntu-18.04' }}
uses: actions/upload-release-asset@v1
env:
Expand All @@ -108,15 +110,4 @@ jobs:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./libipfs${{ github.event.release.tag_name }}-win-x64.zip
asset_name: libipfs${{ github.event.release.tag_name }}-win-x64.zip
asset_content_type: application/zip

- name: Upload aritifacts for macOS
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
asset_name: libipfs${{ github.event.release.tag_name }}-macOS-x64.zip
asset_content_type: application/zip
asset_content_type: application/zip
18 changes: 6 additions & 12 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ jobs:
run: sudo apt update && sudo apt install -y build-essential
- name: Install go dependencies
run: |
go get github.com/sirupsen/logrus
go get github.com/ipfs/go-ipfs-api
go get github.com/mjibson/esc
go mod download
- name: Build libipfs
run: make build_linux

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

build-macos:
build-macos-x64:
runs-on: macOS-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.13'
go-version: '1.16'
- name: Checkout code
uses: actions/checkout@v2
- name: Install go dependencies
run: |
go get github.com/sirupsen/logrus
go get github.com/ipfs/go-ipfs-api
go get github.com/mjibson/esc
go mod download
- name: Build libipfs
run: make build_macos
run: make build_macos_x64
24 changes: 4 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
# Binaries for programs and plugins
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/.project

# Build output
bin/

src/ipfs/pack.go

example/ipfs/
example/libipfs-linux.a
example/libipfs-linux.h
example/usage
example/.libipfs-repo/
example/libipfs-*
example/test-download.jpg
.vscode/
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Changelog
[1.0.1] - 29-05-2021
Features

Use go version 1.13
Changelog
[2.0.0] - 21-08-2021
Features

* No longer embeds IPFS binary
* Only single port exposed (11816 for P2P communication)
* Faster to use and build
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

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

Redistribution and use in source and binary forms, with or without
Expand Down
106 changes: 43 additions & 63 deletions Makefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,63 +1,43 @@
#
# A simple Makefile to easily build, test and run the code
#

.PHONY: default build fmt lint run run_race test clean vet docker_build docker_run docker_clean

APP_NAME := libipfs

default: build

# Embeds the ipfs binary for Linux
package_linux:
esc -pkg ipfs -o src/ipfs/pack.go pack/linux

# Embeds the ipfs binary for Windows
package_windows:
esc -pkg ipfs -o src/ipfs/pack.go pack/windows

# Embeds the ipfs binary for MacOS
package_macos:
esc -pkg ipfs -o src/ipfs/pack.go pack/darwin

# Builds as executable for testing
build_test_linux:
GOOS=linux \
GOARCH=amd64 \
go build -o ./bin/${APP_NAME}-linux-test ./src/*.go

build_linux: package_linux
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
go build -buildmode=c-archive -o ./bin/libipfs-linux.a ./src/libipfs.go

build_windows: package_windows
CGO_ENABLED=1 \
GOOS=windows \
GOARCH=amd64 \
CC=x86_64-w64-mingw32-gcc \
go build -buildmode=c-archive -o ./bin/libipfs-windows.a ./src/libipfs.go

build_macos: package_macos
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=amd64 \
go build -buildmode=c-archive -o ./bin/libipfs-macos.a ./src/libipfs.go

build: build_linux \
build_windows \
build_macos

run: build_test_linux
LOG_FORMAT=Text \
LOG_LEVEL=Debug \
./bin/${APP_NAME}-linux-test

run_race:
GOOS=linux \
GOARCH=amd64 \
go run -race ./src/*.go

clean:
rm ./bin/*
#
# A simple Makefile to easily build, test and run the code
#

.PHONY: default build fmt lint run run_race test clean vet docker_build docker_run docker_clean

LIB_NAME := libipfs

default: build

clean:
rm -rf bin/ && mkdir bin/

build_linux:
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-linux.a ./src/${LIB_NAME}.go

build_windows:
CGO_ENABLED=1 \
GOOS=windows \
GOARCH=amd64 \
CC=x86_64-w64-mingw32-gcc \
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-windows.a ./src/${LIB_NAME}.go

build_macos_x64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=amd64 \
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-macos-x64.a ./src/${LIB_NAME}.go

build_macos_arm64:
CGO_ENABLED=1 \
GOOS=darwin \
GOARCH=arm64 \
go build -buildmode=c-archive -o ./bin/${LIB_NAME}-macos-arm64.a ./src/${LIB_NAME}.go

build: clean \
build_linux \
build_windows \
build_macos_x64 \
build_macos_arm64
Loading