diff --git a/.github/workflows/python_checks.yml b/.github/workflows/python_checks.yml index d0bbc5a..1053715 100644 --- a/.github/workflows/python_checks.yml +++ b/.github/workflows/python_checks.yml @@ -41,22 +41,118 @@ on: type: string jobs: + validate: + # Everything as checks but do validation steps first + strategy: + matrix: + include: + - runner: ubuntu-latest + python-version: "3.12" + checks: 'validate' + runs-on: ${{ matrix.runner }} + timeout-minutes: 20 + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout SupportScripts + uses: actions/checkout@v4 + with: + repository: SpiNNakerManchester/SupportScripts + path: support + + - name: Install pip, etc + uses: ./support/actions/python-tools + + - name: Install mypy + run: pip install mypy + + - name: Install Spinnaker Dependencies + uses: ./support/actions/install-spinn-deps + with: + repositories: ${{ inputs.dependencies }} + install: true + + - name: Run Install + uses: ./support/actions/run-install + + - name: Run rat copyright enforcement + uses: ./support/actions/check-copyrights + with: + config_file: rat_asl20.xml + + - name: Build documentation with sphinx + uses: ./support/actions/sphinx + with: + directory: doc/source + + - name: Validate CITATION.cff + uses: dieghernan/cff-validator@main + + - name: Lint with flake8 + run: flake8 ${{ inputs.flake8-packages }} + + - name: Lint with pylint + uses: ./support/actions/pylint + with: + package: ${{ inputs.base-package }} + exitcheck: 31 # Action fails on any message + language: en_GB + rcfile: global_strict + + - name: Lint with mypy + run: mypy ${{ inputs.base-package }} + + - name: Test with pytest + uses: ./support/actions/pytest + with: + tests: ${{ inputs.test_directories }} + coverage: ${{ matrix.coverage == 'coverage' }} + cover-packages: ${{ inputs.base-package }} + coveralls-token: ${{ secrets.GITHUB_TOKEN }} + env: + SPALLOC_USER: ${{ secrets.SPALLOC_USER }} + SPALLOC_PASSWORD: ${{ secrets.SPALLOC_PASSWORD }} + # Tests using ping won't work in Github Actions because of system config + SKIP_PING_TESTS: true + checks: + # Everything as tests but do validation steps first strategy: matrix: include: + # prereleases - runner: ubuntu-24.04 python-version: "3.13" + - runner: ubuntu-latest + python-version: "3.11" + coverage: 'coverage' + + - runner: ubuntu-latest + python-version: "3.10" + + - runner: ubuntu-22.04 + python-version: 3.9 + + - runner: ubuntu-20.04 + python-version: 3.8 runs-on: ${{ matrix.runner }} - timeout-minutes: 5 + timeout-minutes: 20 steps: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + allow-prereleases: ${{ matrix.python-version == 3.13 }} - name: Checkout uses: actions/checkout@v4 @@ -99,7 +195,67 @@ jobs: - name: Test with pytest uses: ./support/actions/pytest with: - tests: ${{ inputs.stest_directories }} + tests: ${{ inputs.test_directories }} coverage: ${{ matrix.coverage == 'coverage' }} cover-packages: ${{ inputs.base-package }} coveralls-token: ${{ secrets.GITHUB_TOKEN }} + env: + SPALLOC_USER: ${{ secrets.SPALLOC_USER }} + SPALLOC_PASSWORD: ${{ secrets.SPALLOC_PASSWORD }} + # Tests using ping won't work in Github Actions because of system config + SKIP_PING_TESTS: true + + tests: + strategy: + matrix: + include: + - runner: windows-latest + python-version: "3.12" + checks: 'tests' + + - runner: windows-2019 + python-version: 3.8 + checks: 'tests' + + - runner: macos-latest + python-version: "3.12" + checks: 'tests' + + - runner: macos-11 + python-version: 3.8 + checks: 'tests' + + runs-on: ${{ matrix.runner }} + timeout-minutes: 20 + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout SupportScripts + uses: actions/checkout@v4 + with: + repository: SpiNNakerManchester/SupportScripts + path: support + + - name: Install Spinnaker Dependencies + uses: ./support/actions/install-spinn-deps + with: + repositories: ${{ inputs.dependencies }} + install: true + + - name: Run Install + uses: ./support/actions/run-install + + - name: Test with pytest + env: + SPALLOC_USER: ${{ secrets.SPALLOC_USER }} + SPALLOC_PASSWORD: ${{ secrets.SPALLOC_PASSWORD }} + # Tests using ping won't work in Github Actions because of system config + SKIP_PING_TESTS: true + run: pytest ${{ inputs.test_directories }} diff --git a/actions/python-tools/action.yml b/actions/python-tools/action.yml index a17c265..0438fdf 100644 --- a/actions/python-tools/action.yml +++ b/actions/python-tools/action.yml @@ -16,6 +16,10 @@ name: "Install Advanced Python Tools" description: > Installs tooling to support advanced Python testing. inputs: + check_tools: + description: Install the checking tools + required: false + default: install pylint-version: description: The version of pylint desired required: false @@ -39,6 +43,7 @@ runs: using: composite steps: - name: Install spell checker + if: ${{ inputs.check_tools == 'install' }} shell: bash run: source $SUPPORT_DIR/setup-spell.bash env: @@ -51,6 +56,7 @@ runs: shell: bash run: python -m pip install pip - name: Install extended Python tooling + if: ${{ inputs.check_tools == 'install'}} shell: bash run: | pip install flake8 "pylint $PYLINT_VERSION" pyenchant