Skip to content

Change the matrix to exclude stuff entirely #1

Change the matrix to exclude stuff entirely

Change the matrix to exclude stuff entirely #1

Workflow file for this run

# This runs jobs which pyiron modules should run on pushes or PRs to main
# Usage:
# on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
name: Push or Pull to main
on:
workflow_call:
inputs:
docs-env-files:
type: string
description: 'Paths to an arbitrary number of (space-separated) conda environment yaml files'
default: .ci_support/environment.yml
required: false
notebooks-env-files:
type: string
description: 'Paths to an arbitrary number of (space-separated) conda environment yaml files'
default: .ci_support/environment.yml
required: false
notebooks-exclusion-file:
type: string
description: 'An optional path to a file containing the names of notebooks to NOT build'
default: .ci_support/exclude
required: false
tests-env-files:
type: string
description: 'Paths to an arbitrary number of (space-separated) conda environment yaml files'
default: .ci_support/environment.yml
required: false
benchmark-timeout-minutes:
type: number
description: 'How many minutes to allow tests in units/benchmark to run for'
default: 30
required: false
tests-in-python-path:
type: boolean
description: 'Whether to add the canonical test dirs (tests/( ,benchmark,integration,unit)) to the PYTHONPATH. This is a required workaround for repos that use `pympipool` executors, [cf. this issue](https://github.com/pyiron/pympipool/issues/239).'
default: false
required: false
runner:
type: string
description: 'The main runner to use everywhere'
default: 'ubuntu-latest'
required: false
runner-alt1:
type: string
description: 'An alternate runner for the unit tests (only on the main python version). Set to the string exclude to skip'
default: 'windows-latest'
required: false
runner-alt2:
type: string
description: 'Another alternate runner for the unit tests (only on the main python version). Set to the string exclude to skip'
default: 'macos-latest'
required: false
python-version:
type: string
description: 'The main version of python to test on, used across all three OS for tests and in other steps'
default: '3.11'
required: false
python-version-alt1:
type: string
description: 'An alternate version of python to run unit tests on, used only on the main runner. Set to the string exclude to skip'
default: '3.10'
required: false
python-version-alt2:
type: string
description: 'An alternate version of python to run unit tests on, used only on the main runner. Set to the string exclude to skip'
default: '3.9'
required: false
jobs:
commit-updated-env: # Keep envs read by external sources (binder and readthedocs) up-to-date
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- uses: pyiron/actions/write-docs-env@main
- uses: pyiron/actions/write-environment@main
with:
env-files: ${{ inputs.notebooks-env-files }}
output-env-file: .binder/environment.yml
- name: commit
id: commit-docs-env
continue-on-error: true # Allow "failure" when there are no changes (the working tree is clean)
run: |
git config --local user.email "pyiron@mpie.de"
git config --local user.name "pyiron-runner"
git add docs/environment.yml .binder/environment.yml
git commit -m "[dependabot skip] Update env file" -a
- name: push
if: steps.commit-docs-env.outcome == 'success' # But only push if we made it here without continue-on-error
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }}
branch: ${{ github.event.pull_request.head.ref }}
build-docs:
needs: commit-updated-env
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- uses: pyiron/actions/build-docs@main
with:
python-version: ${{ inputs.python-version }}
env-prefix: /usr/share/miniconda3/envs/my-env
env-label: ${{ inputs.runner }}-py-main
env-files: ${{ inputs.docs-env-files }}
build-notebooks:
needs: commit-updated-env
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- uses: pyiron/actions/build-notebooks@main
with:
python-version: ${{ inputs.python-version }}
env-prefix: /usr/share/miniconda3/envs/my-env
env-label: ${{ inputs.runner }}-py-main
env-files: ${{ inputs.notebooks-env-files }}
exclusion-file: ${{ inputs.notebooks-exclusion-file }}
unit-tests:
needs: commit-updated-env
runs-on: ${{ matrix.operating-system }}
# All three runners for the highest python version
# Only the main for up to two more versions of python
strategy:

Check failure on line 136 in .github/workflows/push-pull-main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/push-pull-main.yml

Invalid workflow file

You have an error in your yaml syntax on line 136
operating-system: [${{ inputs.runner }}, ${{ inputs.runner-alt1 }}, ${{ inputs.runner-alt2 }}]
python-version: [${{ inputs.python-version }}, ${{ inputs.python-version-alt1 }}, ${{ inputs.python-version-alt2 }}]
exclude:
# Get rid of all combinations of alternative runners and alternative python versions
- operating-system: ${{ inputs.runner-alt1 }}
python-version: ${{ inputs.python-version-alt1 }}
- operating-system: ${{ inputs.runner-alt1 }}
python-version: ${{ inputs.python-version-alt2 }}
- operating-system: ${{ inputs.runner-alt2 }}
python-version: ${{ inputs.python-version-alt1 }}
- operating-system: ${{ inputs.runner-alt2 }}
python-version: ${{ inputs.python-version-alt2 }}
# Don't run anything tagged with "exclude"
- operating-system: 'exclude'
- python-version: 'exclude'
steps:
- uses: actions/checkout@v3
- uses: pyiron/actions/add-to-python-path@main
if: ${{ inputs.tests-in-python-path }}
with:
path-dirs: tests tests/benchmark tests/integration tests/unit
- name: replace-dot
run: |
PYVERSION=${{ matrix.python-version }}
echo "PYVERSION=${PYVERSION/\./-}" >> $GITHUB_ENV
- uses: pyiron/actions/unit-tests@main
with:
python-version: ${{ matrix.python-version }}
env-prefix: ${{ contains('macos', matrix.operating-system) && '/Users/runner/miniconda3/envs/my-env' || contains('windows', matrix.operating-system) && 'C:\Miniconda3\envs\my-env' || contains('ubuntu', matrix.operating-system) && '/usr/share/miniconda3/envs/my-env }}
env-label: ${{ matrix.operating-system }}-py-${{ PYVERSION }}
env-files: ${{ inputs.tests-env-files }}
test-dir: tests/unit
coveralls-and-codacy:
needs: commit-updated-env
uses: pyiron/actions/.github/workflows/tests-and-coverage.yml@flexible_matrix
secrets: inherit
with:
tests-env-files: ${{ inputs.tests-env-files }}
tests-in-python-path: ${{ inputs.tests-in-python-path }}
runner: ${{ inputs.runner }}
python-version: ${{ inputs.python-version }}
benchmark-tests:
needs: commit-updated-env
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- uses: pyiron/actions/unit-tests@main
with:
python-version: ${{ inputs.python-version }}
env-prefix: /usr/share/miniconda3/envs/my-env
env-label: ${{ inputs.runner }}-py-main
env-files: ${{ inputs.tests-env-files }}
test-dir: tests/benchmark
timeout-minutes: ${{ inputs.benchmark-timeout-minutes }}
pip-check:
needs: commit-updated-env
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- uses: pyiron/actions/pip-check@main
with:
python-version: ${{ inputs.python-version }}
env-prefix: /usr/share/miniconda3/envs/my-env
env-label: ${{ inputs.runner }}-py-main
black:
needs: commit-updated-env
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --diff"
src: ./${{ github.event.repository.name }}