Skip to content

[pre-commit.ci] pre-commit autoupdate (#228) #655

[pre-commit.ci] pre-commit autoupdate (#228)

[pre-commit.ci] pre-commit autoupdate (#228) #655

Workflow file for this run

name: CI - Tests
on:
pull_request:
push:
branches:
- 'master'
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected)
jobs:
basic:
name: External
uses: SINTEF/ci-cd/.github/workflows/ci_tests.yml@v2.8.0
with:
# General settings
install_extras: "[dev]"
run_build_docs: false
# pre-commit
run_pre-commit: true
python_version_pre-commit: "3.9"
run_pylint: false
run_safety: true
# Ignore ID 44715 for now.
# See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038
# ID: 70612
# Package: Jinja2
# Has been disputed by the maintainer and multiple third parties.
# For more information see: https://github.com/advisories/GHSA-f6pv-j8mr-w6rr
safety_options: |
--ignore=44715
--ignore=70612
# Build package
run_build_package: true
python_version_package: "3.9"
build_libs: flit
build_cmd: flit build
pytest:
name: pytest (${{ matrix.os[1] }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os[0] }}
strategy:
fail-fast: false
matrix:
os:
- ["ubuntu-latest", "linux"]
- ["windows-latest", "windows"]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version}}
- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
- name: Test with pytest
run: pytest -vvv --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'EMMC-ASBL/otelib'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: ${{ matrix.os[1] }}
pytest-real-backend:
runs-on: ubuntu-latest
name: pytest-real backend
env:
PORT: 8080
OTEAPI_prefix: "/api/v1"
services:
redis:
image: redis:latest
volumes:
- redis-persist:/data
ports:
- "6379:6379"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
- name: Run OTE server
run: |
docker pull ghcr.io/emmc-asbl/oteapi:${DOCKER_OTEAPI_VERSION}
docker run \
--env "OTEAPI_REDIS_TYPE=redis" \
--env "OTEAPI_REDIS_HOST=localhost" \
--env "OTEAPI_REDIS_PORT=6379" \
--env "OTEAPI_prefix=${OTEAPI_prefix}" \
--network "host" \
ghcr.io/emmc-asbl/oteapi:${DOCKER_OTEAPI_VERSION} &
.github/utils/wait_for_it.sh localhost:${PORT} -t 240
sleep 5
env:
DOCKER_OTEAPI_VERSION: latest
- name: Test with pytest
run: pytest -vvv
env:
OTELIB_TEST_OTE_SERVER_URL: "http://localhost:${{ env.PORT }}"