-
-
Notifications
You must be signed in to change notification settings - Fork 12
161 lines (143 loc) · 4.85 KB
/
rust.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
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
name: Rust Build, Test & Publish
on:
push:
branches: [ main, master, optimize-for-size ]
tags:
- '*'
pull_request:
branches: [ main, master, optimize-for-size ]
workflow_dispatch:
jobs:
test-native:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: test-rust
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/test-and-coverage@v1 # upgrade if needed
with:
rust_project_path: src-rust
upload_coverage: true
rust_branch: nightly
test-wine:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: test-rust
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/test-in-wine@v1 # upgrade if needed
with:
rust_project_path: src-rust
rust_branch: nightly
build-c-libs-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
target: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, aarch64-unknown-linux-gnu]
features: ["c_exports", "c_exports,size_opt", "c_exports,size_opt,no_format"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
features: ${{ matrix.features }}
build-c-libs-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
target: [x86_64-apple-darwin, aarch64-apple-darwin]
features: ["c_exports", "c_exports,size_opt", "c_exports,size_opt,no_format"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
features: ${{ matrix.features }}
build-c-libs-windows:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc]
features: ["c_exports,external_processes", "c_exports,size_opt,external_processes", "c_exports,size_opt,no_format,external_processes"]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
features: ${{ matrix.features }}
build-c-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Generate C++ bindings
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1
with:
rust_project_path: src-rust
config_file: cbindgen_cpp.toml
header_file: bindings_cpp.hpp
- name: Generate C bindings
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1
with:
rust_project_path: src-rust
config_file: cbindgen_c.toml
header_file: bindings_c.h
publish-artifacts:
needs: ["build-c-headers", "build-c-libs-windows", "build-c-libs-linux", "build-c-libs-macos", "test-wine", "test-native"]
# Publish only on tags
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: ↙️ Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Compress Artifacts
shell: bash
run: |
dir="artifacts" # Replace with your subdirectory
for subdir in "$dir"/*; do
if [ -d "$subdir" ]; then
base=$(basename "$subdir")
zip -r "$dir/$base.zip" "$subdir"
rm -r "$subdir"
fi
done
ls -A ./artifacts
- name: GitHub Release Artifacts
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*
- name: Publish to crates.io
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/publish-crate@v1
with:
rust_project_path: src-rust
token: ${{ secrets.CRATES_IO_TOKEN }}