Skip to content

Use elegant-git for the binary file name #82

Use elegant-git for the binary file name

Use elegant-git for the binary file name #82

name: Haskell Test CI
on:
push:
branches: [ "main" ]
pull_request:
permissions:
contents: read
env:
GHC_VERSION: 9.2.5
GHCUP_VERSION: 0.1.18.0
STACK_VERSION: 2.9.1
HLINT_VERSION: 3.3.6
FOURMOLU_VERSION: 0.9.0.0
jobs:
tests:
strategy:
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
name: "Quality pipeline"
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
name: Cache .stack
id: haskell-deps-cache
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ env.GHC_VERSION }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-${{ env.GHC_VERSION }}-
- name: Setup haskell enviroment
run: |
export PATH=~/.ghcup/bin:$PATH
sudo apt update && sudo apt -y install libncurses5 libtinfo5
if [ -f "$HOME/.ghcup/bin/ghcup" ] && [[ $(~/.ghcup/bin/ghcup --version) == *"${{ env.GHCUP_VERSION }}"* ]]; then
echo "Required ghcup is already installed"
ghcup --version
else
mkdir -p ~/.ghcup/bin
wget -O ~/.ghcup/bin/ghcup https://downloads.haskell.org/~ghcup/${{ env.GHCUP_VERSION }}/x86_64-linux-ghcup-${{ env.GHCUP_VERSION }}
sudo chmod +x ~/.ghcup/bin/ghcup
ghcup install ghc ${{ env.GHC_VERSION }}
fi
if [ -f "$HOME/.ghcup/bin/stack" ] && [[ $(~/.ghcup/bin/stack --version) == *"${{ env.STACK_VERSION }}"* ]]; then
echo "Required stack is already installed"
stack --version
else
mkdir -p ~/.stack/
ghcup install stack ${{ env.STACK_VERSION }}
stack config set system-ghc --global true
stack config set install-ghc --global false
fi
- name: Install hlint
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
if [ -f "$HOME/.ghcup/bin/hlint" ] && [[ $(~/.ghcup/bin/hlint --version) == *"${{ env.HLINT_VERSION }}"* ]]; then
echo "Requested hlint is already installed"
hlint --version
else
echo "Installing hlint v${{ env.HLINT_VERSION }}"
wget -O /tmp/hlint-${{ env.HLINT_VERSION }}.tar.gz https://github.com/ndmitchell/hlint/releases/download/v${{ env.HLINT_VERSION }}/hlint-${{ env.HLINT_VERSION }}-x86_64-linux.tar.gz
tar -xf /tmp/hlint-${{ env.HLINT_VERSION }}.tar.gz -C /tmp
cp /tmp/hlint-${{ env.HLINT_VERSION }}/hlint ~/.ghcup/bin/hlint
fi
- name: Install fourmolu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
echo "Installing fourmolu v${{ env.FOURMOLU }}"
wget -O ~/.ghcup/bin/fourmolu https://github.com/fourmolu/fourmolu/releases/download/v${{ env.FOURMOLU_VERSION }}/fourmolu-${{ env.FOURMOLU_VERSION }}-linux-x86_64
sudo chmod +x ~/.ghcup/bin/fourmolu
fourmolu --version
- name: Run hlint
if: ${{ matrix.os == 'ubuntu-latest' }}
run: hlint .
- name: Run fourmolu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: fourmolu -m check src app test
- name: Build dependencies
run: stack build --no-haddock --only-dependencies --fast --pedantic
- name: Run tests
run: stack test --fast --pedantic