diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 53f520d9c..e3e8f8b3c 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -68,8 +68,17 @@ jobs: - name: Build dependencies run: cabal build --only-dependencies all -j4 - - name: Build project - run: cabal build all -j4 + - name: Build project with HIE files + run: cabal build all -j4 --ghc-options="-fwrite-ide-info -hiedir=.hiefiles" + + - name: Upload weeder artifacts + uses: actions/upload-artifact@v4 + with: + name: weeder-artifacts + path: | + .hiefiles + dist-newstyle/**/*.conf + retention-days: 1 test: name: Test ${{ matrix.test-suite }} @@ -190,6 +199,45 @@ jobs: path: src/ fail-on: warning + weeder: + name: Check unused code (weeder) + needs: build + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + with: + ghc-version: 9.12.2 + cabal-version: 'latest' + + - name: Cache weeder + id: cache-weeder + uses: actions/cache@v4 + with: + path: ~/.local/bin/weeder + key: weeder-2.9.0-ghc-9.12.2 + + - name: Install weeder + if: steps.cache-weeder.outputs.cache-hit != 'true' + run: | + mkdir -p ~/.local/bin + cabal update + cabal install weeder-2.9.0 --install-method=copy --installdir=$HOME/.local/bin + + - name: Download weeder artifacts + uses: actions/download-artifact@v4 + with: + name: weeder-artifacts + + - name: Run weeder + run: | + if [ ! -d ".hiefiles" ]; then + echo "Error: HIE files not found" + exit 1 + fi + ~/.local/bin/weeder --config config/weeder.toml + ui-tests: name: UI Tests runs-on: ubuntu-24.04