-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (128 loc) · 4.25 KB
/
ci.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
cargo_checks:
name: Cargo checks
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run cargo check
run: cargo check --all --all-targets --workspace
- name: Run cargo fmt check
run: cargo fmt --all -- --check
build_server:
name: Build server
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
targets:
# Developer/GNU targets
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
# Musl targets
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabi
- i686-unknown-linux-musl
# - mips-unknown-linux-musl # Broken
- x86_64-unknown-linux-musl
# Windows targets
- i686-pc-windows-gnu
- x86_64-pc-windows-gnu
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cross build -p bh_agent_server --release --target ${{ matrix.targets }}
- name: Prepare artifact
run: |
mkdir -p dist
if [[ "${{ matrix.targets }}" == *"windows"* ]]; then
cp target/${{ matrix.targets }}/release/bh_agent_server.exe dist/bh_agent_server-${{ matrix.targets }}.exe
else
cp target/${{ matrix.targets }}/release/bh_agent_server dist/bh_agent_server-${{ matrix.targets }}
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bh_agent_server-${{ matrix.targets }}
path: dist/bh_agent_server-${{ matrix.targets }}*
build_server_macos:
name: Build server (macOS)
runs-on: macos-14
strategy:
fail-fast: false
matrix:
targets:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install target
run: rustup target add ${{ matrix.targets }}
- name: Build
run: cargo build -p bh_agent_server --release --target ${{ matrix.targets }}
- name: Prepare artifact
run: mkdir dist && cp target/${{ matrix.targets }}/release/bh_agent_server dist/bh_agent_server-${{ matrix.targets }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bh_agent_server-${{ matrix.targets }}
path: dist/bh_agent_server-${{ matrix.targets }}
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-14]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v1
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --release
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
test_python:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
name: Tests on Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install host binaries
run: sudo apt-get update && sudo apt-get install -y busybox-static qemu-user-static
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build bh_agent_server for host platform
run: cargo build -p bh_agent_server
- name: Build bh_agent_server x86_64-unknown-linux-musl
run: cross build --target x86_64-unknown-linux-musl -p bh_agent_server
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install binharness
run: pip install -e .[dev]
- name: Run pytest
run: pytest