Try to fix ci for release #14
Workflow file for this run
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: 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 |