Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
106 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Haskell CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ghc: ["8.6.5"] | ||
os: [ubuntu-latest, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Select build directory | ||
run: echo "CABAL_BUILDDIR=dist" >> $GITHUB_ENV | ||
|
||
- name: Install pkgconfiglite | ||
if: matrix.os == 'windows-latest' | ||
run: choco install -y pkgconfiglite | ||
|
||
- name: Install libsodium | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
curl -Ls https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz -o libsodium-1.0.18-mingw.tar.gz | ||
tar zxvf libsodium-1.0.18-mingw.tar.gz | ||
sed -i "s|/d/a/1/s/|D:/a/cardano-node/cardano-node/|g" libsodium-win64/lib/pkgconfig/libsodium.pc | ||
export PKG_CONFIG_PATH="$(readlink -f libsodium-win64/lib/pkgconfig)" | ||
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV | ||
export LIBSODIUM_PATH="$(readlink -f libsodium-win64/bin | sed 's|^/d|D:|g' | tr / '\\')" | ||
echo "LIBSODIUM_PATH=$LIBSODIUM_PATH" | ||
echo "$LIBSODIUM_PATH" >> $GITHUB_PATH | ||
- name: Install Postgres (Linux) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libpq-dev libpq5 postgresql-all | ||
sudo service postgresql start | ||
- name: Install Postgres support (MacOS) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
brew install postgres libpq | ||
postgres -D /usr/local/var/postgres | ||
- name: Install libsodium | ||
if: matrix.os == 'macos-latest' | ||
run: brew install libsodium | ||
|
||
- uses: actions/setup-haskell@v1 | ||
id: setup-haskell | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: '3.2.0.0' | ||
|
||
- name: Install build environment | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install libsodium23 libsodium-dev | ||
sudo apt-get -y install libsystemd0 libsystemd-dev | ||
sudo apt-get -y remove --purge software-properties-common | ||
sudo apt-get -y autoremove | ||
- name: Cabal update | ||
run: cabal update | ||
|
||
- name: Cabal Configure | ||
run: cabal configure --builddir="$CABAL_BUILDDIR" --enable-tests --enable-benchmarks --write-ghc-environment-files=always | ||
|
||
- name: Configure to use libsodium | ||
run: | | ||
cat >> cabal.project.local <<EOF | ||
package cardano-crypto-praos | ||
flags: -external-libsodium-vrf | ||
EOF | ||
- uses: actions/cache@v2 | ||
if: matrix.os != 'macos-latest' | ||
name: Cache cabal store | ||
with: | ||
path: | | ||
${{ steps.setup-haskell.outputs.cabal-store }} | ||
dist | ||
key: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}-${{ github.sha }} | ||
restore-keys: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}- | ||
|
||
- name: Install dependencies | ||
run: cabal build all --builddir="$CABAL_BUILDDIR" --only-dependencies | ||
|
||
- name: Build | ||
run: cabal build all --builddir="$CABAL_BUILDDIR" | ||
|
||
- name: Run tests | ||
run: cabal test --builddir="$CABAL_BUILDDIR" all -j1 |