fix: relock before cz bump #756
Workflow file for this run
This file contains 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: | |
- main | |
pull_request: | |
jobs: | |
test-copier: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
project-type: ["app", "package"] | |
typing: ["optional", "strict"] | |
name: "Copier: Python ${{ matrix.python-version }} ${{ matrix.project-type }} with ${{ matrix.typing }} typing" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: substrate | |
- name: Set up uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "**/uv.lock" | |
- name: Scaffold Python project | |
run: | | |
uvx copier copy substrate my-project \ | |
--defaults \ | |
--data project_type="${{ matrix.project-type }}" \ | |
--data project_name="My Project" \ | |
--data project_description="A Python ${{ matrix.project-type }} that reticulates splines." \ | |
--data project_url="https://github.com/user/repo" \ | |
--data author_name="John Smith" \ | |
--data author_email="[email protected]" \ | |
--data python_version="3.10" \ | |
--data typing="${{ matrix.typing }}" \ | |
--data with_fastapi_api=true \ | |
--data with_typer_cli=true | |
cd my-project | |
git config --global init.defaultBranch main | |
git init | |
git checkout -b test | |
git add . | |
- name: Lint and test project | |
uses: devcontainers/[email protected] | |
with: | |
subFolder: ./my-project/ | |
runCmd: | | |
uv lock | |
poe lint | |
poe test | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
- name: Build app Docker image | |
if: ${{ matrix.project-type == 'app' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./my-project/ | |
target: app | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
test-cookiecutter: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10", "3.13"] | |
project-type: ["app", "package"] | |
name: "Cookiecutter: Python ${{ matrix.python-version }} ${{ matrix.project-type }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: template | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Scaffold Python project | |
run: | | |
pip install --no-input cruft | |
cruft create --no-input --extra-context '{"project_type": "${{ matrix.project-type }}", "project_name": "My Project", "python_version": "3.10", "__docker_image":"superlinear/python-gpu:$PYTHON_VERSION-cuda11.8", "with_fastapi_api": "1", "with_typer_cli": "1"}' ./template/ | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 23 | |
- name: Install @devcontainers/cli | |
run: npm install --location=global @devcontainers/[email protected] | |
- name: Start Dev Container with Python ${{ matrix.python-version }} | |
run: | | |
git config --global init.defaultBranch main | |
git init | |
git checkout -b test | |
git add . | |
PYTHON_VERSION=${{ matrix.python-version }} devcontainer up --workspace-folder . | |
working-directory: ./my-project/ | |
- name: Lint project | |
run: devcontainer exec --workspace-folder my-project poe lint | |
- name: Test project | |
run: devcontainer exec --workspace-folder my-project poe test | |
- name: Build app Docker image | |
if: ${{ matrix.project-type == 'app' }} | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
SOURCE_BRANCH=${{ env.GITHUB_REF }} | |
SOURCE_COMMIT=${{ env.GITHUB_SHA }} | |
context: ./my-project/ | |
target: app |