-
Notifications
You must be signed in to change notification settings - Fork 32
103 lines (92 loc) · 3.59 KB
/
c_cpp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: C/C++
on:
push:
branches: [main]
tags: ["**"]
pull_request: {}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make lint
working-directory: cpp
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
target: aarch64-unknown-linux-gnu
staticlib_name: libfoxglove.a
cdylib_name: libfoxglove.so
staticlib_artifact_name: libfoxglove-aarch64-unknown-linux-gnu.a
cdylib_artifact_name: libfoxglove-aarch64-unknown-linux-gnu.so
cross: true
- runner: ubuntu-24.04
target: x86_64-unknown-linux-gnu
staticlib_name: libfoxglove.a
cdylib_name: libfoxglove.so
staticlib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.a
cdylib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.so
cross: false
- runner: macos-15
target: aarch64-apple-darwin
staticlib_name: libfoxglove.a
cdylib_name: libfoxglove.dylib
staticlib_artifact_name: libfoxglove-aarch64-apple-darwin.a
cdylib_artifact_name: libfoxglove-aarch64-apple-darwin.dylib
cross: false
- runner: macos-15
target: x86_64-apple-darwin
staticlib_name: libfoxglove.a
cdylib_name: libfoxglove.dylib
staticlib_artifact_name: libfoxglove-x86_64-apple-darwin.a
cdylib_artifact_name: libfoxglove-x86_64-apple-darwin.dylib
cross: true
- runner: windows-2025
target: x86_64-pc-windows-msvc
staticlib_name: foxglove.lib
cdylib_name: foxglove.dll
staticlib_artifact_name: foxglove-x86_64-pc-windows-msvc.lib
cdylib_artifact_name: foxglove-x86_64-pc-windows-msvc.dll
cross: false
- runner: windows-2025
target: aarch64-pc-windows-msvc
staticlib_name: foxglove.lib
cdylib_name: foxglove.dll
staticlib_artifact_name: foxglove-aarch64-pc-windows-msvc.lib
cdylib_artifact_name: foxglove-aarch64-pc-windows-msvc.dll
cross: true
name: build (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
- run: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
if: matrix.target == 'aarch64-unknown-linux-gnu'
- name: Build C library for ${{ matrix.target }}
run: cargo build --release
working-directory: c
- name: Ensure generated files are up to date
run: git diff --exit-code
- name: Build C++ library and run tests
if: ${{ !fromJson(matrix.cross) }}
run: make test
working-directory: cpp
- name: Upload static library to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.staticlib_artifact_name }}
path: target/${{ matrix.target }}/release/${{ matrix.staticlib_name }}
- name: Upload shared library to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.cdylib_artifact_name }}
path: target/${{ matrix.target }}/release/${{ matrix.cdylib_name }}