Some checks failed
CI / test (push) Failing after 5s
Co-authored-by: Copilot <copilot@github.com>
94 lines
2.5 KiB
YAML
94 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Ensure git is available
|
|
run: |
|
|
if command -v git >/dev/null 2>&1; then
|
|
git --version
|
|
exit 0
|
|
fi
|
|
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
apt-get update
|
|
apt-get install -y git
|
|
elif command -v dnf >/dev/null 2>&1; then
|
|
dnf install -y git
|
|
elif command -v yum >/dev/null 2>&1; then
|
|
yum install -y git
|
|
else
|
|
echo "No supported package manager found to install git."
|
|
exit 1
|
|
fi
|
|
|
|
git --version
|
|
|
|
- name: Checkout source (native git)
|
|
env:
|
|
CI_GIT_TOKEN: ${{ secrets.CI_GIT_TOKEN }}
|
|
run: |
|
|
if [ -z "${CI_GIT_TOKEN:-}" ]; then
|
|
echo "Missing secret CI_GIT_TOKEN. Add it in repository Actions secrets."
|
|
exit 1
|
|
fi
|
|
|
|
auth_server="${GITHUB_SERVER_URL#https://}"
|
|
auth_server="${auth_server#http://}"
|
|
remote_url="https://oauth2:${CI_GIT_TOKEN}@${auth_server}/${GITHUB_REPOSITORY}.git"
|
|
|
|
if [ -n "${GITHUB_WORKSPACE:-}" ]; then
|
|
cd "$GITHUB_WORKSPACE"
|
|
fi
|
|
|
|
if [ ! -d .git ]; then
|
|
git init
|
|
fi
|
|
|
|
git remote remove origin >/dev/null 2>&1 || true
|
|
git remote add origin "$remote_url"
|
|
|
|
git fetch --depth 1 origin "$GITHUB_SHA"
|
|
git checkout --force FETCH_HEAD
|
|
|
|
- name: Ensure Python and pip are available
|
|
run: |
|
|
if command -v python3 >/dev/null 2>&1 && python3 -m pip --version >/dev/null 2>&1; then
|
|
python3 --version
|
|
exit 0
|
|
fi
|
|
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
apt-get update
|
|
apt-get install -y python3 python3-pip python3-venv
|
|
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 "No supported package manager found to install Python."
|
|
exit 1
|
|
fi
|
|
|
|
python3 --version
|
|
|
|
- name: Install package and dev dependencies
|
|
run: |
|
|
python3 -m pip install --upgrade pip
|
|
python3 -m pip install -e .[dev]
|
|
|
|
- name: Lint
|
|
run: python3 -m ruff check .
|
|
|
|
- name: Type-check
|
|
run: python3 -m mypy src
|
|
|
|
- name: Test
|
|
run: python3 -m pytest
|