Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Wiki
Commits
c5b27a3e
Commit
c5b27a3e
authored
1 year ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
Front matter linter
parent
c275a95b
No related branches found
No related tags found
1 merge request
!122
Front matter linter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+23
-18
23 additions, 18 deletions
.gitlab-ci.yml
packages/df-wiki-cli/df_wiki_cli/content/main.py
+4
-2
4 additions, 2 deletions
packages/df-wiki-cli/df_wiki_cli/content/main.py
with
27 additions
and
20 deletions
.gitlab-ci.yml
+
23
−
18
View file @
c5b27a3e
...
@@ -4,6 +4,11 @@ workflow:
...
@@ -4,6 +4,11 @@ workflow:
when
:
never
when
:
never
-
when
:
always
-
when
:
always
# Functions that should be executed before the build script is run
# Functions that should be executed before the build script is run
variables
:
variables
:
...
@@ -15,6 +20,8 @@ variables:
...
@@ -15,6 +20,8 @@ variables:
# prod
# prod
HOST_PROD
:
'
defense-finder.pasteur.cloud'
HOST_PROD
:
'
defense-finder.pasteur.cloud'
MEILI_HOST_PROD
:
'
defense-finder-meilisearch.pasteur.cloud'
MEILI_HOST_PROD
:
'
defense-finder-meilisearch.pasteur.cloud'
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/.cache/pip"
cache
:
cache
:
...
@@ -44,9 +51,17 @@ stages:
...
@@ -44,9 +51,17 @@ stages:
# Build df-wiki-cli package
# Build df-wiki-cli package
.df-wiki-cli-run
:
image
:
python:3.11-bullseye
cache
:
# Pip's cache doesn't store the python packages
paths
:
# https://pip.pypa.io/en/stable/topics/caching/
-
.cache/pip
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
build:df-wiki-cli
:
build:df-wiki-cli
:
stage
:
build-df-cli
image
:
python:3.11-bullseye
image
:
python:3.11-bullseye
stage
:
build-df-cli
before_script
:
before_script
:
-
cd packages/df-wiki-cli/
-
cd packages/df-wiki-cli/
-
pip install poetry
-
pip install poetry
...
@@ -165,13 +180,11 @@ delete-meili-helm-release:prod:
...
@@ -165,13 +180,11 @@ delete-meili-helm-release:prod:
# lint
# lint
lint
:
lint
:
image
:
python:3.11-bullseye
extends
:
.df-wiki-cli-run
stage
:
lint
stage
:
lint
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
-
cd content/3.defense-systems
script
:
script
:
-
find . -name '*.md' -print0 | xargs -0 -I {} df-wiki-cli content lint --file {}
-
cd content/3.defense-systems
-
find . -name '*.md' ! -name '0.index.md' -print0 | xargs -0 -I {} df-wiki-cli content lint --file {}
when
:
manual
when
:
manual
rules
:
rules
:
-
if
:
$CI_COMMIT_BRANCH != "main"
-
if
:
$CI_COMMIT_BRANCH != "main"
...
@@ -179,12 +192,10 @@ lint:
...
@@ -179,12 +192,10 @@ lint:
# Update Meili search indexes
# Update Meili search indexes
.update-meilisearch-index
:
.update-meilisearch-index
:
extends
:
.df-wiki-cli-run
stage
:
update-meilisearch-indexes
stage
:
update-meilisearch-indexes
image
:
python:3.11-bullseye
variables
:
variables
:
MEILI_HOST
:
"
http://localhost:7700"
MEILI_HOST
:
"
http://localhost:7700"
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
script
:
script
:
-
>
-
>
df-wiki-cli
df-wiki-cli
...
@@ -225,12 +236,10 @@ update-meilisearch-index:prod:
...
@@ -225,12 +236,10 @@ update-meilisearch-index:prod:
############# get-meili-key ###############
############# get-meili-key ###############
.set-meili-env
:
.set-meili-env
:
image
:
python:3.11-bullseye
extends
:
.df-wiki-cli-run
stage
:
get-meili-key
stage
:
get-meili-key
variables
:
variables
:
MEILI_HOST
:
"
http://localhost:7700"
MEILI_HOST
:
"
http://localhost:7700"
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
script
:
script
:
-
>
-
>
df-wiki-cli
df-wiki-cli
...
@@ -262,10 +271,8 @@ set-meili-env:prod:
...
@@ -262,10 +271,8 @@ set-meili-env:prod:
##############################
##############################
get-zotero
:
get-zotero
:
image
:
python:3.11-bullseye
extends
:
.df-wiki-cli-run
stage
:
get-data
stage
:
get-data
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
script
:
script
:
-
df-wiki-cli articles --key ${ZOTERO_API_KEY} --output public/articles.json
-
df-wiki-cli articles --key ${ZOTERO_API_KEY} --output public/articles.json
artifacts
:
artifacts
:
...
@@ -275,10 +282,8 @@ get-zotero:
...
@@ -275,10 +282,8 @@ get-zotero:
-
if
:
$CI_COMMIT_BRANCH == "main"
-
if
:
$CI_COMMIT_BRANCH == "main"
get-pfam
:
get-pfam
:
image
:
python:3.11-bullseye
extends
:
.df-wiki-cli-run
stage
:
get-data
stage
:
get-data
before_script
:
-
pip install df-wiki-cli --index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.pasteur.fr/api/v4/projects/5222/packages/pypi/simple
script
:
script
:
-
df-wiki-cli pfam --output public/pfam-a-hmm.csv
-
df-wiki-cli pfam --output public/pfam-a-hmm.csv
artifacts
:
artifacts
:
...
...
This diff is collapsed.
Click to expand it.
packages/df-wiki-cli/df_wiki_cli/content/main.py
+
4
−
2
View file @
c5b27a3e
import
typer
import
typer
import
sys
from
typing_extensions
import
Annotated
from
typing_extensions
import
Annotated
from
typing
import
Optional
,
List
from
typing
import
Optional
,
List
from
pathlib
import
Path
from
pathlib
import
Path
from
pydantic
import
BaseModel
,
ValidationError
from
pydantic
import
BaseModel
,
ValidationError
from
pydantic_yaml
import
parse_yaml_raw_as
,
to_yaml_str
import
frontmatter
import
frontmatter
from
enum
import
Enum
from
enum
import
Enum
from
rich.console
import
Console
from
rich.console
import
Console
...
@@ -70,7 +70,9 @@ def lint(
...
@@ -70,7 +70,9 @@ def lint(
# pprint(exc.errors(), expand_all=True)
# pprint(exc.errors(), expand_all=True)
for
err
in
exc
.
errors
():
for
err
in
exc
.
errors
():
console
.
print
(
console
.
print
(
f
"
[red]
{
err
[
'
msg
'
]
}
:
{
err
[
'
type
'
]
}
{
'
->
'
.
join
(
err
[
'
loc
'
])
}
"
f
"
[red]
{
err
[
'
msg
'
]
}
:
{
err
[
'
type
'
]
}
{
'
->
'
.
join
(
[
str
(
l
)
for
l
in
err
[
'
loc
'
]
]
)
}
"
)
)
# raise
sys
.
exit
(
1
)
else
:
else
:
console
.
print
(
"
[green] Everything is alright
"
)
console
.
print
(
"
[green] Everything is alright
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment