Enhance workflows and project structure (#248) #235
This file contains hidden or 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
| # ----------------------------------------------------------------------------- | |
| # (C) Crown copyright Met Office. All rights reserved. | |
| # The file LICENCE, distributed with this code, contains details of the terms | |
| # under which the code may be used. | |
| # ----------------------------------------------------------------------------- | |
| name: Python Unit Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - '**.py' | |
| - '.github/workflows/python_unit_tests.yaml' | |
| push: | |
| paths: | |
| - '**.py' | |
| - '.github/workflows/python_unit_tests.yaml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # Required to evaluate the event trigger metadata safely | |
| jobs: | |
| python_unit_tests: | |
| name: python_unit_tests | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up uv with Python | |
| uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| with: | |
| python-version: '3.14' | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --extra test | |
| - name: Test with pytest | |
| run: | | |
| # Setup git for git_bdiff and get_git_sources testing | |
| git config --global user.name 'Testing' | |
| git config --global user.email 'Testing' | |
| uv run pytest -vv |