Skip to content

Commit

Permalink
Add Github precommit workflow (#3060)
Browse files Browse the repository at this point in the history
* Add Github precommit workflow

* Reformat remaining files

* Don't shorten project name

* Fix pre-commit file exclusion pattern
  • Loading branch information
lunaticare authored Jul 29, 2022
1 parent 347a718 commit 488d287
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-build
with:
ghc: "9.2.3"
os: ${{ runner.os }}
shorten-hls: false

- name: "Install stylish-haskell"
run: |
cabal install stylish-haskell
echo "${HOME}/.cabal/bin" >> $GITHUB_PATH
- name: "Check stylish-haskell is available"
run: |
echo $(which stylish-haskell)
- name: Compiled deps cache
id: stylish-haskell-compiled-cache
uses: actions/cache@v2
env:
cache-name: stylish-haskell-compiled-cache
with:
path: ${{ env.CABAL_PKGS_DIR }}
key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
"id": "mixed-line-ending",
"args": ["--fix", "lf"],
"exclude": "test/testdata/.*CRLF*.hs$"
"exclude": "test/testdata/.*CRLF.*?\\.hs$"
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Maybe (MaybeT (MaybeT), runMaybeT)
import Data.Foldable (toList)
import qualified Data.HashMap.Strict as HM
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as HM
import qualified Data.Map as Map
import Data.Maybe (fromJust, mapMaybe)
import qualified Data.Text as T
Expand All @@ -24,9 +24,9 @@ import Development.IDE (Action, FileDiagnostic,
getFilesOfInterestUntracked,
hscEnv, msrModSummary,
tmrTypechecked, use, uses)
import Development.IDE.Core.Rules (getHieFile,
getSourceFileSource)
import Development.IDE.Core.RuleTypes (HieAstResult (..))
import Development.IDE.Core.Rules (getSourceFileSource,
getHieFile)
import qualified Development.IDE.Core.Shake as Shake
import Development.IDE.GHC.Compat (HieASTs (HieASTs),
RealSrcSpan (..), mkHieFile',
Expand Down

0 comments on commit 488d287

Please sign in to comment.