Skip to content

Commit e23bbf7

Browse files
committed
Add workflow
1 parent 7309db4 commit e23bbf7

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Crate 📦 Distribution
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
paths-ignore:
10+
- ".gitignore"
11+
- "docs/**"
12+
- "README"
13+
- "CREDITS.TXT"
14+
- "COPYING_GLIB"
15+
- "COPYING.LGPL2"
16+
- "AUTHORS.TXT"
17+
- "CHANGELOG"
18+
- "COPYING"
19+
pull_request:
20+
21+
env:
22+
UNICORN_VERSION: dev
23+
24+
jobs:
25+
build:
26+
runs-on: ${{ matrix.config.os }}
27+
name: ${{ matrix.config.name }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
config:
32+
- { os: windows-2022, arch: x64, name: "Windows x86_64" }
33+
- { os: windows-2022, arch: x86, name: "Windows x86" }
34+
- { os: ubuntu-latest, arch: x64, name: "Ubuntu x86_64" }
35+
- { os: macos-latest, arch: x64, name: "macOS x86_64" }
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Rust
40+
uses: actions-rust-lang/setup-rust-toolchain@v1
41+
42+
- name: "🛠️ Activate Developer Command Prompt"
43+
if: contains(matrix.config.os, 'win')
44+
uses: ilammy/msvc-dev-cmd@v1
45+
with:
46+
arch: ${{ matrix.config.arch }}
47+
48+
- name: "🛠️ Win build dependencies"
49+
if: contains(matrix.config.os, 'win')
50+
shell: bash
51+
run: |
52+
choco install ninja
53+
54+
- name: "🚧 Cargo test"
55+
if: "!startsWith(github.ref, 'refs/tags')"
56+
run: |
57+
cargo test && cargo publish --dry-run --target-dir ./build_publish --allow-dirty
58+
59+
- name: Publish crates to Crates.io
60+
if: startsWith(github.ref, 'refs/tags') && !startsWith(github.ref, 'refs/tags/v') && contains(matrix.config.os, 'ubuntu')
61+
env:
62+
TOKEN: ${{ secrets.cratesio_token }}
63+
run: |
64+
cargo login $TOKEN && cargo publish -p unicorn-engine-sys && cd bindings/rust/unicorn-engine && cargo publish -p unicorn-engine

0 commit comments

Comments
 (0)