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

Run shellcheck as a github workflow #5876

Merged
merged 2 commits into from
Mar 5, 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
17 changes: 17 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
pull_request:
workflow_dispatch:

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
ignore_paths: >-
./android/gradlew
env:
SHELLCHECK_OPTS: --external-sources
4 changes: 3 additions & 1 deletion ci/ios/buildserver-build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eu
shopt -s nullglob

TAG_PATTERN_TO_BUILD=("^ios/")
TAG_PATTERN_TO_BUILD="^ios/"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$SCRIPT_DIR/mullvadvpn-app/ios"
LAST_BUILT_DIR="$SCRIPT_DIR/last-built"
Expand Down Expand Up @@ -93,6 +93,8 @@ function run_build_loop() {

run_git fetch --prune --tags 2> /dev/null || continue
local tags

# shellcheck disable=SC2207
tags=( $(run_git tag | grep "$TAG_PATTERN_TO_BUILD") )

for tag in "${tags[@]}"; do
Expand Down
4 changes: 1 addition & 3 deletions ci/ios/run-in-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ vm_pid=$!
# Sleep to wait until VM is up
sleep 10

# apparently, there's a difference between piping into zsh like this and doing
# a <(echo $SCRIPT).
cat "$SCRIPT" | ssh admin@"$(tart ip "$VM_NAME")" bash /dev/stdin
ssh admin@"$(tart ip "$VM_NAME")" bash /dev/stdin < "$SCRIPT"
script_status=$?

kill $vm_pid
Expand Down
2 changes: 1 addition & 1 deletion dist-assets/linux/before-remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pkill -9 -x "mullvad-gui" || true
is_number_re='^[0-9]+$'
# Check if we're running during an upgrade step on Fedora
# https://fedoraproject.org/wiki/Packaging:Scriptlets#Syntax
if [[ "$1" =~ $is_number_re ]] && [ $1 -gt 0 ]; then
if [[ "$1" =~ $is_number_re ]] && [ "$1" -gt 0 ]; then
exit 0;
fi

Expand Down
6 changes: 3 additions & 3 deletions dist-assets/linux/mullvad-gui-launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ if [ "${XDG_SESSION_TYPE:-""}" = "wayland" ] && \
echo " $SUPPORTED_COMPOSITORS " | \
grep -qi -e " ${XDG_CURRENT_DESKTOP:-""} " -e " ${XDG_SESSION_DESKTOP:-""} "
then
WAYLAND_FLAGS="--ozone-platform=wayland --enable-features=WaylandWindowDecorations"
WAYLAND_FLAGS=( "--ozone-platform=wayland" "--enable-features=WaylandWindowDecorations" )
else
WAYLAND_FLAGS=""
WAYLAND_FLAGS=()
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec "$SCRIPT_DIR/mullvad-gui" $SANDBOX_FLAG $WAYLAND_FLAGS "$@"
exec "$SCRIPT_DIR/mullvad-gui" "$SANDBOX_FLAG" "${WAYLAND_FLAGS[@]}" "$@"
2 changes: 1 addition & 1 deletion dist-assets/pkg-scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
LOG_DIR=/var/log/mullvad-vpn

mkdir -p $LOG_DIR
exec 2>&1 > $LOG_DIR/postinstall.log
exec > $LOG_DIR/postinstall.log 2>&1

echo "Running postinstall at $(date)"

Expand Down
2 changes: 1 addition & 1 deletion dist-assets/pkg-scripts/preinstall
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ INSTALL_DIR=$2

mkdir -p $LOG_DIR
chmod 755 $LOG_DIR
exec 2>&1 > $LOG_DIR/preinstall.log
exec > $LOG_DIR/preinstall.log 2>&1

echo "Running preinstall at $(date)"

Expand Down
6 changes: 3 additions & 3 deletions dist-assets/uninstall_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ue

read -p "Are you sure you want to stop and uninstall Mullvad VPN? (y/n) "
read -r -p "Are you sure you want to stop and uninstall Mullvad VPN? (y/n) "
if [[ "$REPLY" =~ [Yy]$ ]]; then
echo "Uninstalling Mullvad VPN ..."
else
Expand Down Expand Up @@ -40,7 +40,7 @@ sudo pkgutil --forget net.mullvad.vpn || true
echo "Removing login item ..."
osascript -e 'tell application "System Events" to delete login item "Mullvad VPN"' 2>/dev/null || true

read -p "Do you want to delete the log and cache files the app has created? (y/n) "
read -r -p "Do you want to delete the log and cache files the app has created? (y/n) "
if [[ "$REPLY" =~ [Yy]$ ]]; then
sudo rm -rf /var/log/mullvad-vpn /var/root/Library/Caches/mullvad-vpn /Library/Caches/mullvad-vpn
for user in /Users/*; do
Expand All @@ -52,7 +52,7 @@ if [[ "$REPLY" =~ [Yy]$ ]]; then
done
fi

read -p "Do you want to delete the Mullvad VPN settings? (y/n) "
read -r -p "Do you want to delete the Mullvad VPN settings? (y/n) "
if [[ "$REPLY" =~ [Yy]$ ]]; then
sudo rm -rf /etc/mullvad-vpn
for user in /Users/*; do
Expand Down
3 changes: 2 additions & 1 deletion ios/build-wireguard-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ WIREGUARD_KIT_GO_PATH="$RESOLVED_SOURCE_PACKAGES_PATH/checkouts/wireguard-apple/
echo "WireGuardKitGo path resolved to $WIREGUARD_KIT_GO_PATH"

# Run make
/usr/bin/make -C "$WIREGUARD_KIT_GO_PATH" $ACTION
# shellcheck disable=SC2086
/usr/bin/make -C "$WIREGUARD_KIT_GO_PATH" $ACTION
3 changes: 3 additions & 0 deletions scripts/localization
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"

# shellcheck disable=SC1091
source utils/log

function main {
Expand Down Expand Up @@ -106,6 +107,8 @@ function download_from_crowdin {
function verify {
sync_localizations
git diff

# shellcheck disable=SC2251
! git status -s | grep .
local out_of_sync=$?

Expand Down
2 changes: 1 addition & 1 deletion test/ci-runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function run_tests_for_os {

RUST_LOG=debug cargo run --bin test-manager \
run-tests \
--account "${ACCOUNT_TOKEN}" \
--account "${ACCOUNT_TOKEN:?Error: ACCOUNT_TOKEN not set}" \
--current-app "${cur_filename}" \
--previous-app "${prev_filename}" \
--test-report "$SCRIPT_DIR/.ci-logs/${os}_report" \
Expand Down
4 changes: 2 additions & 2 deletions wireguard/libwg/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for arch in ${ARCHITECTURES:-armv7 aarch64 x86_64 i686}; do
esac

# Build Wireguard-Go
echo "$(pwd)"
pwd
make -f Android.mk clean
make -f Android.mk

Expand All @@ -51,7 +51,7 @@ for arch in ${ARCHITECTURES:-armv7 aarch64 x86_64 i686}; do

# Create the directories with RWX permissions for all users so that the build server can clean
# the directories afterwards
mkdir -m 777 -p "$(dirname "$STRIPPED_LIB_PATH")"
(umask ugo=rwx; mkdir -p "$(dirname "$STRIPPED_LIB_PATH")")

$ANDROID_STRIP_TOOL --strip-unneeded --strip-debug -o "$STRIPPED_LIB_PATH" "$UNSTRIPPED_LIB_PATH"

Expand Down
Loading