-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (143 loc) · 5.72 KB
/
release.yml
File metadata and controls
166 lines (143 loc) · 5.72 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI & Release
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
platform: linux-x86_64
archive_ext: tar.gz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
platform: linux-aarch64
archive_ext: tar.gz
- os: macos-14
target: aarch64-apple-darwin
platform: macos-arm64
archive_ext: tar.gz
- os: windows-2025
target: x86_64-pc-windows-msvc
platform: windows-x86_64
archive_ext: zip
runs-on: ${{ matrix.os }}
# Must match OpenMS's MACOSX_DEPLOYMENT_TARGET (see pyOpenMS pyproject.toml
# and openms_ci_matrix_full.yml) to avoid deployment target mismatch warnings
# when linking the static library into OpenMS/pyOpenMS.
env:
MACOSX_DEPLOYMENT_TARGET: ${{ startsWith(matrix.os, 'macos') && '14.0' || '' }}
steps:
# actions/checkout v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Rust toolchain
# dtolnay/rust-toolchain stable branch
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7
with:
toolchain: stable
- name: Cache Cargo
# Swatinem/rust-cache v2.8.2
uses: Swatinem/rust-cache@401aff9a7a08acb9d27b64936a90db81024cff97
- name: Run tests
run: cargo test --features with_timsrust
- name: Build release
run: cargo build --features with_timsrust --release
- name: Smoke test (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
g++ -std=c++17 examples/cpp_client.cpp \
-Iinclude \
target/release/libtimsrust_cpp_bridge.a \
-lpthread -ldl -lm \
-o target/smoke_test
# Run with no args — expect exit code 1 (usage), fail only on signal/crash
target/smoke_test || if [ $? -gt 128 ]; then exit 1; fi
- name: Smoke test (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
clang++ -std=c++17 examples/cpp_client.cpp \
-Iinclude \
target/release/libtimsrust_cpp_bridge.a \
-framework Security -framework SystemConfiguration -framework CoreFoundation \
-lresolv -lpthread \
-o target/smoke_test
# Run with no args — expect exit code 1 (usage), fail only on signal/crash
target/smoke_test || if [ $? -gt 128 ]; then exit 1; fi
- name: Setup MSVC dev environment
if: runner.os == 'Windows'
# ilammy/msvc-dev-cmd v1.13.0
uses: ilammy/msvc-dev-cmd@a102174a2b586eec2ea151a69e6fd14404a8ce7c
- name: Smoke test (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
cl.exe /std:c++17 /EHsc /MD /Fe:target\smoke_test.exe /I include examples\cpp_client.cpp target\release\timsrust_cpp_bridge.lib ws2_32.lib userenv.lib bcrypt.lib ntdll.lib advapi32.lib
target\smoke_test.exe
if %errorlevel% GEQ 2 exit /b %errorlevel%
exit /b 0
- name: Set version
id: version
shell: bash
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
else
echo "version=0.0.0-dev" >> "$GITHUB_OUTPUT"
fi
- name: Package
shell: bash
run: bash scripts/package.sh "${{ steps.version.outputs.version }}" "${{ matrix.target }}"
- name: Validate CMake package
shell: bash
run: |
ARCHIVE_DIR="target/package/timsrust_cpp_bridge-v${{ steps.version.outputs.version }}-${{ matrix.platform }}/timsrust_cpp_bridge"
mkdir -p /tmp/timsrust_cmake_test
cat > /tmp/timsrust_cmake_test/CMakeLists.txt << 'CMAKEOF'
cmake_minimum_required(VERSION 3.11)
project(test_consumer CXX)
set(CMAKE_CXX_STANDARD 17)
find_package(timsrust_cpp_bridge REQUIRED)
add_executable(test_consumer test.cpp)
target_link_libraries(test_consumer timsrust_cpp_bridge::timsrust_cpp_bridge)
CMAKEOF
cat > /tmp/timsrust_cmake_test/test.cpp << 'CPPEOF'
#include "timsrust_cpp_bridge.h"
int main() { return 0; }
CPPEOF
cmake -S /tmp/timsrust_cmake_test -B /tmp/timsrust_cmake_test/build \
-DCMAKE_PREFIX_PATH="$(pwd)/${ARCHIVE_DIR}"
cmake --build /tmp/timsrust_cmake_test/build
rm -rf /tmp/timsrust_cmake_test
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/v')
# actions/upload-artifact v7.0.0
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: timsrust_cpp_bridge-v${{ steps.version.outputs.version }}-${{ matrix.platform }}
path: target/package/timsrust_cpp_bridge-v${{ steps.version.outputs.version }}-${{ matrix.platform }}.${{ matrix.archive_ext }}
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
# actions/download-artifact v8.0.1
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
path: artifacts/
- name: Create GitHub Release
# softprops/action-gh-release v2.5.0
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
with:
files: artifacts/**/*
generate_release_notes: true