Skip to content
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
1 change: 0 additions & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# actionlint configuration
# https://github.com/rhysd/actionlint/blob/main/docs/config.md

self-hosted-runner:
labels:
# GitHub-hosted larger runners (not in actionlint's default list)
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
name: ci

on:
push:
branches: ["main"]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Install cargo-deny
run: cargo install cargo-deny@0.18.3 --locked

- name: Install cbindgen
run: cargo install cbindgen --locked

- name: Quality gates
run: make check

- name: Verify generated C header is up to date
run: |
make cbindgen
git diff --exit-code ffi/docprims-ffi/docprims.h
diff -u ffi/docprims-ffi/docprims.h bindings/go/docprims/include/docprims.h

test-go-vendored:
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Run Go tests (vendored libs)
run: |
cd bindings/go/docprims
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/go-bindings-prep.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: Go Bindings (Prep)

# NOTE: Windows arm64 is NOT supported for Go bindings.
# Go's CGo on Windows requires MinGW, and MinGW does not support the arm64 target.

on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. 0.1.0)"
required: true
type: string

env:
CARGO_TERM_COLOR: always

jobs:
validate:
name: Validate Inputs
Expand All @@ -22,7 +18,6 @@ jobs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4

- name: Validate version matches VERSION file
id: version
run: |
Expand All @@ -35,7 +30,6 @@ jobs:
exit 1
fi
echo "version=$FILE_VERSION" >> "$GITHUB_OUTPUT"

build-linux:
name: Build FFI (Linux)
runs-on: ubuntu-latest
Expand All @@ -60,7 +54,6 @@ jobs:
artifact_suffix: linux-arm64-musl
steps:
- uses: actions/checkout@v4

- name: Verify cargo-zigbuild is available
shell: bash
run: |
Expand All @@ -71,7 +64,6 @@ jobs:
exit 1
fi
cargo-zigbuild --version

- name: Build FFI
shell: bash
run: |
Expand All @@ -81,7 +73,6 @@ jobs:
else
cargo zigbuild --release --target ${{ matrix.target }} -p docprims-ffi
fi

- name: Package FFI
shell: bash
run: |
Expand Down Expand Up @@ -113,13 +104,11 @@ jobs:
TARGET_DIR="$(resolve_target libdocprims_ffi.so)"
cp "target/${TARGET_DIR}/release/libdocprims_ffi.so" "dist/ffi/${{ matrix.artifact_suffix }}/"
fi

- name: Upload FFI artifact
uses: actions/upload-artifact@v4
with:
name: ffi-${{ matrix.artifact_suffix }}
path: dist/ffi/${{ matrix.artifact_suffix }}

build-macos:
name: Build FFI (macOS)
runs-on: macos-14
Expand All @@ -128,16 +117,13 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: "11.0"
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin

- name: Build FFI (arm64)
run: |
set -euo pipefail
cargo build --release --target aarch64-apple-darwin -p docprims-ffi

- name: Package FFI
run: |
set -euo pipefail
Expand All @@ -148,38 +134,32 @@ jobs:
# Fix dylib install_name to use @rpath instead of hardcoded CI build path.
# This allows consumers to set rpath or place dylib alongside executable.
install_name_tool -id "@rpath/libdocprims_ffi.dylib" dist/ffi/darwin-arm64/libdocprims_ffi.dylib

- name: Upload FFI artifact (darwin-arm64)
uses: actions/upload-artifact@v4
with:
name: ffi-darwin-arm64
path: dist/ffi/darwin-arm64

build-windows:
name: Build FFI (Windows GNU)
runs-on: windows-latest
needs: validate
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu

- name: Install MinGW
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc
path-type: inherit

- name: Build FFI (GNU target)
shell: msys2 {0}
run: |
set -euo pipefail
cargo build --release --target x86_64-pc-windows-gnu -p docprims-ffi

- name: Package FFI
shell: bash
run: |
Expand All @@ -188,13 +168,11 @@ jobs:
cp target/x86_64-pc-windows-gnu/release/libdocprims_ffi.a dist/ffi/windows-amd64/
cp target/x86_64-pc-windows-gnu/release/docprims_ffi.dll dist/ffi/windows-amd64/
cp target/x86_64-pc-windows-gnu/release/libdocprims_ffi.dll.a dist/ffi/windows-amd64/

- name: Upload FFI artifact
uses: actions/upload-artifact@v4
with:
name: ffi-windows-amd64
path: dist/ffi/windows-amd64

cbindgen:
name: Generate C Header
runs-on: ubuntu-latest
Expand All @@ -204,19 +182,16 @@ jobs:
needs: validate
steps:
- uses: actions/checkout@v4

- name: Generate C header
shell: bash
run: |
set -euo pipefail
cbindgen --config cbindgen.toml --crate docprims-ffi --output docprims.h

- name: Upload header
uses: actions/upload-artifact@v4
with:
name: c-header
path: docprims.h

update-go-bindings:
name: Create Go Bindings PR
runs-on: ubuntu-latest
Expand All @@ -228,19 +203,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download all FFI artifacts
uses: actions/download-artifact@v4.1.3
with:
pattern: ffi-*
path: ffi-libs

- name: Download C header
uses: actions/download-artifact@v4.1.3
with:
name: c-header
path: ffi-libs

- name: Update Go bindings directory
run: |
set -euo pipefail
Expand Down Expand Up @@ -285,7 +257,6 @@ jobs:

echo "Go bindings updated for $VERSION"
ls -la bindings/go/docprims/lib/*/ || true

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/go-bindings.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,66 @@
name: go-bindings

on:
pull_request:
workflow_dispatch:

jobs:
go-test-linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Install cbindgen
run: cargo install cbindgen --locked

- name: Build FFI and run Go tests (glibc)
run: |
make go-test
make go-test-shared

go-test-darwin-arm64-vendored:
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Run Go tests (vendored darwin-arm64)
run: |
cd bindings/go/docprims
go test -v ./...

go-test-darwin-arm64-shared:
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Install cbindgen
run: cargo install cbindgen --locked

- name: Build FFI and run Go tests (shared)
run: make go-test-shared

go-test-linux-amd64-musl:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo install cbindgen --locked

- name: Build musl static lib and run Go tests
run: |
make cbindgen
Expand Down
Loading
Loading