Skip to content

Commit 805a7e6

Browse files
committed
.github: ci for ts_ffi
Currently, this just builds the examples. The examples are updated to not be in subdirs per-executable, so that on non-Windows the executables can be named just the plain example name. Signed-off-by: Nathan Perry <nathan@tailscale.com> Change-Id: I46e2c71ec600adbf13a442247c1e5dcc6a6a6964
1 parent f8ab9f0 commit 805a7e6

5 files changed

Lines changed: 70 additions & 2 deletions

File tree

.github/workflows/c.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: c
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- v*
8+
pull_request:
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
# cache-busting key -- change it if the build changes in a way that invalidates old
16+
# cached state
17+
cache_key: init
18+
19+
jobs:
20+
build_test:
21+
name: build (rust ${{ matrix.rust_toolchain.label }}, ${{ matrix.target.runner }})
22+
runs-on: ${{ matrix.target.runner }}
23+
24+
strategy:
25+
matrix:
26+
rust_toolchain:
27+
- version: 1.94.0
28+
label: latest
29+
30+
target:
31+
- triple: x86_64-unknown-linux-gnu
32+
runner: linux-x86_64-16cpu
33+
- triple: aarch64-unknown-linux-gnu
34+
runner: linux-arm64-16cpu
35+
# macos uses clang, not working yet
36+
# - triple: aarch64-apple-darwin
37+
# runner: macos-26
38+
39+
defaults:
40+
run:
41+
working-directory: ts_ffi
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46+
47+
- name: Cache Rust
48+
id: cache-rust-c
49+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
50+
with:
51+
path: |
52+
~/.cargo/bin/
53+
~/.cargo/registry/index/
54+
~/.cargo/registry/cache/
55+
~/.cargo/git/db/
56+
~/.rustup/toolchains
57+
target/
58+
key: ${{ matrix.target.triple }}-rs-c-${{ env.cache_key }}-${{ matrix.rust_toolchain.version }}-${{ hashFiles('**/Cargo.lock') }}
59+
60+
- name: Install Rust toolchain
61+
id: install-toolchain
62+
if: steps.cache-rust-c.outputs.cache-hit != 'true'
63+
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master 4/22/2026
64+
with:
65+
toolchain: ${{ matrix.rust_toolchain.version }}
66+
67+
- name: Build examples
68+
run: make -C examples

ts_ffi/examples/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ all: $(TARGETS)
4444
clean:
4545
rm -f $(TARGETS)
4646

47-
$(TARGETS): %$(TARGET_SUFFIX): libtailscalers $(wildcard %/*.c)
48-
$(CC) -o $@ $(wildcard $*/*.c) $(CFLAGS)
47+
$(TARGETS): %$(TARGET_SUFFIX): %.c libtailscalers
48+
$(CC) -o $@ $< $(CFLAGS)
4949

5050
libtailscalers:
5151
cargo build -p ts_ffi --profile $(RUST_PROFILE) $(RUST_TARGET_FLAG)

0 commit comments

Comments
 (0)