Skip to content

Commit

Permalink
ci: build Windows libraries on each release. (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic authored Oct 16, 2024
1 parent c8b5c3f commit cee673d
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
tags:
- 'v*'
jobs:
build-cli:
build:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -59,13 +59,27 @@ jobs:
env:
RUSTFLAGS: "-C target-feature=+crt-static"

- name: Build C library
if: matrix.build == 'windows'
run: |
cargo install cargo-c
cargo cbuild --profile release-lto --target ${{ matrix.target }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"

- name: Build archive
shell: bash
run: |
set -ex
pkgname=yara-x-${{ github.ref_name }}-${{ matrix.target }}
if [ "${{ matrix.build }}" = "windows" ]; then
7z a $pkgname.zip ./target/${{ matrix.target }}/release-lto/yr.exe
7z a $pkgname.zip ./target/${{ matrix.target }}/release-lto/yr.exe
7z a yara-x-capi-${{ github.ref_name }}-${{ matrix.target }}.zip \
./target/${{ matrix.target }}/release-lto/yara_x.h \
./target/${{ matrix.target }}/release-lto/yara_x_capi.def \
./target/${{ matrix.target }}/release-lto/yara_x_capi.lib \
./target/${{ matrix.target }}/release-lto/yara_x_capi.dll.lib \
./target/${{ matrix.target }}/release-lto/yara_x_capi.dll
else
tar czf $pkgname.gzip -C target/${{ matrix.target }}/release-lto yr
fi
Expand Down Expand Up @@ -171,8 +185,8 @@ jobs:
name: pypi-source-${{ strategy.job-index }}
path: ./wheelhouse/*.tar.gz

publish-cli:
needs: [ build-cli ]
publish:
needs: [ build ]
runs-on: ubuntu-latest

steps:
Expand All @@ -192,7 +206,7 @@ jobs:
files: yr-*/yara-x-*

publish-crate:
needs: [ publish-cli ]
needs: [ publish ]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -211,7 +225,7 @@ jobs:
cargo publish -p yara-x-proto
cargo publish -p yara-x-proto-yaml
cargo publish -p yara-x-parser
cargo publish -p yara-x
cargo publish -p yara-x
publish-py:
needs: [ build-py ]
Expand Down

0 comments on commit cee673d

Please # to comment.