-
-
Notifications
You must be signed in to change notification settings - Fork 12
138 lines (119 loc) · 3.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
name: Rust Build, Test & Publish
on:
push:
branches: [ main, master, crab, support-android-and-bsd ]
tags:
- '*'
pull_request:
branches: [ main, master, crab, support-android-and-bsd ]
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:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: i686-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1 # upgrade if needed
with:
rust_project_path: src-rust
target: ${{ matrix.target }}
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", "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 }}