Update pre-commit requirement from ~=3.3 to ~=3.4 in /.dev #822
Workflow file for this run
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: CI - Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected) | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools wheel | |
while IFS="" read -r line || [ -n "${line}" ]; do | |
if [[ "${line}" =~ ^pre-commit.*$ ]]; then | |
pre_commit="${line}" | |
fi | |
done < .dev/requirements_dev.txt | |
pip install ${pre_commit} | |
- name: Test with pre-commit | |
run: SKIP=pylint,pylint-tests pre-commit run --all-files | |
pylint-safety: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
pip install -U -r requirements.txt | |
pip install -U -r .dev/requirements_dev.txt | |
pip install safety | |
- name: Run pylint | |
run: pylint --rcfile=.pylintrc --ignore-paths=tests/ --extension-pkg-whitelist='pydantic' *.py app | |
- name: Run pylint - tests | |
run: pylint --rcfile=.pylintrc --extension-pkg-whitelist='pydantic' --disable=C0415,W0621 tests | |
# Ignore ID 44715 for now. | |
# See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038 | |
- name: Run safety | |
run: pip freeze | safety check --stdin --ignore 44715 | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
docker-target: ["development", "production"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build Dockerfile | |
run: | | |
docker build \ | |
-f Dockerfile \ | |
--target ${{ matrix.docker-target }} \ | |
. | |
pytest: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python ${{ matrix.python-version}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version}} | |
- name: Install python dependencies | |
run: | | |
python -m pip install -U pip | |
pip install -U setuptools wheel | |
pip install -r requirements.txt | |
pip install -U -r .dev/requirements_dev.txt | |
- name: Test with pytest | |
run: pytest -vvv --cov-report=xml --cov=app | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == 3.9 && github.repository == 'EMMC-ASBL/oteapi-services' | |
uses: codecov/codecov-action@v3 | |
with: | |
name: oteapi-services | |
files: ./coverage.xml | |
flags: pytest | |
docker-compose: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
docker-target: ["development", "production"] | |
env: | |
PORT: 8123 | |
OTEAPI_prefix: /api/ci/v1 | |
DOCKER_OTEAPI_TARGET: ${{ matrix.docker-target }} | |
LOCAL_OTEAPI_PATH: /tmp/oteapi-core | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build OTEAPI Services Dockerfiles | |
run: | | |
# Need to re-install docker-compose from pip: | |
# https://github.com/docker/compose/issues/7686 | |
sudo apt-get update && sudo pip install docker-compose | |
docker-compose -f docker-compose_dev.yml --verbose -- build | |
docker-compose -f .github/utils/docker-compose_ci_plugins.yml --verbose -- build | |
- name: Start the Docker services | |
run: | | |
docker-compose -f docker-compose_dev.yml --verbose -- up & | |
.github/utils/wait_for_it.sh localhost:${{ env.PORT }} -t 120 | |
sleep 5 | |
curl -X "GET" -i "http://localhost:${{ env.PORT }}${{ env.OTEAPI_prefix }}/session" | |
- name: Clone current requirement version of `oteapi-core` locally | |
run: | | |
REQ_VERSION=$(cat requirements.txt | grep "oteapi-core") | |
git clone --branch v${REQ_VERSION#oteapi-core==} https://github.com/EMMC-ASBL/oteapi-core ${LOCAL_OTEAPI_PATH} | |
- name: Start the Docker services with local `oteapi-core` | |
if: matrix.docker-target == 'development' | |
run: | | |
docker-compose -f docker-compose_dev.yml down | |
docker-compose -f docker-compose_dev.yml --verbose -- up & | |
.github/utils/wait_for_it.sh localhost:${{ env.PORT }} -t 120 | |
# Sleep for longer, since it takes a while to install `oteapi-core` | |
# And the port will be available as soon as the CMD is reached in the Dockerfile. | |
sleep 40 | |
curl -X "GET" -i "http://localhost:${{ env.PORT }}${{ env.OTEAPI_prefix }}/session" | |
env: | |
PATH_TO_OTEAPI_CORE: ${{ env.LOCAL_OTEAPI_PATH }} | |
- name: Start the Docker services with plugins | |
run: | | |
docker-compose -f docker-compose_dev.yml down | |
docker-compose -f .github/utils/docker-compose_ci_plugins.yml --verbose -- up & | |
.github/utils/wait_for_it.sh localhost:${{ env.PORT }} -t 120 | |
# Sleep for longer, since it takes a while to install `oteapi-core` | |
# And the port will be available as soon as the CMD is reached in the Dockerfile. | |
sleep 60 | |
curl -X "GET" -i "http://localhost:${{ env.PORT }}${{ env.OTEAPI_prefix }}/session" | |
env: | |
CONTAINER_PLUGIN_PATH: /special-plugin | |
OTEAPI_PLUGIN_PACKAGES: "-v -e /special-plugin[dev]|oteapi-dlite" | |
LOCAL_TARGET_PLUGIN_PATH: ${{ env.LOCAL_OTEAPI_PATH }} |