mirror of
https://github.com/logos-storage/logos-storage-go-bindings-example.git
synced 2026-01-07 16:03:11 +00:00
Update version and try on CI
This commit is contained in:
parent
9f7048fe7c
commit
d624e7c5cb
52
.github/ci.yml
vendored
Normal file
52
.github/ci.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
name: Artifacts
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.target.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
name: linux
|
||||||
|
cpu: amd64
|
||||||
|
lib_ext: so
|
||||||
|
|
||||||
|
- os: ubuntu-24.04-arm
|
||||||
|
cpu: arm64
|
||||||
|
name: linux
|
||||||
|
lib_ext: so
|
||||||
|
|
||||||
|
- os: macos-latest
|
||||||
|
lib_ext: so
|
||||||
|
name: macos
|
||||||
|
cpu: arm64
|
||||||
|
|
||||||
|
- os: windows-latest
|
||||||
|
cpu: amd64
|
||||||
|
name: windows
|
||||||
|
lib_ext: dll
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Fetch artifacts
|
||||||
|
run: |
|
||||||
|
OS="${{ matrix.target.name }}" ARCH="${{ matrix.target.cpu }}" make fetch
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make build
|
||||||
|
|
||||||
|
- name: Run
|
||||||
|
run: make run
|
||||||
4
Makefile
4
Makefile
@ -3,7 +3,7 @@ LIBS_DIR := $(abspath ./libs)
|
|||||||
|
|
||||||
# Flags for CGO to find the headers and the shared library
|
# Flags for CGO to find the headers and the shared library
|
||||||
CGO_CFLAGS := -I$(LIBS_DIR)
|
CGO_CFLAGS := -I$(LIBS_DIR)
|
||||||
CGO_LDFLAGS := -L$(LIBS_DIR) -Wl,-rpath,$(LIBS_DIR)
|
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
|
||||||
|
|
||||||
# Configuration for fetching the right binary
|
# Configuration for fetching the right binary
|
||||||
OS ?= "linux"
|
OS ?= "linux"
|
||||||
@ -24,7 +24,7 @@ fetch:
|
|||||||
@rm -f $(LIBS_DIR)/*.zip
|
@rm -f $(LIBS_DIR)/*.zip
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o $(BIN) main.go
|
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o $(BIN) main.go
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./example
|
./example
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -2,4 +2,4 @@ module example
|
|||||||
|
|
||||||
go 1.25.1
|
go 1.25.1
|
||||||
|
|
||||||
require github.com/codex-storage/codex-go-bindings v0.0.15
|
require github.com/codex-storage/codex-go-bindings v0.0.16
|
||||||
|
|||||||
2
go.sum
2
go.sum
@ -10,3 +10,5 @@ github.com/codex-storage/codex-go-bindings v0.0.14 h1:Pk/DDEGW3OGTefEyoBHvw2RUgp
|
|||||||
github.com/codex-storage/codex-go-bindings v0.0.14/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg=
|
github.com/codex-storage/codex-go-bindings v0.0.14/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg=
|
||||||
github.com/codex-storage/codex-go-bindings v0.0.15 h1:7usvjbqm5BjRICk7uLu1C+fU69cSLvefcH7rdCy9MTg=
|
github.com/codex-storage/codex-go-bindings v0.0.15 h1:7usvjbqm5BjRICk7uLu1C+fU69cSLvefcH7rdCy9MTg=
|
||||||
github.com/codex-storage/codex-go-bindings v0.0.15/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg=
|
github.com/codex-storage/codex-go-bindings v0.0.15/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg=
|
||||||
|
github.com/codex-storage/codex-go-bindings v0.0.16 h1:rDjkcR9NdN6JKVAdnX7RSGkkc5l3/din4QMDRAUJZ7w=
|
||||||
|
github.com/codex-storage/codex-go-bindings v0.0.16/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg=
|
||||||
|
|||||||
8
main.go
8
main.go
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/codex-storage/codex-go-bindings/codex"
|
"github.com/codex-storage/codex-go-bindings/codex"
|
||||||
)
|
)
|
||||||
@ -54,9 +52,9 @@ func main() {
|
|||||||
log.Println("Downloaded data to hello.txt")
|
log.Println("Downloaded data to hello.txt")
|
||||||
|
|
||||||
// Wait for a SIGINT or SIGTERM signal
|
// Wait for a SIGINT or SIGTERM signal
|
||||||
ch := make(chan os.Signal, 1)
|
// ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
|
// signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-ch
|
// <-ch
|
||||||
|
|
||||||
if err := node.Stop(); err != nil {
|
if err := node.Stop(); err != nil {
|
||||||
log.Fatalf("Failed to stop Codex node: %v", err)
|
log.Fatalf("Failed to stop Codex node: %v", err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user