refactor: Update CI workflow to use non-sudo apt commands for system … #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci2 | |
on: | |
pull_request: | |
branches: | |
- "main" | |
- "deps/*" | |
paths-ignore: | |
- "LICENSE" | |
- "SECURITY.md" | |
- "makefile" | |
- ".gitingore" | |
#- ".github/workflows/*" | |
push: | |
branches: | |
- "main" | |
- "release/*" | |
- "deps/*" | |
paths-ignore: | |
- "LICENSE" | |
- "SECURITY.md" | |
- "makefile" | |
- ".gitingore" | |
#- ".github/workflows/*" | |
env: | |
PKG_CONFIG_ALLOW_CROSS: 1 | |
PY_SQLX_VERSION: 0.0.1 # change when the run "release - check package version" | |
jobs: | |
rust-test: | |
# ignore because the pyo3 test not working | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: build wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: i686 | |
manylinux: auto | |
args: > | |
--release | |
--out dist | |
--interpreter '3.8 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10' | |
rust-toolchain: stable | |
before-script-linux: | | |
# Detect the Linux distribution | |
if [ -f /etc/os-release ]; then | |
. /etc/os-release | |
DISTRO=$ID | |
else | |
echo "Unable to detect the Linux distribution." | |
exit 1 | |
fi | |
# Install packages based on the detected distro | |
case $DISTRO in | |
arch) | |
echo "Detected Arch Linux" | |
pacman -S pkgconf openssl | |
;; | |
debian|ubuntu) | |
echo "Detected Debian or Ubuntu" | |
apt-get install -y pkg-config libssl-dev | |
;; | |
fedora) | |
echo "Detected Fedora" | |
dnf install -y pkgconf perl-FindBin perl-IPC-Cmd openssl-devel | |
;; | |
alpine) | |
echo "Detected Alpine Linux" | |
apk add pkgconf openssl-dev | |
;; | |
opensuse|suse) | |
echo "Detected openSUSE" | |
zypper install -y libopenssl-devel | |
;; | |
centos) | |
echo "Detected CentOS" | |
yum update -y | |
yum install -y make gcc perl-core pcre-devel wget zlib-devel openssl-devel | |
yum install -y openssl | |
;; | |
*) | |
echo "Unsupported Linux distribution: $DISTRO" | |
exit 1 | |
;; | |
esac | |
echo "Installation complete!" | |
# sccache is not supported on Windows | |
sccache: true | |
docker-options: -e CI |