Merge pull request #29 from dreadnode/simone/eng-652-support-user-pro… #148
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: CI | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
validate: | |
name: Validate | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@e78f54a89cb052fff327414dd9ff010b5d2b4dbd | |
- name: Configure Poetry | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Cache dependencies | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | |
with: | |
path: ./.venv | |
key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
venv-${{ runner.os }}-py${{ matrix.python-version }}- | |
- name: Install package | |
run: poetry install --all-extras | |
- name: Validate version | |
run: | | |
POETRY_VERSION=$(poetry version -s) | |
INIT_VERSION=$(python -c "import dreadnode_cli; print(dreadnode_cli.__version__)") | |
if [ "$POETRY_VERSION" != "$INIT_VERSION" ]; then | |
echo "Version mismatch: pyproject.toml ($POETRY_VERSION) != __init__.py ($INIT_VERSION)" | |
exit 1 | |
fi | |
- name: Lint | |
run: poetry run ruff check --output-format=github dreadnode_cli | |
- name: Type check | |
run: poetry run mypy --no-error-summary dreadnode_cli | |
- name: Test | |
run: poetry run pytest dreadnode_cli | |