-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (92 loc) · 3.53 KB
/
c_bindings.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
name: C bindings
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
test-c-bindings:
name: Test C bindings
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Make C test programs
run: make -C c_bindings BUILD_MODE=release
- name: Test Yay0
run: ./c_bindings/tests/test_yay0.sh
- name: Test Yaz0
run: ./c_bindings/tests/test_yaz0.sh
release:
name: Release ${{ matrix.crate-type }} for ${{ matrix.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-gnu, x86_64-pc-windows-msvc, x86_64-apple-darwin, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
crate-type: [staticlib]
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-pc-windows-msvc
archive: zip
- target: x86_64-apple-darwin
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz
- target: x86_64-unknown-linux-gnu
archive: tar.gz
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build lib
run: cargo rustc --manifest-path lib/Cargo.toml --lib --features c_bindings --release --crate-type ${{ matrix.crate-type }} --target ${{ matrix.target }}
- name: Print built files
run: |
tree target/${{ matrix.target }}/release
- name: Move files for packaging
run: |
mkdir -p package/lib package/include
cp target/${{ matrix.target }}/release/libcrunch64.a package/lib/ || cp target/${{ matrix.target }}/release/crunch64.lib package/lib/
cp -r c_bindings/include/* package/include/
cp LICENSE package/crunch64.LICENSE
cp README.md package/crunch64.README.md
tree package
- name: Package .tar.gz
if: matrix.archive == 'tar.gz'
run: |
cd package && tar -czf ../crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz *
- name: Package .zip
if: matrix.archive == 'zip'
run: |
cd package && zip -r ../crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.zip *
- name: Upload .tar.gz archive
if: matrix.archive == 'tar.gz'
uses: actions/upload-artifact@v3
with:
name: crunch64-${{ matrix.crate-type }}-${{ matrix.target }}
path: |
crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz
if-no-files-found: error
- name: Upload .zip archive
if: matrix.archive == 'zip'
uses: actions/upload-artifact@v3
with:
name: crunch64-${{ matrix.crate-type }}-${{ matrix.target }}
path: |
crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.zip
if-no-files-found: error
- name: Publish .tar.gz release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'tar.gz'
with:
files: crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz
- name: Publish .zip release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'zip'
with:
files: crunch64-${{ matrix.crate-type }}-${{ matrix.target }}.zip