feat!: make package/app choice explicit #629
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: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.12"] | ||
project-type: ["app", "package"] | ||
name: 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@v4 | ||
with: | ||
python-version: "3.9" | ||
- 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.9", "__docker_image":"radixai/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: 21 | ||
- 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" }} | ||
Check failure on line 61 in .github/workflows/test.yml GitHub Actions / TestInvalid workflow file
|
||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
SOURCE_BRANCH=${{ env.GITHUB_REF }} | ||
SOURCE_COMMIT=${{ env.GITHUB_SHA }} | ||
context: ./my-project/ | ||
target: app |