7th try haskell.yml #60
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
name: Haskell Stack CI | |
on: | |
push: | |
branches: [ "main", "feature/**", "refactor/**" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Stack root | |
run: | | |
mkdir -p ~/.stack | |
mkdir -p .stack-work | |
- name: Setup Haskell Stack | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: '9.4.8' | |
enable-stack: true | |
stack-version: 'latest' | |
stack-no-global: true | |
- name: Cache Stack package index | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.stack/pantry | |
~/.stack/indices | |
key: ${{ runner.os }}-stack-pantry-${{ hashFiles('stack.yaml') }}-v3 | |
restore-keys: | | |
${{ runner.os }}-stack-pantry- | |
- name: Cache Stack programs | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.stack/programs | |
~/.stack/setup-exe-cache | |
key: ${{ runner.os }}-stack-programs-${{ hashFiles('stack.yaml') }}-v3 | |
restore-keys: | | |
${{ runner.os }}-stack-programs- | |
- name: Initialize Stack | |
run: | | |
stack --version | |
stack config set system-ghc false | |
stack config set install-ghc true | |
- name: Install GHC | |
run: stack setup --install-ghc | |
- name: Check resolver | |
run: | | |
echo "Current stack.yaml contents:" | |
cat stack.yaml | |
echo "GHC version:" | |
stack exec -- ghc --version | |
echo "Stack configuration:" | |
stack path | |
- name: Build dependencies | |
run: | | |
# First attempt basic dependencies | |
stack build --only-dependencies || true | |
# If that fails, try with more information | |
stack build --only-dependencies --verbose | |
- name: Build and test | |
if: success() | |
run: | | |
stack build | |
stack test | |
- name: Install and run HLint | |
if: success() | |
run: | | |
stack install hlint | |
stack exec -- hlint . | |
- name: Check formatting | |
if: success() | |
run: | | |
stack install ormolu | |
stack exec -- ormolu --mode check $(find . -name '*.hs') | |
- name: Build documentation | |
if: success() | |
run: stack haddock --no-haddock-deps | |
- name: Run benchmarks | |
if: github.event_name == 'pull_request' && success() | |
run: stack bench | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: | | |
.stack-work/dist/**/test-reports/ | |
.stack-work/dist/**/hpc/ | |
.stack-work/dist/**/doc/ | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |