Skip to content

double runs on syntax error #4937

double runs on syntax error

double runs on syntax error #4937

Workflow file for this run

name: Build with MacOS
on:
workflow_dispatch:
push:
# paths-ignore:
# - '.github/**'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["9.6.4"]
cabal: ["3.10"]
os: ["macos-14-large"]
cabalcache: ["true"]
steps:
# Setup
- name: Checkout repository
uses: actions/checkout@v3
# work around for https://github.com/haskell/actions/issues/187
- name: Set permissions for .ghcup
if: startsWith(matrix.os, 'ubuntu-')
run: sudo chown -R $USER /usr/local/.ghcup
- name: Install GHC and Cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Confirm GHC and Cabal installation
run: |
ghc --version
cabal --version
- name: Install non-Haskell dependencies (macOS)
if: contains(matrix.os, 'mac')
run: |
brew update && brew install gflags llvm snappy || true
- name: Create cabal.project.local
run: |
cat > cabal.project.local <<EOF
package *
documentation: False
package chainweb
documentation: False
benchmarks: True
tests: True
package pact
documentation: False
EOF
- name: Create date file for dist-newstyle cache key
id: cache-date
run: |
echo "value=$(date +%Y.%j)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Cache dist-newstyle
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ matrix.os }}-${{ matrix.ghc }}-2-${{ steps.cache-date.outputs.value }}-${{ hashFiles('cabal.*', '*.cabal', 'src/**', 'test/**') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.ghc }}-2-${{ steps.cache-date.outputs.value }}-
${{ matrix.os }}-${{ matrix.ghc }}-2-
# Build
- name: Delete Freeze file if it exists
run: rm -f cabal.project.freeze
- name: Update package database
run: cabal update
- name: Display outdated packages
run: cabal outdated
- name: Configure build
run: |
cabal build all --dry-run
cabal freeze
- name: Sync from cabal cache
if: matrix.cabalcache == 'true'
uses: larskuhtz/cabal-cache-action@018b7ae0c480ba3dc4fa0cfa3a0bc1f05b7724b3
with:
bucket: "kadena-cabal-cache"
region: "us-east-1"
folder: "${{ matrix.os }}"
aws_access_key_id: "${{ secrets.kadena_cabal_cache_aws_access_key_id }}"
aws_secret_access_key: "${{ secrets.kadena_cabal_cache_aws_secret_access_key }}"
- name: Install build dependencies
run: cabal build chainweb --only-dependencies
- name: Build chainweb library
run: cabal build lib:chainweb
- name: Build chainweb applications
run: cabal build exe:chainweb-node test:chainweb-tests exe:cwtool chainweb:bench:bench
- name: Run Tests
run: |
ulimit -n 10000
cabal run tests -- --hide-successes
# Checks
- name: Check that working directory tree is clean
run: |
mv cabal.project.freeze cabal.project.freeze.backup
git checkout -- cabal.project.freeze || true
if ! git diff --exit-code; then
echo "Git working tree is not clean. The build changed some file that is checked into git." 1>&2
exit 1
fi
mv cabal.project.freeze.backup cabal.project.freeze
- name: Run ea and verify consistency of genesis headers
run: |
cabal run cwtool -- ea
mv cabal.project.freeze cabal.project.freeze.backup
git checkout -- cabal.project.freeze || true
if ! git diff --exit-code; then
echo "Inconsistent genesis headers detected. Did you forget to run ea?" 1>&2
exit 1
fi
mv cabal.project.freeze.backup cabal.project.freeze