From d624e7c5cb7db3926e245c63248cd1a448dfbb17 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 15 Oct 2025 08:10:37 +0200 Subject: [PATCH] Update version and try on CI --- .github/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 4 ++-- go.mod | 2 +- go.sum | 2 ++ main.go | 8 +++----- 5 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 .github/ci.yml diff --git a/.github/ci.yml b/.github/ci.yml new file mode 100644 index 0000000..68b16ff --- /dev/null +++ b/.github/ci.yml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index 4417e97..46ef0e9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ LIBS_DIR := $(abspath ./libs) # Flags for CGO to find the headers and the shared library 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 OS ?= "linux" @@ -24,7 +24,7 @@ fetch: @rm -f $(LIBS_DIR)/*.zip 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: ./example diff --git a/go.mod b/go.mod index d94fcc4..1406027 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module example 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 diff --git a/go.sum b/go.sum index d54ad0f..76ef08c 100644 --- a/go.sum +++ b/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.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.16 h1:rDjkcR9NdN6JKVAdnX7RSGkkc5l3/din4QMDRAUJZ7w= +github.com/codex-storage/codex-go-bindings v0.0.16/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= diff --git a/main.go b/main.go index 749c617..149fbe8 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,6 @@ import ( "bytes" "log" "os" - "os/signal" - "syscall" "github.com/codex-storage/codex-go-bindings/codex" ) @@ -54,9 +52,9 @@ func main() { log.Println("Downloaded data to hello.txt") // Wait for a SIGINT or SIGTERM signal - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) - <-ch + // ch := make(chan os.Signal, 1) + // signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) + // <-ch if err := node.Stop(); err != nil { log.Fatalf("Failed to stop Codex node: %v", err)