-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #525 from IntersectMBO/smelc/shellcheck-in-ci
CI: shellcheck scripts
- Loading branch information
Showing
4 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Shellcheck | ||
# This pipeline runs shellcheck on all files with extension .sh, | ||
# except the ones listed in .github/workflows/shellcheck-exceptions.txt. | ||
# | ||
# This pipeline uses Nix, so that the shellcheck version used is the same | ||
# ones as used by developers in Nix shells. This ensures the CI's behavior | ||
# is consistent with the one of developers. | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Nix with good defaults | ||
uses: input-output-hk/install-nix-action@v20 | ||
with: | ||
extra_nix_config: | | ||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= | ||
substituters = https://cache.iog.io/ https://cache.nixos.org/ | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- uses: cachix/install-nix-action@v18 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
# Make the Nix environment available to next steps | ||
- uses: rrbutani/use-nix-shell-action@v1 | ||
- name: Shellcheck | ||
run: | | ||
for file in $(git ls-files "*.sh") | ||
do | ||
if grep -q "$file" ".github/workflows/shellcheck-exceptions.txt" | ||
then | ||
echo "⚠️ $file is ignored from shellcheck's verifications. Please consider fixing it." | ||
else | ||
shellcheck "$file" | ||
fi | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Runs "cabal check" in all directories containing a versioned .cabal file | ||
|
||
for x in $(find . -name '*.cabal' | grep -v dist-newstyle | cut -c 3-); do | ||
( | ||
d=$(dirname $x) | ||
echo "== $d ==" | ||
cd $d | ||
cabal check | ||
) | ||
for cabal_file in $(git ls-files "*.cabal") | ||
do | ||
cd "$(dirname "$cabal_file")" || { echo "Cannot cd"; exit 1; } | ||
echo "$(pwd)> cabal-check" | ||
cabal check | ||
cd - || { echo "Cannot cd back"; exit 1; } | ||
done |