Skip to content

Commit

Permalink
chore: add sellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-sanderson committed Aug 7, 2024
1 parent 7be70f9 commit 6aaced4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check-shell-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "[Check] Shell validation"

on:
pull_request:
paths:
- "**.sh"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

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

- name: shellcheck
run: ./scripts/shellcheck.sh
10 changes: 4 additions & 6 deletions ci/s3sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

DIRS="bootloader bridge firmware legal registry udev suite connect security transparency misc"
BUCKET=data.trezor.io
ROLLBACK=rollback-data.trezor.io
DISTRIBUTION_ID="E1ERY5K2OTKKI1"

./check_releases.py
if [ "$?" != "0" ]; then
if ! ./check_releases.py; then
echo "check_releases.py failed."
exit
fi
Expand All @@ -21,10 +19,10 @@ set -e
# aws s3 sync s3://$BUCKET s3://$ROLLBACK

for DIR in $DIRS; do
if [ "x$1" == "x-d" ]; then
aws s3 sync --delete --cache-control 'public, max-age=3600' $DIR s3://$BUCKET/$DIR
if [ "$1" == "-d" ]; then
aws s3 sync --delete --cache-control 'public, max-age=3600' "$DIR" s3://$BUCKET/"$DIR"
else
aws s3 sync --cache-control 'public, max-age=3600' $DIR s3://$BUCKET/$DIR
aws s3 sync --cache-control 'public, max-age=3600' "$DIR" s3://$BUCKET/"$DIR"
fi
done

Expand Down
10 changes: 10 additions & 0 deletions scripts/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e
set -u
set -x
set -o pipefail

shellcheck --version

find . -type f -name '*.sh' -exec shellcheck {} +

0 comments on commit 6aaced4

Please sign in to comment.