Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
isinyaaa committed Oct 2, 2024
1 parent 5ecf0da commit ef911ce
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-image-pr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Test container image build and deployment
on:
workflow_dispatch:
pull_request:
paths-ignore:
- "LICENSE*"
Expand Down Expand Up @@ -42,8 +43,6 @@ jobs:
run: |
kind load docker-image -n chart-testing ${IMG}
- name: Setup kustomize
env:
IMG: "${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}"
run: |
echo "Download kustomize 5.2.1"
mkdir $GITHUB_WORKSPACE/kustomize
Expand Down
129 changes: 102 additions & 27 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "main"
workflow_dispatch:
pull_request:
paths-ignore:
- "LICENSE*"
Expand All @@ -13,25 +14,69 @@ on:
- ".github/dependabot.yml"
- "docs/**"
jobs:
tests:
lint:
name: ${{ matrix.session }} ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.12"]
session: [lint, tests, mypy, docs-build]
include:
- python: "3.9"
session: tests
- python: "3.10"
session: tests
- python: "3.11"
session: tests
session: [lint, mypy]
env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Upgrade pip in virtual environments
shell: python
run: |
import os
import pip
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
# use absolute path as recommended with: https://github.com/pypa/pipx/issues/1331
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Nox lint
working-directory: clients/python
run: |
if [[ ${{ matrix.session }} == "mypy" ]]; then
nox --python=${{ matrix.python }} ||\
echo "::error title='mypy failure'::Check the logs for more details"
else
nox --python=${{ matrix.python }}
fi
test:
name: Test Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.12", "3.11", "3.10", "3.9"]
session: [tests]
env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
IMG_ORG: kubeflow
IMG_REPO: model-registry
steps:
- name: Check out the repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -62,21 +107,18 @@ jobs:
pipx inject --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Generate Tag
if: matrix.session == 'tests'
shell: bash
id: tags
run: |
commit_sha=${{ github.event.after }}
tag=main-${commit_sha:0:7}
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Build Image
if: matrix.session == 'tests'
shell: bash
env:
VERSION: ${{ steps.tags.outputs.tag }}
run: make image/build
- name: Start Kind Cluster
if: matrix.session == 'tests'
uses: helm/kind-action@v1.10.0
with:
node_image: "kindest/node:v1.27.11"
Expand All @@ -87,7 +129,6 @@ jobs:
run: |
kind load docker-image -n chart-testing ${IMG}
- name: Setup kustomize
if: matrix.session == 'tests'
env:
IMG: "${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}"
run: |
Expand All @@ -98,31 +139,65 @@ jobs:
echo "Display Kustomize version"
kustomize version
- name: Deploy Model Registry using manifests
if: matrix.session == 'tests'
env:
IMG: "${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}"
run: ./scripts/deploy_on_kind.sh
- name: Nox test
working-directory: clients/python
run: |
nox --python=${{ matrix.python }} -- --cov-report=xml
docs-build:
name: ${{ matrix.session }} ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.12"]
session: [docs-build]
env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Upgrade pip in virtual environments
shell: python
run: |
import os
import pip
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
# use absolute path as recommended with: https://github.com/pypa/pipx/issues/1331
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Run Nox
working-directory: clients/python
run: |
if [[ ${{ matrix.session }} == "tests" ]]; then
make deploy-mr
nox --python=${{ matrix.python }} -- --cov-report=xml
poetry build
elif [[ ${{ matrix.session }} == "mypy" ]]; then
nox --python=${{ matrix.python }} ||\
echo "::error title='mypy failure'::Check the logs for more details"
else
nox --python=${{ matrix.python }}
fi
nox --python=${{ matrix.python }}
poetry build
- name: Upload dist
if: matrix.session == 'tests' && matrix.python == '3.12'
uses: actions/upload-artifact@v4
with:
name: py-dist
path: clients/python/dist
- name: Upload documentation
if: matrix.session == 'docs-build'
uses: actions/upload-artifact@v4
with:
name: py-docs
Expand Down

0 comments on commit ef911ce

Please sign in to comment.