Skip to content

Update python tests job #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/build/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ LABEL summary="Toolchain for running pre-commit hooks." \
io.k8s.display-name="Pre-Commit Toolchain"

USER root
RUN dnf install nodejs
RUN dnf install nodejs -y && \
dnf clean all && \
rm -rf /var/cache/dnf
ADD https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz $TMPDIR/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if we use ADD here, the Docker will create a separate image layer with tar file. And even if we delete it in the next command it will stay in the image. It will be only hidden by next layer. I would suggest to download tar with oc as part of the RUN command on next line.

RUN tar -C /usr/local/bin -xvf $TMPDIR/oc.tar.gz && \
chmod +x /usr/local/bin/oc && \
rm $TMPDIR/oc.tar.gz
USER $USERID

COPY requirements-dev.txt /tmp/requirements-dev.txt
RUN python -m pip install -r /tmp/requirements-dev.txt
COPY requirements.txt /tmp/requirements.txt
RUN python -m pip install -r /tmp/requirements.txt

CMD bash
6 changes: 0 additions & 6 deletions .github/build/requirements-dev.txt

This file was deleted.

11 changes: 11 additions & 0 deletions .github/build/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
openshift-client==1.0.18
rich==12.5.1
ray[default]==2.1.0
kubernetes==26.1.0
codeflare-torchx==0.6.0.dev0
pre-commit
poetry
pytest
pytest-mock
coverage
black==22.3.0
File renamed without changes.
38 changes: 0 additions & 38 deletions .github/workflows/python-app.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Python Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unit-tests:

runs-on: ubuntu-latest
container:
image: quay.io/project-codeflare/codeflare-sdk-precommit:v0.0.3
steps:
- uses: actions/checkout@v3
- name: Test with pytest and check coverage
run: |
coverage run -m --source=src pytest -v tests/unit_test.py
coverage=$(coverage report -m | tail -1 | tail -c 4 | head -c 2)
if (( $coverage < 90 )); then exit 1; else echo "Coverage passed, ${coverage}%"; fi
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ Can be installed via `pip`: `pip install codeflare-sdk`
### Prerequisites

We recommend using Python 3.9 for development.
Install development specific dependencies:
`$ pip install -r requirements-dev.txt`

Additional dependencies can be found in `requirements.txt`: `$ pip install -r requirements.txt`
Install dependencies: `$ pip install -r requirements.txt`

### Pre-commit

Expand Down
6 changes: 0 additions & 6 deletions requirements-dev.txt

This file was deleted.

6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ rich==12.5.1
ray[default]==2.1.0
kubernetes==26.1.0
codeflare-torchx==0.6.0.dev0
pre-commit
poetry
pytest
pytest-mock
coverage
black==22.3.0