From cee673d8fc978bac586df2bc4c310c04d05d6181 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Wed, 16 Oct 2024 12:59:41 +0200 Subject: [PATCH] ci: build Windows libraries on each release. (#225) --- .github/workflows/release.yaml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index af1efe37..3a93e307 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: tags: - 'v*' jobs: - build-cli: + build: if: ${{ startsWith(github.ref, 'refs/tags/v') }} env: CARGO_TERM_COLOR: always @@ -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 @@ -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: @@ -192,7 +206,7 @@ jobs: files: yr-*/yara-x-* publish-crate: - needs: [ publish-cli ] + needs: [ publish ] runs-on: ubuntu-latest steps: - name: Checkout sources @@ -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 ]