fix: bootstrap python on minimal runners
This commit is contained in:
@@ -17,11 +17,32 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
github-server-url: https://git.halonice.com
|
github-server-url: https://git.halonice.com
|
||||||
|
|
||||||
- name: Check Python runtime
|
- name: Bootstrap Python runtime
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
python3 --version
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
|
py_bin="python3"
|
||||||
|
elif command -v python >/dev/null 2>&1; then
|
||||||
|
py_bin="python"
|
||||||
|
else
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip
|
||||||
|
elif command -v apk >/dev/null 2>&1; then
|
||||||
|
apk add --no-cache python3 py3-pip
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
dnf install -y python3 python3-pip
|
||||||
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
yum install -y python3 python3-pip
|
||||||
|
else
|
||||||
|
echo "python is not available and no supported package manager was found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
py_bin="python3"
|
||||||
|
fi
|
||||||
|
"${py_bin}" --version
|
||||||
|
echo "PYTHON_BIN=${py_bin}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Prepare config
|
- name: Prepare config
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -44,9 +65,10 @@ jobs:
|
|||||||
UPSTREAM_REF: ${{ vars.UPSTREAM_REF }}
|
UPSTREAM_REF: ${{ vars.UPSTREAM_REF }}
|
||||||
run: |
|
run: |
|
||||||
UPSTREAM_REF="${UPSTREAM_REF:-master}"
|
UPSTREAM_REF="${UPSTREAM_REF:-master}"
|
||||||
|
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
||||||
bash tools/sync_surge_full.sh
|
bash tools/sync_surge_full.sh
|
||||||
if [ -f configs/config.toml ]; then
|
if [ -f configs/config.toml ]; then
|
||||||
python3 src/rulegen.py --config configs/config.toml
|
"${PYTHON_BIN}" src/rulegen.py --config configs/config.toml
|
||||||
else
|
else
|
||||||
python3 src/rulegen.py --config configs/config.json
|
"${PYTHON_BIN}" src/rulegen.py --config configs/config.json
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -22,11 +22,32 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
github-server-url: https://git.halonice.com
|
github-server-url: https://git.halonice.com
|
||||||
|
|
||||||
- name: Check Python runtime
|
- name: Bootstrap Python runtime
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
python3 --version
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
|
py_bin="python3"
|
||||||
|
elif command -v python >/dev/null 2>&1; then
|
||||||
|
py_bin="python"
|
||||||
|
else
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip
|
||||||
|
elif command -v apk >/dev/null 2>&1; then
|
||||||
|
apk add --no-cache python3 py3-pip
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
dnf install -y python3 python3-pip
|
||||||
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
|
yum install -y python3 python3-pip
|
||||||
|
else
|
||||||
|
echo "python is not available and no supported package manager was found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
py_bin="python3"
|
||||||
|
fi
|
||||||
|
"${py_bin}" --version
|
||||||
|
echo "PYTHON_BIN=${py_bin}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Prepare config
|
- name: Prepare config
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -50,11 +71,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
UPSTREAM_REF="${UPSTREAM_REF:-master}"
|
UPSTREAM_REF="${UPSTREAM_REF:-master}"
|
||||||
|
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
||||||
bash tools/sync_surge_full.sh
|
bash tools/sync_surge_full.sh
|
||||||
if [ -f configs/config.toml ]; then
|
if [ -f configs/config.toml ]; then
|
||||||
python3 src/rulegen.py --config configs/config.toml
|
"${PYTHON_BIN}" src/rulegen.py --config configs/config.toml
|
||||||
else
|
else
|
||||||
python3 src/rulegen.py --config configs/config.json
|
"${PYTHON_BIN}" src/rulegen.py --config configs/config.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit and push builder updates
|
- name: Commit and push builder updates
|
||||||
|
|||||||
Reference in New Issue
Block a user