-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitlab app poc #2
Merged
Merged
Changes from 250 commits
Commits
Show all changes
391 commits
Select commit
Hold shift + click to select a range
855a4fc
version bumpp
yairsimantov20 9ece944
idea files
yairsimantov20 dd9df57
idea files
yairsimantov20 46097b4
remove dstore
yairsimantov20 25071ad
fixing the request middleware
yairsimantov20 da4df10
more logs and exceptions
yairsimantov20 0bfbb31
readme updates & renaming port_ocean file to ocean.py
yairsimantov20 b41c2c9
fixed linting
yairsimantov20 86d1ba7
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 b050522
revert changes in ocean
yairsimantov20 58e6c99
readme updates
yairsimantov20 0c7fd22
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 c0b1246
using the logger
yairsimantov20 b97c242
better logs
yairsimantov20 8d9a673
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 dcc4db8
improved README.md
yairsimantov20 ecc9c0d
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 f398129
better logs
yairsimantov20 bd35e22
ignoring pydantic FutureWarning
yairsimantov20 5538385
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 baafb48
fixed bugs in the gitlab app logic
yairsimantov20 74f6b9e
fixed some implementations
yairsimantov20 e939d9a
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 3b270ef
moved some exceptions
yairsimantov20 4cad95f
moved some exceptions
yairsimantov20 490c125
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 8a75986
Merge remote-tracking branch 'origin/gitlab-app-POC' into gitlab-app-POC
yairsimantov20 6e6563d
checking for diff in the integration before initializing
yairsimantov20 c53e23c
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 d8005c6
svg to png
yairsimantov20 b5b8489
some readme and git ignore improvements
yairsimantov20 4e12126
Added OceanLogo.svg
yairsimantov20 5cae31d
fixed logo
yairsimantov20 de98204
fixed logo
yairsimantov20 4849231
fixed logo
yairsimantov20 e5e7927
Prerequisites
yairsimantov20 1007bc7
version command
yairsimantov20 1e27ae8
version command
yairsimantov20 89be610
cli improved cli help
yairsimantov20 c12223b
existing gracefully on kafka error
yairsimantov20 fd38a5b
removing secret.yaml from the settings config
yairsimantov20 2d376ac
using python gitignore
yairsimantov20 9bc536c
using python gitignore
yairsimantov20 022063c
port base url default value
yairsimantov20 997dae0
lint fixes
yairsimantov20 d419f39
moved provider patterns to consts
yairsimantov20 8048297
seperated port client.py
yairsimantov20 10260be
using consts for status codes
yairsimantov20 8b982aa
passing integration type to the port client for the user agent
yairsimantov20 2b39bb8
added integration type to the kafka consumer
yairsimantov20 2afb347
using rich console for printing
yairsimantov20 bb627bf
cli test changes
yairsimantov20 46fa6de
removed Shell:= from the make file
yairsimantov20 a218369
updated base url
yairsimantov20 e6f40c5
fixed sail command
yairsimantov20 4b0937c
fixed black version for python
yairsimantov20 11319d2
getting kafka credentials more safely
yairsimantov20 e5e5758
base config cosmetic changes
yairsimantov20 01350b5
cosmetic changes
yairsimantov20 a03fa97
cosmetic changes
yairsimantov20 77f4c33
cosmetic changes
yairsimantov20 a7f4203
cosmetic changes
yairsimantov20 65e1740
cosmetic changes
yairsimantov20 3e180fc
fixed imports
yairsimantov20 a0093f1
validating the result with pydantic
yairsimantov20 21d1ff8
fixed typo
yairsimantov20 9d0763c
cosmetics
yairsimantov20 8af245b
cosmetics
yairsimantov20 a9d2eea
removed unused error handling
yairsimantov20 dbb1f3b
renaming
yairsimantov20 acaab4d
removed idea file
yairsimantov20 8e77f19
fixed the type
yairsimantov20 b6199ab
using get time for validating the token instead of datetime
yairsimantov20 f0eba0f
better status code validation
yairsimantov20 1680de3
getting delete_dependent_entities from options better
yairsimantov20 aa3345c
better status code handling
yairsimantov20 d2b9bb0
better status code handling
yairsimantov20 2956e6a
cosmetics
yairsimantov20 3da7a5c
cosmetics
yairsimantov20 5efbd3a
cosmetics
yairsimantov20 9358c02
fixed usage of options
yairsimantov20 fdba889
logger updates
yairsimantov20 97c846e
better contributing part for the README.md
yairsimantov20 1645d71
gave http event a name
yairsimantov20 bc010b3
noramalized the event types
yairsimantov20 a359060
noramalized the event types
yairsimantov20 7011ad4
renaming
yairsimantov20 e0d5908
revert change
yairsimantov20 0aadfc3
better intro
yairsimantov20 c31605c
better README.md
yairsimantov20 a2ba148
CONTRIBUTING.md
yairsimantov20 eef6a36
better README.md
yairsimantov20 ca1f390
unpacking iterator instead of array
yairsimantov20 5cd8deb
renaming
yairsimantov20 217dad4
removed actions for now from the code
yairsimantov20 45f1446
fixed get uniqueu logic
yairsimantov20 fa0b1e6
strip logo
yairsimantov20 6021e53
better cookiecutter comments
yairsimantov20 609d597
better cookiecutter comments
yairsimantov20 7d97f43
better cookiecutter comments
yairsimantov20 f88b5e0
returning trigger channel instead of holding it in the factory.py
yairsimantov20 d75ec7f
fixed typing
yairsimantov20 8a6a007
fixed import
yairsimantov20 99b17ae
made the load providers function more readable
yairsimantov20 e1952eb
cosmetic changes
yairsimantov20 a3c61f0
cosmetic changes
yairsimantov20 e839ad4
cosmetic changes
yairsimantov20 d2f7f9b
cosmetic changes
yairsimantov20 11a7f03
cosmetic changes
yairsimantov20 fa477e7
cosmetic changes
yairsimantov20 ba6bedf
cosmetic changes
yairsimantov20 52eea5e
cosmetic changes
yairsimantov20 da1e876
better gitignore
yairsimantov20 02430cb
better gitignore
yairsimantov20 2adde96
better gitignore
yairsimantov20 320a793
better gitignore
yairsimantov20 00d8d2a
cosmetic changes
yairsimantov20 8d44fce
cosmetic changes
yairsimantov20 ae4d026
debug py
yairsimantov20 1c93a50
sample trigger channel
yairsimantov20 77d1556
dockerfile and spec.yaml
yairsimantov20 d819fad
dockerfile and spec.yaml
yairsimantov20 5d8922b
release integration workflow
yairsimantov20 c742e10
fixed make file poetry installation
yairsimantov20 c6818c8
fixed make file poetry installation
yairsimantov20 69101a0
Merge branch 'POC' of github.com:port-labs/port-ocean into gitlab-app…
yairsimantov20 3aa961b
fixed make file poetry installation
yairsimantov20 2051a31
fixed make file poetry installation
yairsimantov20 4302f29
fixed make file poetry installation
yairsimantov20 6b16fcc
check diff for the integration type when patching
yairsimantov20 b856462
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 8828581
fixed sample trigger_channel.py
yairsimantov20 9640050
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 992c9a2
log for sample trigger channel
yairsimantov20 76bc135
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 ef95c96
consumer_poll_timeout configuration
yairsimantov20 cc35e78
improved syntax for getting the provider data
yairsimantov20 4fe4faf
unpacking configuration into kafka consumer config
yairsimantov20 4321a8c
removed requests package
yairsimantov20 f52e707
adding config yamlto the cookie cutter
yairsimantov20 c097225
pyproject.toml metadata
yairsimantov20 5af1669
more text in CONTRIBUTING.md
yairsimantov20 718363c
a start of a CHANGELOG.md
yairsimantov20 804eb7c
implemented towncrier
yairsimantov20 08f9397
implemented towncrier
yairsimantov20 12ac91d
transport class renaming
yairsimantov20 0f80339
fixed README.md folder structure
yairsimantov20 28816b8
fixed the repo name in the list and pull commands.py
yairsimantov20 d25c399
removed runs from the consumer
yairsimantov20 841c451
manipulation -> entity processor renaming
yairsimantov20 f21825b
improved imports
yairsimantov20 12e8b34
handling abort errors
yairsimantov20 318c93b
renaming
yairsimantov20 1de69ab
Merge branch 'POC' of github.com:port-labs/port-ocean into PORT-4223-…
yairsimantov20 601766f
added consumer_poll_timeout
yairsimantov20 c56e08b
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 cc6f65b
corrected according the class renaming
yairsimantov20 b380dec
updated spec yaml
yairsimantov20 3b4d41a
reusing asyncClient instance
yairsimantov20 f9bb37e
Merge branch 'POC' of github.com:port-labs/port-ocean into PORT-4223-…
yairsimantov20 65e3a45
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 0d4aabe
fixed spec typing
yairsimantov20 193b1e8
added license and updated the version
yairsimantov20 1227e24
Merge branch 'main' of github.com:port-labs/Port-Ocean into PORT-4223…
yairsimantov20 0ddc084
removed previous files
yairsimantov20 fcec669
fixed docstrings
yairsimantov20 9e2490e
getting the current integration in the client instead of passing the …
yairsimantov20 666f038
removed unused parameters on `repeat_every`
yairsimantov20 278e727
removed duplication of the http trigger
yairsimantov20 e0a10f0
Merge branch 'PORT-4223-Add-sampling-trigger-channel-to-ocean' of git…
yairsimantov20 9ccc25b
infra updates
yairsimantov20 1e9af2a
removed irrelevant todo
yairsimantov20 e59aef4
removed extra whitespaces
yairsimantov20 b8f4ce7
readme fixes
yairsimantov20 14317ad
merge conflicts
yairsimantov20 cf2a34b
reverted deletion for utils.py
yairsimantov20 8d8b3de
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 b7147c4
fixed readme file structure
yairsimantov20 ceca5c7
renamed the gitlab app to gitlab
yairsimantov20 3afd3f9
fixed imports
yairsimantov20 d8fdba1
initializing defaults
yairsimantov20 bd78656
Merge branch 'PORT-4250-Add-default-blueprint-and-mapping-for-integra…
yairsimantov20 cd1cf45
corrected parameter name
yairsimantov20 34f1261
added debug.py
yairsimantov20 b0aef8c
gitlab app default blueprints and port app config
yairsimantov20 4cc70d1
Added a py.typed file so that mypy will know to use our type annotati…
yairsimantov20 3a182ec
Merge branch 'PORT-4254-Support-port-ocean-in-mypy' of github.com:por…
yairsimantov20 50b96ed
removed unused variable
yairsimantov20 3ebf5f5
updated make file
yairsimantov20 dc2ecc3
removed uneeded fields
yairsimantov20 a2b1537
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 9db06ff
removed merge conflict file
yairsimantov20 026ccc9
removed merge conflict file
yairsimantov20 322ddf0
updated files according to main
yairsimantov20 7378392
renamed the folder
yairsimantov20 3fa7ab2
modified according to changes in main
yairsimantov20 6af1e61
casting the port_app_config on the push hook to get the right configu…
yairsimantov20 139ab8a
merged files
yairsimantov20 8dba19c
switched to generator from list
yairsimantov20 1b259e1
renaming and moved some files
yairsimantov20 5c814f2
updated the packages
yairsimantov20 d9e3c3b
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 84e2bff
updated the Dockerfile
yairsimantov20 c25bfc3
Update pyproject.toml
yairsimantov20 e3dfea8
Update pyproject.toml
yairsimantov20 2102203
More documentation for the gitlab
yairsimantov20 14d22f0
unified kinds
yairsimantov20 c15b083
removed required true from blueprints.json
yairsimantov20 b03d6e1
kind documentation
yairsimantov20 3f364bb
spec bump
yairsimantov20 0c4692b
fixed object kind
yairsimantov20 e7c95ed
fixed object kind
yairsimantov20 c330e9e
fixed the workflow
yairsimantov20 f9ad713
added the extras
yairsimantov20 da30c3a
bumped spec
yairsimantov20 a012cb6
updated ocean
yairsimantov20 1d87c72
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 82de021
bumped version
yairsimantov20 9995fb8
passing the body directly
yairsimantov20 f9a14ea
removed the scope model
yairsimantov20 85dbf17
removed hook context
yairsimantov20 705b9be
reordered functions
yairsimantov20 f9f4cea
creating all services once on startup
yairsimantov20 ae4a95d
todo
yairsimantov20 a54637a
gitlab fixes
yairsimantov20 2def65e
fixed lint
yairsimantov20 d5aa96e
fixed lint
yairsimantov20 c7d96c5
addressed non async integration logic performance
yairsimantov20 f36aceb
default in the spec file
yairsimantov20 448279d
fixed lint
yairsimantov20 e72a45a
changelog fragments
yairsimantov20 5c8a4a3
Merge branch 'PORT-4294-Ocean-fixes' of github.com:port-labs/Port-Oce…
yairsimantov20 1482a3e
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 3c49033
Fixed cookiecutter and added helm chart installation example
danielsinai fc56f3c
Merge branch 'gitlab-app-POC' of https://github.com/port-labs/port-oc…
danielsinai ece0f4b
fixed gitops implementation
yairsimantov20 9110918
Merge branch 'gitlab-app-POC' of https://github.com/port-labs/port-oc…
danielsinai ce69a6d
updated version
yairsimantov20 aa53fdb
Merge branch 'gitlab-app-POC' of github.com:port-labs/Port-Ocean into…
yairsimantov20 269ed79
updated the readme
yairsimantov20 e4d57b6
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 b3709b9
cr requests
yairsimantov20 b449e3e
updated blueprints.json
yairsimantov20 6f4753e
added __project to gitlab pipeline
yairsimantov20 c3d2309
fixed schema
yairsimantov20 ab9f865
bump
yairsimantov20 9077632
bump
yairsimantov20 cebb840
bump ocean 0.1.0
yairsimantov20 f3e6479
gitlab integration first version
yairsimantov20 e7ad43b
Merge branch 'main' of github.com:port-labs/Port-Ocean into gitlab-ap…
yairsimantov20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.vscode/ | ||
assets/ | ||
*.md | ||
.git | ||
.gitignore | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
[ | ||
{ | ||
"identifier": "microservice", | ||
"title": "Microservice", | ||
"icon": "Service", | ||
"schema": { | ||
"properties": { | ||
"url": { | ||
"title": "URL", | ||
"format": "url", | ||
"type": "string" | ||
}, | ||
"description": { | ||
"title": "Description", | ||
"type": "string" | ||
}, | ||
"namespace": { | ||
"title": "Namespace", | ||
"type": "string" | ||
}, | ||
"full_path": { | ||
"title": "Full Path", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"identifier": "mergeRequest", | ||
"title": "Merge Request", | ||
"icon": "GitVersion", | ||
"schema": { | ||
"properties": { | ||
"creator": { | ||
"title": "Creator", | ||
"type": "string" | ||
}, | ||
"status": { | ||
"title": "Status", | ||
"type": "string", | ||
"enum": [ | ||
"opened", | ||
"closed", | ||
"merged", | ||
"locked" | ||
], | ||
"enumColors": { | ||
"opened": "yellow", | ||
"closed": "red", | ||
"merged": "green", | ||
"locked": "blue" | ||
} | ||
}, | ||
"createdAt": { | ||
"title": "Create At", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"updatedAt": { | ||
"title": "Updated At", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"description": { | ||
"title": "Description", | ||
"type": "string", | ||
"format": "markdown" | ||
}, | ||
"link": { | ||
"title": "Link", | ||
"format": "url", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"relations": { | ||
"microservice": { | ||
"target": "microservice", | ||
"required": true, | ||
yairsimantov20 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"many": false | ||
} | ||
} | ||
}, | ||
{ | ||
"identifier": "issue", | ||
"title": "Issue", | ||
"icon": "GitLab", | ||
"schema": { | ||
"properties": { | ||
"link": { | ||
"title": "Link", | ||
"type": "string", | ||
"format": "url" | ||
}, | ||
"description": { | ||
"title": "Description", | ||
"type": "string", | ||
"format": "markdown" | ||
}, | ||
"createdAt": { | ||
"title": "Created At", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"closedAt": { | ||
"title": "Closed At", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"updatedAt": { | ||
"title": "Updated At", | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"creator": { | ||
"title": "Creator", | ||
"type": "string" | ||
}, | ||
"status": { | ||
"title": "Status", | ||
"type": "string", | ||
"enum": [ | ||
"opened", | ||
"closed" | ||
], | ||
"enumColors": { | ||
"opened": "green", | ||
"closed": "purple" | ||
} | ||
}, | ||
"labels": { | ||
"title": "Labels", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"relations": { | ||
"microservice": { | ||
"target": "microservice", | ||
"required": true, | ||
"many": false | ||
} | ||
} | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
resources: | ||
- kind: project | ||
selector: | ||
query: 'true' | ||
port: | ||
entity: | ||
mappings: | ||
identifier: .path_with_namespace | gsub(" "; "") | ||
title: .name | ||
blueprint: '"microservice"' | ||
properties: | ||
url: .web_link | ||
description: .description | ||
namespace: .namespace.name | ||
full_path: .namespace.full_path | ||
- kind: mergeRequest | ||
selector: | ||
query: 'true' | ||
port: | ||
entity: | ||
mappings: | ||
identifier: .id | tostring | ||
title: .title | ||
blueprint: '"mergeRequest"' | ||
properties: | ||
creator: .author.name | ||
status: .state | ||
createdAt: .created_at | ||
updatedAt: .updated_at | ||
description: .description | ||
link: .web_url | ||
relations: | ||
microservice: .references.full | ||
- kind: issues | ||
selector: | ||
query: 'true' | ||
port: | ||
entity: | ||
mappings: | ||
identifier: .id | tostring | ||
title: .title | ||
blueprint: '"issue"' | ||
properties: | ||
creator: .author.name | ||
status: .state | ||
createdAt: .created_at | ||
closedAt: .closed_at | ||
updatedAt: .updated_at | ||
description: .description | ||
link: .web_url | ||
labels: '[.labels[]]' | ||
object: . | ||
relations: | ||
microservice: .references.full |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: v0.1.0dev3 | ||
type: gitlab | ||
description: Gitlab integration for Port Ocean | ||
icon: GitLab | ||
features: | ||
- type: gitops | ||
section: GitOps | ||
- type: exporter | ||
section: Git Providers | ||
resources: | ||
- kind: projects | ||
configurations: | ||
- name: tokenMapping | ||
required: true | ||
type: object | ||
description: "Mapping of Gitlab tokens to Port Ocean tokens. example: {\"THE_GROUP_TOKEN\":[\"getport-labs/**\", \"GROUP/PROJECT PATTERN TO RUN FOR\"]}" | ||
sensitive: true | ||
- name: appHost | ||
yairsimantov20 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
required: true | ||
type: url | ||
description: The host of the Port Ocean app. Used for setting up the webhooks against the Gitlab. | ||
- name: gitlabHost | ||
required: false | ||
type: url | ||
default: https://gitlab.com | ||
description: The host of the Gitlab instance. If not specified, the default will be https://gitlab.com. | ||
ingressRequired: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM python:3.11-slim-buster | ||
|
||
ENV LIBRDKAFKA_VERSION 1.9.2 | ||
|
||
WORKDIR /app | ||
|
||
RUN apt update && apt install -y wget make g++ libssl-dev autoconf automake libtool curl | ||
RUN wget https://github.com/edenhill/librdkafka/archive/v${LIBRDKAFKA_VERSION}.tar.gz && \ | ||
tar xvzf v${LIBRDKAFKA_VERSION}.tar.gz && \ | ||
(cd librdkafka-${LIBRDKAFKA_VERSION}/ && ./configure && make && make install && ldconfig) | ||
|
||
COPY . /app | ||
|
||
RUN make install | ||
|
||
ENTRYPOINT make 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
ACTIVATE := . .venv/bin/activate | ||
|
||
define run_checks | ||
exit_code=0; \ | ||
cd $1; \ | ||
poetry check || exit_code=$$?;\ | ||
poetry lock --check || exit_code=$$?;\ | ||
mypy . || exit_code=$$?; \ | ||
ruff . || exit_code=$$?; \ | ||
black --check . || exit_code=$$?; \ | ||
if [ $$exit_code -eq 1 ]; then \ | ||
echo "\033[0;31mOne or more checks failed with exit code $$exit_code\033[0m"; \ | ||
else \ | ||
echo "\033[0;32mAll checks executed successfully.\033[0m"; \ | ||
fi; \ | ||
exit $$exit_code | ||
endef | ||
|
||
define install_poetry | ||
if ! command -v poetry &> /dev/null; then \ | ||
pip install --upgrade pip; \ | ||
pip install poetry; \ | ||
else \ | ||
echo "Poetry is already installed."; \ | ||
fi | ||
endef | ||
|
||
define deactivate_virtualenv | ||
if [ -n "$$VIRTUAL_ENV" ]; then \ | ||
unset VIRTUAL_ENV; \ | ||
unset PYTHONHOME; \ | ||
unset -f pydoc >/dev/null 2>&1; \ | ||
OLD_PATH="$$PATH"; \ | ||
PATH=$$(echo -n "$$PATH" | awk -v RS=: -v ORS=: '/\/virtualenv\/bin$$/ {next} {print}'); \ | ||
export PATH; \ | ||
hash -r; \ | ||
echo "Deactivated the virtual environment."; \ | ||
fi | ||
endef | ||
|
||
.SILENT: install lint run test clean | ||
|
||
install: | ||
$(call deactivate_virtualenv) && \ | ||
$(call install_poetry) && \ | ||
poetry install --with dev | ||
|
||
lint: | ||
$(ACTIVATE) && \ | ||
$(call run_checks,.) | ||
|
||
run: | ||
$(ACTIVATE) && ocean sail | ||
|
||
test: lint | ||
$(ACTIVATE) && poetry run pytest | ||
|
||
clean: | ||
@find . -name '.venv' -type d -exec rm -rf {} \; | ||
@find . -name '*.pyc' -exec rm -rf {} \; | ||
@find . -name '__pycache__' -exec rm -rf {} \; | ||
@find . -name 'Thumbs.db' -exec rm -rf {} \; | ||
@find . -name '*~' -exec rm -rf {} \; | ||
rm -rf .cache | ||
rm -rf build | ||
rm -rf dist | ||
rm -rf *.egg-info | ||
rm -rf htmlcov | ||
rm -rf .tox/ | ||
rm -rf docs/_build | ||
rm -rf dist/ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any required ?