Improve string concat #147
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", "c_exports,size_opt,no_format,all_private"] | |
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 }} | |
use_cross: true | |
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", "c_exports,size_opt,no_format,all_private"] | |
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", "c_exports,size_opt,no_format", "c_exports,size_opt,no_format,all_private"] | |
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 }} |