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

Add shellcheck github workflow #190

Merged
merged 3 commits into from
Aug 14, 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
18 changes: 18 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: shellcheck

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
shellcheck:
name: Run shellcheck on scripts
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Run shellcheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
15 changes: 12 additions & 3 deletions bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ system("rm -rf %s" % File.join(dir, ".git"))
system("rm -rf %s" % File.join(dir, "Gemfile"))
system("rm -rf %s" % File.join(dir, "Gemfile.lock"))
system("rm -rf %s" % File.join(dir, ".ruby-version"))
system("rm -rf %s" % File.join(dir, "bin/bootstrap"))
system("rm -rf %s" % File.join(dir, ".github/ISSUE_TEMPLATE.md"))
system("rm -rf %s" % File.join(dir, ".github/workflows/pause-community-contributions.yml"))
system("rm -rf %s" % File.join(dir, "bin", "bootstrap"))
system("rm -rf %s" % File.join(dir, ".github", "ISSUE_TEMPLATE.md"))
system("rm -rf %s" % File.join(dir, ".github", "workflows", "pause-community-contributions.yml"))
system("rm -rf %s" % File.join(dir, ".github", "workflows", "shellcheck.yml"))
system("mv %s/TRACK_README.md %s/README.md" % [dir, dir])

f = File.join(dir, 'LICENSE')
Expand All @@ -62,6 +63,14 @@ File.open(f, "w") do |f|
f.write contents.gsub('{{UUID}}') {|m| SecureRandom.uuid }
end

%w[verify-exercises verify-exercises-in-docker].each do |name|
f = File.join(dir, 'bin', name)
contents = File.read(f)
File.open(f, "w") do |f|
f.write contents.gsub(/^\s*# shellcheck.*?\n/, '')
end
end

[
"config.json",
"README.md",
Expand Down
1 change: 1 addition & 0 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ copy_example_or_examplar_to_solution() {
}

unskip_tests() {
# shellcheck disable=SC2034
jq -r '.files.test[]' .meta/config.json | while read -r test_file; do
noop # TODO: replace this with the command to unskip the tests.
# Note: this function runs from within an exercise directory.
Expand Down
2 changes: 2 additions & 0 deletions bin/verify-exercises-in-docker
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ copy_example_or_examplar_to_solution() {
}

pull_docker_image() {
# shellcheck disable=SC1083
docker pull exercism/{{SLUG}}-test-runner ||
die $'Could not find the `exercism/{{SLUG}}-test-runner` Docker image.\nCheck the test runner docs at https://exercism.org/docs/building/tooling/test-runners for more information.'
}
Expand All @@ -38,6 +39,7 @@ run_tests() {
local slug
slug="${1}"

# shellcheck disable=SC1083
docker run \
--rm \
--network none \
Expand Down