zkPass server #6
Workflow file for this run
This file contains hidden or 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: CI Pull Request | |
on: | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
on-main-pull-request: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
cabal: [3.10.3.0] | |
ghc: [9.6.6] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw6 libtool autoconf liblmdb-dev -y | |
- name: Install C dependencies | |
run: | | |
CARDANO_NODE_VERSION='10.1.3' | |
IOHKNIX_VERSION=$(curl https://raw.githubusercontent.com/IntersectMBO/cardano-node/$CARDANO_NODE_VERSION/flake.lock | jq -r '.nodes.iohkNix.locked.rev') | |
echo "iohk-nix version: $IOHKNIX_VERSION" | |
mkdir -p ~/src | |
cd ~/src | |
SODIUM_VERSION=$(curl https://raw.githubusercontent.com/input-output-hk/iohk-nix/$IOHKNIX_VERSION/flake.lock | jq -r '.nodes.sodium.original.rev') | |
echo "Using sodium version: $SODIUM_VERSION" | |
: ${SODIUM_VERSION:='dbb48cc'} | |
git clone https://github.com/intersectmbo/libsodium | |
cd libsodium | |
git checkout $SODIUM_VERSION | |
./autogen.sh | |
./configure | |
make | |
make check | |
sudo make install | |
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" | |
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" | |
source ~/.bashrc | |
cd ~/src | |
SECP256K1_VERSION=$(curl https://raw.githubusercontent.com/input-output-hk/iohk-nix/$IOHKNIX_VERSION/flake.lock | jq -r '.nodes.secp256k1.original.ref') | |
echo "Using secp256k1 version: ${SECP256K1_VERSION}" | |
: ${SECP256K1_VERSION:='v0.3.2'} | |
git clone --depth 1 --branch ${SECP256K1_VERSION} https://github.com/bitcoin-core/secp256k1 | |
cd secp256k1 | |
./autogen.sh | |
./configure --enable-module-schnorrsig --enable-experimental | |
make | |
make check | |
sudo make install | |
sudo ldconfig | |
cd ~/src | |
BLST_VERSION=$(curl https://raw.githubusercontent.com/input-output-hk/iohk-nix/master/flake.lock | jq -r '.nodes.blst.original.ref') | |
echo "Using blst version: ${BLST_VERSION}" | |
: ${BLST_VERSION:='v0.3.11'} | |
git clone --depth 1 --branch ${BLST_VERSION} https://github.com/supranational/blst | |
cd blst | |
./build.sh | |
cat > libblst.pc << EOF | |
prefix=/usr/local | |
exec_prefix=\${prefix} | |
libdir=\${exec_prefix}/lib | |
includedir=\${prefix}/include | |
Name: libblst | |
Description: Multilingual BLS12-381 signature library | |
URL: https://github.com/supranational/blst | |
Version: ${BLST_VERSION#v} | |
Cflags: -I\${includedir} | |
Libs: -L\${libdir} -lblst | |
EOF | |
sudo cp libblst.pc /usr/local/lib/pkgconfig/ | |
sudo cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/ | |
sudo cp libblst.a /usr/local/lib | |
sudo chmod u=rw,go=r /usr/local/{lib/{libblst.a,pkgconfig/libblst.pc},include/{blst.{h,hpp},blst_aux.h}} | |
cd | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Haskell | |
uses: haskell-actions/[email protected] | |
id: setup | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
cabal-update: true | |
- name: Configure Cabal | |
run: | | |
cabal update | |
# cabal configure --enable-tests --enable-benchmarks --enable-documentation | |
- name: Generate cache key | |
# Creates plan.json file | |
run: | | |
cabal build all --dry-run | |
- name: Restore cached dependencies | |
uses: actions/cache/[email protected] | |
id: cache | |
env: | |
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}-cabal-${{ matrix.cabal }} | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
restore-keys: ${{ env.key }}- | |
- name: Install stylish-haskell | |
run: | | |
cabal install stylish-haskell | |
- name: Lint Haskell | |
run: | | |
find . -name '*.hs' -exec sh -c 'for file do stylish-haskell --inplace "$file"; done' sh {} + | |
- name: Auto-commit lint | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: stylish-haskell auto-commit | |
commit_user_name: GitHub Action | |
commit_user_email: [email protected] | |
branch: ${{ github.head_ref }} | |
- name: Install dependencies | |
# If we had an exact cache hit, the dependencies will be up to date. | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cabal build all --only-dependencies | |
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. | |
- name: Save cached dependencies | |
uses: actions/cache/[email protected] | |
# If we had an exact cache hit, trying to save the cache would error because of key clash. | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
- name: Build | |
run: | | |
cabal build all -f Pedantic |