Add mypy checks #11
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: Docker-based Python Package CI | |
# Trigger the workflow on push to master or dev branches | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
# Step 1: Checkout the repository | |
- uses: actions/checkout@v3 | |
# Step 2: Set up Docker Buildx (optional) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Step 3: Build the Docker image | |
- name: Build Docker image | |
run: | | |
docker build --build-arg PYTHON_VERSION=${{ matrix.python-version }} -t cvdm-package:${{ matrix.python-version }} . | |
# Step 4: Run the container and execute tests using pytest | |
- name: Test with pytest | |
run: | | |
docker run --rm cvdm-package:${{ matrix.python-version }} pytest | |
# Step 5: Run the container and execute tests using mypy | |
- name: Test with mypy | |
run: | | |
docker run --rm cvdm-package:${{ matrix.python-version }} mypy . |