metadata: simply rely on importlib
#47
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
| name: Test | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -e {0} # -e to fail on error | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.9', '3.13'] | |
| os: [ubuntu-latest, macos-latest] | |
| project_name: [project_name, alt_name] | |
| env: | |
| PROJECT_ROOT: ${{ matrix.project_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Ubuntu system dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python }} | |
| - name: Install Python {{ matrix.python }} | |
| run: | | |
| uv python install --python-preference only-managed ${{ matrix.python }} | |
| - name: Install Python dependencies | |
| run: | | |
| uv pip install cookiecutter pre-commit | |
| - name: Instantiate the template | |
| shell: python | |
| run: | | |
| from cookiecutter.main import cookiecutter | |
| overrides = dict(project_name='${{ matrix.project_name }}') | |
| cookiecutter('.', no_input=True, extra_context=overrides) | |
| - name: Set up pre-commit cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-3|${{ matrix.python }}|${{ hashFiles(format('{0}/.pre-commit-config.yaml', env.PROJECT_ROOT)) }} | |
| - name: Run pre-commit | |
| continue-on-error: true | |
| run: | | |
| cd "$PROJECT_ROOT" | |
| git add . | |
| pre-commit run --color=always --show-diff-on-failure --all-files | |
| - name: Install project as a package | |
| run: | | |
| cd "$PROJECT_ROOT" | |
| uv pip install -e .[dev,tests,docs] | |
| - name: Build documentation | |
| env: | |
| SPHINXOPTS: -W --keep-going | |
| run: | | |
| cd "$PROJECT_ROOT" | |
| uv run make html --directory docs/ |