diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml index 603a9be..c7e70a7 100644 --- a/.forgejo/workflows/test.yaml +++ b/.forgejo/workflows/test.yaml @@ -16,46 +16,102 @@ jobs: steps: - name: Install Node.js (for actions) run: | - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs - - name: Checkout code uses: actions/checkout@v4 - - name: Check versions run: | ghc --version cabal --version - + node --version - name: Cache Cabal packages - uses: https://github.com/actions/cache@v4 + uses: actions/cache@v4 with: path: | ~/.cabal/packages ~/.cabal/store dist-newstyle - key: ${{ runner.os }}-stackage-lts22-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project') }} + key: ${{ runner.os }}-haskell-9.10-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project') }} restore-keys: | - ${{ runner.os }}-stackage-lts22-cabal- - + ${{ runner.os }}-haskell-9.10-cabal- - name: Update Cabal package index run: cabal update - - name: Configure project run: cabal configure --enable-tests --enable-benchmarks - - name: Build dependencies run: cabal build --only-dependencies --enable-tests --enable-benchmarks - - name: Build project run: cabal build --enable-tests --enable-benchmarks - - name: Run documentation build run: cabal haddock - test: runs-on: docker + container: + image: haskell:9.10 + needs: build steps: + - name: Install Node.js (for actions) + run: | + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Checkout code + uses: actions/checkout@v4 + - name: Cache Cabal packages + uses: actions/cache@v4 + with: + path: | + ~/.cabal/packages + ~/.cabal/store + dist-newstyle + key: ${{ runner.os }}-haskell-9.10-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-haskell-9.10-cabal- + - name: Update Cabal package index + run: cabal update + - name: Configure project + run: cabal configure --enable-tests --enable-benchmarks + - name: Build dependencies + run: cabal build --only-dependencies --enable-tests --enable-benchmarks + - name: Build project + run: cabal build --enable-tests --enable-benchmarks - name: Run tests run: cabal test --test-show-details=direct + + fourmolu: + runs-on: docker + container: + image: haskell:9.10 + steps: + - name: Install Node.js (for actions) + run: | + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Checkout code + uses: actions/checkout@v4 + - name: Install fourmolu + run: cabal install fourmolu-0.18.0.0 + - name: Run fourmolu + run: | + find src test app -name "*.hs" -exec fourmolu --check-idempotence {} \; 2>/dev/null || true + find src test app -name "*.hs" -exec fourmolu --mode check {} \; + + hlint: + runs-on: docker + container: + image: haskell:9.10 + steps: + - name: Install Node.js (for actions) + run: | + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + - name: Checkout code + uses: actions/checkout@v4 + - name: Install hlint + run: cabal install hlint-3.8 + - name: Run hlint + run: | + if [ -d src ]; then hlint src/; fi + if [ -d test ]; then hlint test/; fi + if [ -d app ]; then hlint app/; fi