From acb98eff3c2b5b0181e8072b3ee35993152f6aa7 Mon Sep 17 00:00:00 2001 From: Anthony Alaribe Date: Mon, 22 Dec 2025 22:43:25 +0100 Subject: [PATCH 1/2] ci: add weeder check for unused code detection --- .github/workflows/pullrequest.yml | 59 +++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 53f520d9c..fcca80279 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -68,8 +68,22 @@ 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 HIE files + uses: actions/upload-artifact@v4 + with: + name: hiefiles + path: .hiefiles + retention-days: 1 + + - name: Upload dist-newstyle + uses: actions/upload-artifact@v4 + with: + name: dist-newstyle + path: dist-newstyle + retention-days: 1 test: name: Test ${{ matrix.test-suite }} @@ -190,6 +204,47 @@ 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 HIE files + uses: actions/download-artifact@v4 + with: + name: hiefiles + path: .hiefiles + + - name: Download dist-newstyle + uses: actions/download-artifact@v4 + with: + name: dist-newstyle + path: dist-newstyle + + - name: Run weeder + run: ~/.local/bin/weeder --config config/weeder.toml + ui-tests: name: UI Tests runs-on: ubuntu-24.04 From 9bb6a77294f6cb08deda829ac1292c9c02dd70b0 Mon Sep 17 00:00:00 2001 From: Anthony Alaribe Date: Mon, 22 Dec 2025 23:57:23 +0100 Subject: [PATCH 2/2] fix: reduce weeder artifact size and add validation --- .github/workflows/pullrequest.yml | 33 ++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index fcca80279..e3e8f8b3c 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -71,18 +71,13 @@ jobs: - name: Build project with HIE files run: cabal build all -j4 --ghc-options="-fwrite-ide-info -hiedir=.hiefiles" - - name: Upload HIE files + - name: Upload weeder artifacts uses: actions/upload-artifact@v4 with: - name: hiefiles - path: .hiefiles - retention-days: 1 - - - name: Upload dist-newstyle - uses: actions/upload-artifact@v4 - with: - name: dist-newstyle - path: dist-newstyle + name: weeder-artifacts + path: | + .hiefiles + dist-newstyle/**/*.conf retention-days: 1 test: @@ -230,20 +225,18 @@ jobs: cabal update cabal install weeder-2.9.0 --install-method=copy --installdir=$HOME/.local/bin - - name: Download HIE files + - name: Download weeder artifacts uses: actions/download-artifact@v4 with: - name: hiefiles - path: .hiefiles - - - name: Download dist-newstyle - uses: actions/download-artifact@v4 - with: - name: dist-newstyle - path: dist-newstyle + name: weeder-artifacts - name: Run weeder - run: ~/.local/bin/weeder --config config/weeder.toml + 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