Skip to content

[CDF-23515] 🤔GraphQL Comment issue #5768

[CDF-23515] 🤔GraphQL Comment issue

[CDF-23515] 🤔GraphQL Comment issue #5768

Workflow file for this run

---
name: Lint and test
on:
pull_request:
env:
PYTHON_VERSION: '3.10'
jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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-no-alpha:
name: Run tests without alpha features
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: false
- name: Install core dependencies
run: poetry install
- name: Turn off alpha features
run: python dev.py alpha --off
- name: Run pytest
env:
IS_GITHUB_ACTIONS: "true"
run: pytest tests/test_unit -n8
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.10"
# Skipping 3.11 as we assume it is covered by 3.10 and 3.12
- "3.12"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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
Build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
name: Toolkit Version
# Read the version from the cognite_toolkit/_version.py file
run: echo "version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' cognite_toolkit/_version.py)" >> $GITHUB_ENV
- name: Build Image
run: |
docker build -t cognite/toolkit:${{ env.version }} -t cognite/toolkit:latest .
- name: Test Image
run: |
docker run -v $(pwd):/app cognite/toolkit:latest cdf modules init my_org --all
- name: Verfiy Created Files
run: |
if [ -d "my_org" ]; then
echo "My org successfully created"
else
echo "My org failed creation"
exit 1
fi
- name: Inspection
run: |
ls -l my_org
ls -l my_org/modules