Update version and try on CI

This commit is contained in:
Arnaud 2025-10-15 08:10:37 +02:00
parent 9f7048fe7c
commit d624e7c5cb
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F
5 changed files with 60 additions and 8 deletions

52
.github/ci.yml vendored Normal file
View 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

View File

@ -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

2
go.mod
View File

@ -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

2
go.sum
View File

@ -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=

View File

@ -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)