-
Notifications
You must be signed in to change notification settings - Fork 51
92 lines (81 loc) · 3.2 KB
/
release.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
name: automatic release
on:
push:
branches:
- main
workflow_dispatch:
env:
C_KZG_4844_GIT_HASH: '5115420ba3f919f5501155ba18633667001b6a07'
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