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-checks: run all the checks on checked-in files; check shellcheck #175

Merged
merged 7 commits into from
Jun 17, 2020
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
23 changes: 20 additions & 3 deletions ci-checks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash
# shellcheck shell=bash

set -eux

codespell -q 3 -I .codespell-whitelist *
prettier --check '**/*.json' '**/*.md' '**/*.yml'
shfmt -l -d .
failed=0

if ! git ls-files | xargs codespell -q 3 -I .codespell-whitelist; then
failed=1
fi

if ! git ls-files '*.yml' '*.json' '*.md' | xargs prettier --check; then
failed=1
fi

if ! git ls-files '*.sh' | xargs shfmt -l -d; then
failed=1
fi

if ! git ls-files '*.sh' | xargs shellcheck; then
failed=1
fi

exit "$failed"
6 changes: 3 additions & 3 deletions protos/protoc.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

for proto in $(echo hardware template workflow); do
for proto in hardware template workflow; do
echo "Generating ${proto}.pb.go..."
protoc -I ./ -I ./common/ ${proto}/${proto}.proto --go_out=plugins=grpc:./
protoc -I ./ -I ./common/ "${proto}/${proto}.proto" --go_out=plugins=grpc:./
done
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ check_container_status() (
esac

local status
read status < <(docker events \
read -r status < <(docker events \
--since "$start_moment" \
--filter "container=$container_id" \
--filter "event=health_status" \
Expand Down
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ with pkgs;

mkShell {
buildInputs = [
git
gnumake
go
jq
Expand Down
6 changes: 1 addition & 5 deletions test/push_images.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash

for i in {1..10}; do
docker login -u username -p password localhost
if [ $? -eq 0 ]; then
break
fi
while ! docker login -u username -p password localhost; do
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this really belong in this PR? I'm fine if you want to earmark it in, just wand to double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe not, it just seemed like the easiest fix for $i being unused. I could swap it out to just echo the iteration. What do you think?

sleep 1
done
docker push localhost/update-data
Expand Down