Merge pull request #256 from ArtiomTr/enable-bgmw-by-default #21
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: automatic release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
C_KZG_4844_GIT_HASH: '624aa60d01da524827123506975431aa5454c80d' | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
backend: [blst, zkcrypto, arkworks, constantine] | |
target: [windows, linux] | |
include: | |
# Set target-name for target builds | |
- target: linux | |
target-name: x86_64-unknown-linux-gnu | |
- target: windows | |
target-name: x86_64-pc-windows-gnu | |
env: | |
matrix-name: "[${{ matrix.backend }}, ${{ matrix.target }}]" | |
staging-dir: staging/${{ matrix.backend }}/${{ matrix.target }} | |
archive-name: rust-kzg-${{ matrix.backend }}-${{ matrix.target }}.zip | |
steps: | |
- uses: actions/checkout@v2 | |
- if: matrix.backend == 'constantine' | |
uses: jiro4989/setup-nim-action@v1 | |
with: | |
nim-version: '1.6.14' | |
# Install constantine backend deps | |
- name: "constantine - install deps" | |
if: matrix.backend == 'constantine' | |
run: | | |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | |
--no-install-recommends -yq \ | |
libgmp-dev \ | |
llvm | |
- if: matrix.target == 'windows' | |
name: Install MinGW | |
run: | | |
sudo apt install -y mingw-w64 | |
- name: "${{ env.matrix-name }} Prepare artifact folders" | |
run: | | |
mkdir -p ${{ env.staging-dir }}/parallel | |
mkdir -p ${{ env.staging-dir }}/non-parallel | |
- name: "${{ env.matrix-name }} Build" | |
run: | | |
# Non-parallel build | |
cargo rustc --manifest-path ${{ matrix.backend }}/Cargo.toml --release --target ${{ matrix.target-name }} --crate-type=staticlib | |
mv target/${{ matrix.target-name }}/release/librust_kzg_${{ matrix.backend}}.a ${{ env.staging-dir }}/non-parallel/rust_kzg_${{ matrix.backend}}.a | |
# Parallel build | |
cargo rustc --manifest-path ${{ matrix.backend }}/Cargo.toml --release --target ${{ matrix.target-name }} --crate-type=staticlib --features=parallel | |
mv target/${{ matrix.target-name }}/release/librust_kzg_${{ matrix.backend}}.a ${{ env.staging-dir }}/parallel/rust_kzg_${{ matrix.backend}}.a | |
- name: "${{ env.matrix-name }} Compress artifacts" | |
run: | | |
cp LICENSE ${{ env.staging-dir }}/ | |
cp ${{ matrix.backend }}/*.patch ${{ env.staging-dir }}/ | |
cd ${{ env.staging-dir }} | |
zip -rz ${{ env.archive-name }} * <<< "Compatible with c-kzg-4844 git hash: $C_KZG_4844_GIT_HASH." | |
- name: "${{ env.matrix-name }} Upload" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.archive-name }} | |
path: ${{ env.staging-dir }}/${{ env.archive-name }} | |
release-publish: | |
runs-on: ubuntu-latest | |
needs: release-build | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: false | |
title: "Automatic Release" | |
files: | | |
./rust-kzg-*.zip/rust-kzg-*.zip |