Skip to content

Commit 01f1a29

Browse files
committed
Use env bash and set strict shell options
Make shell usage explicit in CI and harden scripts for portability and safety. The workflow now sets shell: bash and calls scripts with bash; script shebangs were changed to #!/usr/bin/env bash and strict options (set -euo pipefail) were enabled. Minor fixes: ensure script invocations use bash and add missing trailing newlines. Affected files: .github/workflows/build-python.yml, android/build-all.sh, android/package-for-dart.sh, darwin/package-ios-for-dart.sh, darwin/package-macos-for-dart.sh, linux/package-for-linux.sh.
1 parent 0956883 commit 01f1a29

File tree

6 files changed

+28
-22
lines changed

6 files changed

+28
-22
lines changed

.github/workflows/build-python.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232

3333
- name: Build Python for iOS and macOS
3434
working-directory: darwin
35+
shell: bash
3536
run: |
3637
git clone --branch="$PYTHON_VERSION_SHORT" https://github.com/beeware/Python-Apple-support.git
3738
mkdir -p dist
@@ -42,8 +43,8 @@ jobs:
4243
make macOS
4344
popd
4445
45-
./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
46-
./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
46+
bash ./package-ios-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
47+
bash ./package-macos-for-dart.sh Python-Apple-support "$PYTHON_VERSION_SHORT"
4748
4849
- name: Upload Darwin build artifacts
4950
uses: actions/upload-artifact@v4
@@ -64,13 +65,14 @@ jobs:
6465
python-version: ${{ env.PYTHON_VERSION }}
6566
- run: python --version
6667
- working-directory: android
68+
shell: bash
6769
run: |
68-
./build-all.sh "$PYTHON_VERSION"
70+
bash ./build-all.sh "$PYTHON_VERSION"
6971
mkdir -p dist
7072
tar -czf dist/python-android-mobile-forge-$PYTHON_VERSION_SHORT.tar.gz install support
71-
./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a
72-
./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a
73-
./package-for-dart.sh install "$PYTHON_VERSION" x86_64
73+
bash ./package-for-dart.sh install "$PYTHON_VERSION" arm64-v8a
74+
bash ./package-for-dart.sh install "$PYTHON_VERSION" armeabi-v7a
75+
bash ./package-for-dart.sh install "$PYTHON_VERSION" x86_64
7476
- uses: actions/upload-artifact@v4
7577
with:
7678
name: python-android
@@ -85,9 +87,10 @@ jobs:
8587
steps:
8688
- uses: actions/checkout@v4
8789
- working-directory: linux
90+
shell: bash
8891
run: |
89-
./package-for-linux.sh x86_64 "_v2"
90-
./package-for-linux.sh aarch64 ""
92+
bash ./package-for-linux.sh x86_64 "_v2"
93+
bash ./package-for-linux.sh aarch64 ""
9194
- uses: actions/upload-artifact@v4
9295
with:
9396
name: python-linux

android/build-all.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#!/bin/bash
2-
set -eu
1+
#!/usr/bin/env bash
2+
set -euo pipefail
33

44
python_version=${1:?}
55
abis="arm64-v8a armeabi-v7a x86_64 x86"
66

77
for abi in $abis; do
8-
./build.sh $python_version $abi
9-
done
8+
bash ./build.sh $python_version $abi
9+
done

android/package-for-dart.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/bin/bash
2-
set -eu
1+
#!/usr/bin/env bash
2+
set -euo pipefail
33

44
install_root=${1:?}
55
python_version=${2:?}
@@ -65,4 +65,4 @@ done
6565
rm -rf $build_dir/lib
6666

6767
# final archive
68-
tar -czf dist/python-android-dart-$python_version_short-$abi.tar.gz -C $build_dir .
68+
tar -czf dist/python-android-dart-$python_version_short-$abi.tar.gz -C $build_dir .

darwin/package-ios-for-dart.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/bin/bash
2-
set -eu
1+
#!/usr/bin/env bash
2+
set -euo pipefail
33

44
python_apple_support_root=${1:?}
55
python_version=${2:?}
@@ -72,4 +72,4 @@ rm -rf **/__pycache__
7272
cd -
7373

7474
# final archive
75-
tar -czf dist/python-ios-dart-$python_version_short.tar.gz -C $build_dir .
75+
tar -czf dist/python-ios-dart-$python_version_short.tar.gz -C $build_dir .

darwin/package-macos-for-dart.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/bin/bash
2-
set -eu
1+
#!/usr/bin/env bash
2+
set -euo pipefail
33

44
python_apple_support_root=${1:?}
55
python_version=${2:?}
@@ -43,4 +43,4 @@ rm -rf **/__pycache__
4343
cd -
4444

4545
# final archive
46-
tar -czf dist/python-macos-dart-$python_version.tar.gz -C $build_dir .
46+
tar -czf dist/python-macos-dart-$python_version.tar.gz -C $build_dir .

linux/package-for-linux.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
14
PYTHON_ARCH=${1:?}
25
PYTHON_ARCH_VER=${2:-""}
36

@@ -14,4 +17,4 @@ mkdir -p $PYTHON_ARCH/dist
1417
rsync -av --exclude-from=python-linux-dart.exclude $PYTHON_ARCH/build/python/* $PYTHON_ARCH/dist
1518

1619
# archive
17-
tar -czf python-linux-dart-$PYTHON_VERSION_SHORT-$PYTHON_ARCH.tar.gz -C $PYTHON_ARCH/dist .
20+
tar -czf python-linux-dart-$PYTHON_VERSION_SHORT-$PYTHON_ARCH.tar.gz -C $PYTHON_ARCH/dist .

0 commit comments

Comments
 (0)