Dist abstraction #27
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: CI | |
| # NOTE: This workflow requires an SSH key to access private submodules. | |
| # Generate an SSH key and add it as a deploy key to each submodule repository, | |
| # then add the private key as a secret named 'SUBMODULE_SSH_KEY'. | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| env: | |
| PYTHONPATH: src | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup SSH for submodules | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.CI_SSH_KEY }}" > ~/.ssh/dnet_id_ed25519 | |
| chmod 600 ~/.ssh/dnet_id_ed25519 | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| git config --global core.sshCommand "ssh -i ~/.ssh/dnet_id_ed25519 -o IdentitiesOnly=yes" | |
| - name: Checkout submodules | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| - name: Cleanup SSH key | |
| if: always() | |
| run: | | |
| rm -f ~/.ssh/dnet_id_ed25519 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Sync dev dependencies | |
| run: | | |
| uv sync --all-extras | |
| - name: Ruff format check (style/format) via uvx | |
| run: | | |
| uvx ruff format --check . | |
| - name: Ruff lint via uvx | |
| run: | | |
| uvx ruff check . | |
| - name: Run tests (pytest) via uv | |
| if: runner.os == 'macOS' | |
| run: | | |
| # currently, there are no tests, so we ignore exit code 5 (no tests collected) | |
| uv run pytest || ([ $? -eq 5 ] && echo "No tests collected, continuing..." && exit 0 || exit $?) |