mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-07 15:43:07 +00:00
Implement github workflow for natively building in linux and windows.
This commit is contained in:
parent
879d012275
commit
1c18551ae9
17
.github/resources/Makefile.windows
vendored
Normal file
17
.github/resources/Makefile.windows
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
CC = g++
|
||||
CFLAGS = -std=c++11 -O3 -I. -I/include -Duint="unsigned int"
|
||||
LDFLAGS = -L/lib -lgmp -lmman
|
||||
|
||||
DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp
|
||||
DEPS_O = main.o calcwit.o fr.o pol.o
|
||||
|
||||
all: pol.exe
|
||||
|
||||
%.o: %.cpp $(DEPS_HPP)
|
||||
$(CC) -Wno-address-of-packed-member -c $< $(CFLAGS) -o $@
|
||||
|
||||
pol.exe: $(DEPS_O)
|
||||
$(CC) -o pol.exe $(DEPS_O) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *.o pol.exe
|
||||
138
.github/workflows/compile-circuit.yml
vendored
Normal file
138
.github/workflows/compile-circuit.yml
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request: # For testing purposes
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
name: Build Linux Binary
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
cache: false
|
||||
|
||||
- name: Install Circom
|
||||
run: |
|
||||
git clone https://github.com/iden3/circom.git
|
||||
cd circom
|
||||
RUSTFLAGS="-A dead_code" cargo build --release
|
||||
RUSTFLAGS="-A dead_code" cargo install --path circom
|
||||
circom --version
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: repo
|
||||
|
||||
- name: Initialise Submodules
|
||||
working-directory: repo
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Generate C++ Circuit
|
||||
working-directory: repo/circom_circuits/Mantle
|
||||
run: |
|
||||
circom --c --r1cs --no_asm pol.circom
|
||||
|
||||
- name: Install Circuit Dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install nlohmann-json3-dev
|
||||
|
||||
- name: Compile Circuit
|
||||
working-directory: repo/circom_circuits/Mantle/pol_cpp
|
||||
run: |
|
||||
make pol
|
||||
|
||||
- name: Upload Binary
|
||||
uses: actions/upload-artifact@v4
|
||||
working-directory: repo/circom_circuits/Mantle/pol_cpp
|
||||
with:
|
||||
name: pol
|
||||
path: pol
|
||||
|
||||
build-windows-native:
|
||||
name: Build Windows Binary (Native)
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
cache: false
|
||||
|
||||
- name: Install Circom
|
||||
run: |
|
||||
git clone https://github.com/iden3/circom.git
|
||||
cd circom
|
||||
$env:RUSTFLAGS="-A dead_code"; cargo build --release
|
||||
$env:RUSTFLAGS="-A dead_code"; cargo install --path circom
|
||||
circom --version
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: repo
|
||||
|
||||
- name: Initialise Submodules
|
||||
working-directory: repo
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Generate C++ Circuit
|
||||
working-directory: repo/circom_circuits/Mantle
|
||||
run: |
|
||||
circom --c --r1cs --no_asm pol.circom
|
||||
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: >-
|
||||
base-devel
|
||||
mingw-w64-x86_64-toolchain
|
||||
make
|
||||
git
|
||||
|
||||
- name: Dependencies - Setup
|
||||
shell: msys2 {0}
|
||||
run: mkdir /include
|
||||
|
||||
- name: Dependencies - Install [mman-win32]
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
git clone https://github.com/alitrack/mman-win32.git
|
||||
cd mman-win32
|
||||
pwd
|
||||
./configure --prefix= # Path: /
|
||||
make
|
||||
make install
|
||||
|
||||
- name: Dependencies - Install [nlohmann/json]
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
mkdir -p /include/nlohmann/
|
||||
wget -O /include/nlohmann/json.hpp https://github.com/nlohmann/json/releases/download/v3.12.0/json.hpp
|
||||
|
||||
- name: Replace pol Makefile # TODO: Make a fork generate the appropriate Windows Makefile
|
||||
working-directory: repo
|
||||
shell: msys2 {0}
|
||||
run: cp .github/resources/Makefile.windows circom_circuits/Mantle/pol_cpp/Makefile
|
||||
|
||||
- name: Compile Circuit
|
||||
shell: msys2 {0}
|
||||
working-directory: repo/circom_circuits/Mantle/pol_cpp
|
||||
run: |
|
||||
make pol.exe
|
||||
|
||||
- name: Upload Binary
|
||||
uses: actions/upload-artifact@v4
|
||||
working-directory: repo/circom_circuits/Mantle/pol_cpp
|
||||
with:
|
||||
name: pol.exe
|
||||
path: pol.exe
|
||||
Loading…
x
Reference in New Issue
Block a user