Auto-update all templates #2
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: Auto-update all templates | |
on: | |
workflow_call: | |
inputs: | |
os: | |
description: 'OS' | |
type: string | |
required: true | |
python-version: | |
description: 'Python version' | |
type: string | |
required: true | |
workflow_dispatch: | |
inputs: | |
os: | |
description: 'OS' | |
type: choice | |
options: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
- ubuntu-dind-runners | |
required: false | |
default: 'ubuntu-latest' | |
python-version: | |
description: 'Python version' | |
type: choice | |
options: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
required: false | |
default: '3.8' | |
jobs: | |
update-e2e-batch-template-to-examples: | |
name: update-e2e-batch-template-to-examples | |
runs-on: ${{ inputs.os }} | |
env: | |
ZENML_DEBUG: 1 | |
ZENML_ANALYTICS_OPT_IN: false | |
PYTHONIOENCODING: "utf-8" | |
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES" | |
if: github.event_name == 'pull_request' && ! startsWith(github.event.head_commit.message, 'GitBook:') | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Run template tests for zenml-io/template-e2e-batch | |
uses: zenml-io/template-e2e-batch/.github/actions/e2e_template_test@main | |
with: | |
python-version: ${{ inputs.python-version }} | |
stack-name: local | |
ref-zenml: ${{ github.ref }} | |
ref-template: '2023.12.12' # Make sure it is aligned with ZENML_PROJECT_TEMPLATES from src/zenml/cli/base.py | |
- name: Clean-up | |
run: | | |
rm -rf ./local_checkout | |
- name: message-on-error | |
if: failure() | |
run: | | |
echo "::error title=zenml-io/template-e2e-batch project template testing failed with new version of ZenML core!::\ | |
Breaking changes affecting templates have been introduced. To mitigate this issue,\ | |
please make the code in zenml-io/template-e2e-batch compatible with new version of\ | |
ZenML core, release it and update release tag in zenml.cli.base.ZENML_PROJECT_TEMPLATES" | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Check-out fresh E2E template | |
run: | | |
rm -rf examples/e2e | |
mkdir -p examples/e2e | |
printf '[email protected]' | zenml init --path examples/e2e --template e2e_batch --template-with-defaults | |
bash scripts/format.sh | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --quiet "origin/${{ github.event.pull_request.head.ref }}"; then | |
echo "No active Git changes found." | |
echo "changes=false" >> $GITHUB_OUTPUT | |
else | |
echo "Active Git changes found." | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push template | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add . | |
git commit -am "Auto-update of E2E template" | |
git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
- name: Create PR comment | |
if: steps.check_changes.outputs.changes == 'true' | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: ${{ github.event.pull_request.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'E2E template updates in `examples/e2e` have been pushed.' | |
}) | |
update-nlp-template-to-examples: | |
name: update-nlp-template-to-examples | |
runs-on: ${{ inputs.os }} | |
env: | |
ZENML_DEBUG: 1 | |
ZENML_ANALYTICS_OPT_IN: false | |
PYTHONIOENCODING: "utf-8" | |
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES" | |
if: github.event_name == 'pull_request' && ! startsWith(github.event.head_commit.message, 'GitBook:') | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Run template tests for zenml-io/template-nlp | |
uses: zenml-io/template-nlp/.github/actions/nlp_template_test@main | |
with: | |
python-version: ${{ inputs.python-version }} | |
stack-name: local | |
ref-zenml: ${{ github.ref }} | |
ref-template: '0.45.0' # Make sure it is aligned with ZENML_PROJECT_TEMPLATES from src/zenml/cli/base.py | |
- name: Clean-up | |
run: | | |
rm -rf ./local_checkout | |
- name: message-on-error | |
if: failure() | |
run: | | |
echo "::error title=zenml-io/template-nlp project template testing failed with new version of ZenML core!::\ | |
Breaking changes affecting templates have been introduced. To mitigate this issue,\ | |
please make the code in zenml-io/template-nlp compatible with new version of\ | |
ZenML core, release it and update release tag in zenml.cli.base.ZENML_PROJECT_TEMPLATES" | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Check-out fresh NLP template | |
run: | | |
mkdir -p examples/e2e_nlp | |
printf '[email protected]' | zenml init --path examples/e2e_nlp --template nlp --template-with-defaults | |
bash scripts/format.sh | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --quiet "origin/${{ github.event.pull_request.head.ref }}"; then | |
echo "No active Git changes found." | |
echo "changes=false" >> $GITHUB_OUTPUT | |
else | |
echo "Active Git changes found." | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push template | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add . | |
git commit -am "Auto-update of NLP template" | |
git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
- name: Create PR comment | |
if: steps.check_changes.outputs.changes == 'true' | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: ${{ github.event.pull_request.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'NLP template updates in `examples/e2e_nlp` have been pushed.' | |
}) | |
update-starter-template-to-examples: | |
name: update-starter-template-to-examples | |
runs-on: ${{ inputs.os }} | |
env: | |
ZENML_DEBUG: 1 | |
ZENML_ANALYTICS_OPT_IN: false | |
PYTHONIOENCODING: "utf-8" | |
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES" | |
if: github.event_name == 'pull_request' && ! startsWith(github.event.head_commit.message, 'GitBook:') | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Run template tests for zenml-io/template-starter | |
uses: zenml-io/template-starter/.github/actions/starter_template_test@main | |
with: | |
python-version: ${{ inputs.python-version }} | |
stack-name: local | |
ref-zenml: ${{ github.ref }} | |
ref-template: '2023.12.18' # Make sure it is aligned with ZENML_PROJECT_TEMPLATES from src/zenml/cli/base.py | |
- name: Clean-up | |
run: | | |
rm -rf ./local_checkout | |
- name: message-on-error | |
if: failure() | |
run: | | |
echo "::error title=zenml-io/template-starter project template testing failed with new version of | |
ZenML core!::\ | |
Breaking changes affecting templates have been introduced. To mitigate this issue,\ | |
please make the code in zenml-io/template-starter compatible with new version of\ | |
ZenML core, release it and update release tag in zenml.cli.base.ZENML_PROJECT_TEMPLATES" | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Check-out fresh Starter template | |
run: | | |
rm -rf examples/quickstart | |
mkdir -p examples/quickstart | |
printf '[email protected]' | zenml init --path examples/quickstart --template starter --template-with-defaults | |
bash scripts/format.sh | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --quiet "origin/${{ github.event.pull_request.head.ref }}"; then | |
echo "No active Git changes found." | |
echo "changes=false" >> $GITHUB_OUTPUT | |
else | |
echo "Active Git changes found." | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and push template | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add . | |
git commit -am "Auto-update of Starter template" | |
git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
- name: Create PR comment | |
if: steps.check_changes.outputs.changes == 'true' | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: ${{ github.event.pull_request.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Quickstart template updates in `examples/quickstart` have been pushed.' | |
}) |