[CDF-22565] 🫵Build Selected Option #4411
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: Lint and test | |
on: | |
pull_request: | |
env: | |
PYTHON_VERSION: '3.9' | |
jobs: | |
lint: | |
name: Run linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: false | |
- name: Install dependencies and run lints | |
run: | | |
# Necessary for running the mypy pre-commit hook | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Linting and static code checks | |
continue-on-error: true | |
id: pre-commit-first-run | |
uses: pre-commit/action@v3.0.1 | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: auto-commit-action | |
with: | |
create_branch: false | |
commit_message: Linting and static code checks | |
# If the first run failed, run the checks again to ensure that the changes fixed the issue. | |
- name: Linting and static code checks try 2 | |
if: steps.pre-commit-first-run.outcome != 'success' | |
uses: pre-commit/action@v3.0.1 | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
environment: dev | |
env: | |
CDF_CLUSTER: ${{ secrets.CDF_CLUSTER }} | |
CDF_PROJECT: ${{ secrets.CDF_PROJECT }} | |
IDP_CLIENT_ID: ${{ secrets.IDP_CLIENT_ID }} | |
IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET }} | |
IDP_TOKEN_URL: ${{ secrets.IDP_TOKEN_URL }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.9" | |
# Skipping 3.10 and 3.11 as we assume it is covered by 3.9 and 3.12 | |
- "3.12" | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: false | |
- name: Install core dependencies | |
run: | | |
poetry install | |
- name: Run pytest | |
env: | |
IS_GITHUB_ACTIONS: "true" | |
run: pytest tests/test_unit -n8 | |
coverage: | |
name: Create coverage report | |
runs-on: ubuntu-latest | |
environment: dev | |
env: | |
CDF_CLUSTER: ${{ secrets.CDF_CLUSTER }} | |
CDF_PROJECT: ${{ secrets.CDF_PROJECT }} | |
IDP_CLIENT_ID: ${{ secrets.IDP_CLIENT_ID }} | |
IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET }} | |
IDP_TOKEN_URL: ${{ secrets.IDP_TOKEN_URL }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: false | |
- name: Install core dependencies | |
run: | | |
poetry install | |
- name: Create test coverage report | |
env: | |
IS_GITHUB_ACTIONS: "true" | |
run: pytest --cov=cognite_toolkit/ --cov-config=pyproject.toml --cov-report=xml:coverage.xml tests/ -n8 | |
- name: Push coverage report to PR | |
uses: orgoro/coverage@v3.2 | |
with: | |
coverageFile: coverage.xml | |
thresholdAll: 0.6 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
dry-run-demo: | |
runs-on: ubuntu-latest | |
environment: dev | |
env: | |
CDF_CLUSTER: ${{ secrets.CDF_CLUSTER }} | |
CDF_PROJECT: ${{ secrets.CDF_PROJECT }} | |
IDP_CLIENT_ID: ${{ secrets.IDP_CLIENT_ID }} | |
IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET }} | |
IDP_TOKEN_URL: ${{ secrets.IDP_TOKEN_URL }} | |
LOGIN_FLOW: client_credentials | |
name: Dry Run Demo | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: false | |
- name: Install dependencies and build the package | |
run: | | |
poetry install | |
poetry build | |
- name: Install cdf-tk | |
run: pip install . | |
- name: "Not collect metrics" | |
run: cdf collect opt-out | |
- name: Initialize project | |
run: cdf modules init demo_project --clean --all | |
- name: "Pre-processing for demo environment" | |
run: python ./demo/preproc.py --modules all | |
- name: "Build the templates" | |
run: cdf build --build-dir=./build --env=demo -o ./demo_project | |
- name: "Verify and create access rights" | |
run: cdf auth verify --no-prompt | |
- name: "Test clean --dry-run" | |
run: | | |
cdf clean --env=demo ./build --dry-run | |
- name: "Deploy the templates --dry-run" | |
run: | | |
cdf deploy --drop --env=demo ./build --dry-run |