Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add shellcheck and actionlint #5804

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/actionlint-exceptions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github/workflows/haskell.yml
.github/workflows/release-ghcr.yaml
.github/workflows/release-upload.yaml
.github/workflows/stylish-haskell.yml
39 changes: 39 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Actionlint

on:
pull_request:

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# We want to install Nix to provision shellcheck, so that actionlint doesn't install
# its own shellcheck. This will also make sure that this pipeline runs using
# the same shellcheck as the ones in Nix shells of developers.
- 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.nixos.org/ https://cache.iog.io/
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: actionlint
run: |
for file in $(git ls-files ".github/workflows/*.y*ml")
do
if grep -q "$file" ".github/workflows/actionlint-exceptions.txt"
then
echo "⚠️ $file is ignored from actionlint's verifications. Please consider fixing it."
else
echo "actionlint $file"
actionlint "$file"
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
tar -czf haddocks.tgz -C haddocks .

- name: Upload haddocks artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: ${{ always() }}
continue-on-error: true
with:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/shellcheck-exceptions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.github/bin/haddocks.sh
scripts/ci/check-cabal-files.sh
bench/process/process.sh
bench/script/probe.sh
cardano-submit-api/test/run.sh
cardano-tracer/demo/multi/run.sh
cardano-tracer/demo/ssh/run.sh
ci/check-dependencies-merged-to-master.sh
ci/check-hydra.sh
configuration/cardano/update-config-files.sh
nix/regenerate.sh
nix/workbench/analyse/analyse.sh
nix/workbench/backend/backend.sh
nix/workbench/backend/nomad.sh
nix/workbench/backend/nomad/cloud.sh
nix/workbench/backend/nomad/exec.sh
nix/workbench/backend/nomad/podman.sh
nix/workbench/backend/supervisor.sh
nix/workbench/chaindb.sh
nix/workbench/env.sh
nix/workbench/lib-cabal.sh
nix/workbench/lib.sh
nix/workbench/manifest.sh
nix/workbench/nomad.sh
nix/workbench/profile/pparams/apiPparamsImport.sh
nix/workbench/profile/pparams/diffLatest.sh
nix/workbench/profile/pparams/diffLatestWithOverlay.sh
nix/workbench/profile/pparams/pparamsLastWithOverlay.sh
nix/workbench/profile/profile.sh
nix/workbench/publish.sh
nix/workbench/run.sh
nix/workbench/scenario.sh
nix/workbench/topology/topology.sh
scripts/babbage/example-babbage-script-usage.sh
scripts/babbage/mkfiles.sh
scripts/babbage/script-context-equivalance-test.sh
scripts/babbage/script-mint-context-equivalance-test.sh
scripts/babbage/staking-example/claim-script-staking-rewards.sh
scripts/babbage/staking-example/register-and-delegate-script-staking-address.sh
scripts/bin-path.sh
scripts/byron-to-alonzo/burn.sh
scripts/byron-to-alonzo/mint.sh
scripts/byron-to-alonzo/mkfiles.sh
scripts/byron-to-alonzo/update-3.sh
scripts/byron-to-alonzo/update-4.sh
scripts/byron-to-alonzo/update-5.sh
scripts/ci/check-cabal-files.sh
scripts/gen-merge-summary.sh
scripts/lite/example-build-cmd.sh
scripts/lite/shelley-testnet-2.sh
scripts/lite/shelley-testnet.sh
scripts/lite/shutdown-ipc-example.sh
scripts/lite/split-txouts.sh
scripts/plutus/always-fails.sh
scripts/plutus/example-txin-locking-plutus-script.sh
scripts/plutus/script-context-equivalance-test.sh
scripts/plutus/script-context-equivalence-test-minting.sh
scripts/plutus/simple-minting-policy.sh
scripts/plutus/staking-example/claim-script-staking-rewards.sh
scripts/test-stake-cred-script/create-collateral.sh
40 changes: 40 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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.nixos.org/ https://cache.iog.io/
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
echo "shellcheck $file"
shellcheck "$file"
fi
done
2 changes: 2 additions & 0 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ let
ghcid
haskell-language-server
cabal
actionlint
shellcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that actionlint is a available in nixpkgs, so maybe it would be better to add it here instead of manual download step in a workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum yeah I had missed that actionlint is in nixpkgs 🤦

I added it to the dev shell and removed the custom installation from the workflow 👍

];

withHoogle = true;
Expand Down
Loading