Skip to content

Commit

Permalink
shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
FoseFx committed Dec 28, 2024
1 parent 1facce9 commit 73910a2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
fi
- name: Check version
run: |
./migrate.sh $svc desired
./migrate.sh "$svc" desired
if [ "$current" -ge "$(./migrate.sh $svc desired)" ]; then
echo "Migrations must be newer than the version of staging! You probably lack behind, merge or rebase onto main first!"
exit 1
Expand All @@ -192,11 +192,11 @@ jobs:
current: ${{ steps.collect-version.outputs.VERSION }}

- name: Run UP migrations (1/2)
run: ./migrate.sh $svc up
run: ./migrate.sh "$svc" up
- name: Generate schema.sql
run: |
/usr/lib/postgresql/15/bin/pg_dump \
postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB \
postgres://"$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" \
--schema-only -O > ./services/${{ matrix.service }}/schema.sql
sed 's/\(-- Dumped from database version [0-9]\+\.[0-9]\+\).*/\1/' -i ./services/${{ matrix.service }}/schema.sql
Expand All @@ -207,13 +207,13 @@ jobs:
run: git diff --exit-code -- services/${{ matrix.service }} || (echo "You forgot to run ./models.sh before checking in" && exit 1)
- name: Run DOWN migrations (1/2)
run: |
[ "$VERSION" -eq 0 ] && yes | ./migrate.sh $svc down || ./migrate.sh $svc goto $VERSION
[ "$VERSION" -eq 0 ] && yes | ./migrate.sh "$svc" down || ./migrate.sh "$svc" goto "$VERSION"
env:
VERSION: ${{ steps.collect-version.outputs.VERSION }}
- name: Run UP migrations (2/2)
run: ./migrate.sh $svc up
run: ./migrate.sh "$svc" up
- name: Run DOWN migrations (2/2)
run: |
[ "$VERSION" -eq 0 ] && yes | ./migrate.sh $svc down || ./migrate.sh $svc goto $VERSION
[ "$VERSION" -eq 0 ] && yes | ./migrate.sh "$svc" down || ./migrate.sh "$svc" goto "$VERSION"
env:
VERSION: ${{ steps.collect-version.outputs.VERSION }}
22 changes: 11 additions & 11 deletions .github/workflows/publish-bufs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ jobs:
id: breaking
# We previously checked if any illegal breakage occurred, now check if we have breakage _at all_
# If so, we publish this as a _major_ release
run: buf breaking --against '.git#ref=HEAD^' && echo "breaking=false" >> $GITHUB_OUTPUT || echo "breaking=true" >> $GITHUB_OUTPUT
run: buf breaking --against '.git#ref=HEAD^' && echo "breaking=false" >> "$GITHUB_OUTPUT" || echo "breaking=true" >> "$GITHUB_OUTPUT"
- name: Has new package?
id: new-package
run: |
last_tree=$(git ls-tree -d -r --name-only HEAD^ proto | sort) # directory tree of proto in old commit
current_tree=$(find proto -type d | sort) # directory tree of proto right now
new_dirs=$(comm -13 <(echo "$last_tree") <(echo "$current_tree")) # filter out lines, which are "-3": common (i.e. unchanged) or "-1": only in the last tree (i.e. removed)
echo $new_dirs
echo "$new_dirs"
if [ -z "$new_dirs" ]; then
echo "new-package=false" >> $GITHUB_OUTPUT
echo "new-package=false" >> "$GITHUB_OUTPUT"
else
echo "new-package=true" >> $GITHUB_OUTPUT
echo "new-package=true" >> "$GITHUB_OUTPUT"
fi
- name: Get SHA
id: commit
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
run: echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Get Bump
id: bump
run: |
Expand All @@ -72,7 +72,7 @@ jobs:
else
BUMP="patch"
fi
echo "bump=$BUMP" >> $GITHUB_OUTPUT
echo "bump=$BUMP" >> "$GITHUB_OUTPUT"
env:
BREAKING: ${{ steps.breaking.outputs.breaking }}
NEW_PKG: ${{ steps.new-package.outputs.new-package }}
Expand All @@ -91,10 +91,10 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- name: Fetch latest version from registry
working-directory: gen/ts
run: npm version $(npm view . version)
run: npm version "$(npm view . version)"
- name: Bump version
working-directory: gen/ts
run: npm version pre$BUMP --preid $SHA
run: npm version "pre$BUMP" --preid "$SHA"
env:
BUMP: ${{ needs.check-preconditions.outputs.bump }}
SHA: ${{ needs.check-preconditions.outputs.commit }}
Expand Down Expand Up @@ -137,9 +137,9 @@ jobs:
BUMP: ${{ needs.check-preconditions.outputs.bump }}
SHA: ${{ needs.check-preconditions.outputs.commit }}
run: |
VERSION=$(curl https://pub.dev/api/packages/helpwave_proto_dart -H "Accept: application/vnd.pub.v2+json" | jq ".latest.version" -r)
NEW_VERSION=$(semver bump $BUMP $VERSION)
NEW_VERSION=$(semver bump prerel $SHA $NEW_VERSION)
VERSION=$(curl "https://pub.dev/api/packages/helpwave_proto_dart" -H "Accept: application/vnd.pub.v2+json" | jq ".latest.version" -r)
NEW_VERSION=$(semver bump "$BUMP" "$VERSION")
NEW_VERSION=$(semver bump prerel "$SHA" "$NEW_VERSION")
sed "s/version:.*/version: $NEW_VERSION/" pubspec.yaml -i
- name: Publish to pub.dev
working-directory: gen/dart
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spicedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v4
- name: Get zed
run: |
wget https://github.com/authzed/zed/releases/download/v${ZED_VERSION}/zed_${ZED_VERSION}_linux_amd64.deb -O zed.deb
wget "https://github.com/authzed/zed/releases/download/v${ZED_VERSION}/zed_${ZED_VERSION}_linux_amd64.deb" -O zed.deb
sudo apt install -y ./zed.deb
- run: |
go run cmd/spice/spice.go test
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ linters:
- depguard # no need
- ireturn # no need
- funlen # we tend to have long funlens, who cares?
- execinquery # deprecated
- goimports # unused
- gochecknoglobals # we currently make use of globals
- godot # petty linter
- gomnd # deprecated
- gomoddirectives # not needed
- gofumpt # false positives
- mnd # too many false-positives
Expand Down
2 changes: 1 addition & 1 deletion images/dev-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENV PATH="$PATH:$GOROOT/bin"
# update debian package list and packages, also install some
RUN apt update \
&& apt upgrade -y \
&& apt install sudo vim nano jq dnsutils postgresql-client lsb-release gpg redis-tools \
&& apt install sudo vim nano jq dnsutils postgresql-client lsb-release gpg redis-tools shellcheck \
apt-transport-https ca-certificates curl gnupg2 software-properties-common \
-y \
&& apt-get clean autoclean -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit 73910a2

Please sign in to comment.