Rewrite training component using kubeflow-training library #515
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: Run pre-commit | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
pre-commit-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 # Needed for HEAD to exists | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pipenv | |
- name: Setup Pipenv | |
uses: tiagovrtr/actions-pipenv@v1 | |
with: | |
pipenv-version: "v2024.1.0" | |
- name: Configure caching | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: precommit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: | | |
pipenv sync | |
- name: Run pre-commit | |
run: | | |
pipenv run pre-commit run --all-files | |
- name: Test if pipeline is up-to-date | |
run: | | |
pipenv run make pipeline | |
git diff --exit-code || (echo "Pipeline is not up-to-date. Please run 'make pipeline' and commit the changes." && exit 1) | |
- name: test if standalone.py was updated and not standalone.tpl (no components file(s) updated) | |
if: "!contains(github.event.pull_request.labels.*.name, 'ignore-standalone-change')" | |
run: | | |
files_changed=$(git diff --name-only HEAD^) | |
echo "Files changed: $files_changed" | |
if [[ $files_changed == *"standalone.py"* && $files_changed != *"standalone.tpl"* && $files_changed != *"components.py"* ]]; then | |
echo "standalone.py was updated but not standalone.tpl." | |
echo "Please update standalone.tpl and run 'make standalone'." | |
exit 1 | |
fi |