Skip to content

Commit

Permalink
ci: fix build and deploy (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
toondaey authored Aug 30, 2024
1 parent 097fbc9 commit 89cd804
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
30 changes: 7 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ on:
branches: [ master ]

jobs:
test:
uses: ./.github/workflows/test_and_build.yml
secrets: inherit

build:
runs-on: ubuntu-latest
environment: CD

needs:
- build

steps:
- uses: actions/checkout@v4

Expand All @@ -24,29 +31,6 @@ jobs:
poetry lock
poetry install
- name: Check codestyle
run: pre-commit run --all

- name: Run tests
env:
COGNITE_CLIENT_ID: ${{ secrets.COGNITE_PROJECT_CLIENT_ID }}
COGNITE_CLIENT_SECRET: ${{ secrets.COGNITE_PROJECT_CLIENT_SECRET }}
COGNITE_TOKEN_SCOPES: ${{ secrets.COGNITE_PROJECT_SCOPES }}
COGNITE_TOKEN_URL: ${{ secrets.COGNITE_PROJECT_TOKEN_URL }}
COGNITE_PROJECT: extractor-tests
COGNITE_BASE_URL: https://greenfield.cognitedata.com
KEYVAULT_CLIENT_ID: ${{ secrets.KEYVAULT_CLIENT_ID }}
KEYVAULT_TENANT_ID: ${{ secrets.KEYVAULT_TENANT_ID }}
KEYVAULT_CLIENT_SECRET: ${{ secrets.KEYVAULT_CLIENT_SECRET }}
run: |
coverage run --source cognite.extractorutils -m pytest -v tests
coverage xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

- name: Build package
run: poetry build

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: test_and_build
on:
pull_request:
branches: [ master ]
workflow_call:

jobs:
build:
Expand Down
12 changes: 11 additions & 1 deletion tests/tests_integration/test_file_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
from cognite.client import CogniteClient
from cognite.client.data_classes import FileMetadata
from cognite.client.data_classes.data_modeling import NodeId
from cognite.client.data_classes.data_modeling.extractor_extensions.v1 import CogniteExtractorFileApply
from cognite.client.data_classes.data_modeling.extractor_extensions.v1 import (
CogniteExtractorFile,
CogniteExtractorFileApply,
)
from cognite.extractorutils.uploader.files import BytesUploadQueue, FileUploadQueue, IOFileUploadQueue
from tests.conftest import ETestType, ParamTest

Expand Down Expand Up @@ -106,6 +109,9 @@ def test_file_upload_queue(set_upload_test: Tuple[CogniteClient, ParamTest], fun
external_id=test_parameter.external_ids[8],
name=test_parameter.external_ids[8],
space=test_parameter.space,
extracted_data={"testing": "abc", "untested": "ced"},
directory="mydirectory",
mime_type="application/json",
),
file_name=current_dir.joinpath("empty_file.txt"),
)
Expand All @@ -131,6 +137,10 @@ def test_file_upload_queue(set_upload_test: Tuple[CogniteClient, ParamTest], fun

assert file4 == b"test content\n"
assert file5 == b"other test content\n"
node = client.data_modeling.instances.retrieve_nodes(
NodeId(test_parameter.space, test_parameter.external_ids[8]), node_cls=CogniteExtractorFile
)
assert isinstance(node, CogniteExtractorFile)
assert file6 is not None and file6.instance_id is not None and file6.instance_id.space == test_parameter.space


Expand Down

0 comments on commit 89cd804

Please sign in to comment.