File tree Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Checking if current tag matches the package version
4
+ current_tag=$( echo $GITHUB_REF | cut -d ' /' -f 3 | sed -r ' s/^v//' )
5
+ file_tag=$( grep ' __version__ =' meilisearch/version.py | cut -d ' =' -f 2- | tr -d ' ' | tr -d ' "' | tr -d ' ,' )
6
+ if [ " $current_tag " != " $file_tag " ]; then
7
+ echo " Error: the current tag does not match the version in package file(s)."
8
+ echo " $current_tag vs $file_tag "
9
+ exit 1
10
+ fi
11
+
12
+ echo ' OK'
13
+ exit 0
Original file line number Diff line number Diff line change 13
13
- name : Set up Docker Buildx
14
14
uses : docker/setup-buildx-action@v2
15
15
16
+ - name : Check release validity
17
+ run : sh .github/scripts/check-release.sh
18
+
16
19
- name : Set up QEMU
17
20
uses : docker/setup-qemu-action@v2
18
21
Original file line number Diff line number Diff line change 10
10
import os
11
11
import copy
12
12
13
+ from .version import qualified_version
13
14
from .config_validator import ConfigValidator
14
15
from .urls_parser import UrlsParser
15
16
from .selectors_parser import SelectorsParser
@@ -44,7 +45,7 @@ class ConfigLoader:
44
45
strict_redirect = True
45
46
strip_chars = ".,;:§¶"
46
47
use_anchors = False
47
- user_agent = 'Meilisearch docs-scraper'
48
+ user_agent = qualified_version ()
48
49
only_content_level = False
49
50
query_rules = []
50
51
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ __version__ = "0.12.9"
4
+
5
+
6
+ def qualified_version () -> str :
7
+ """Get the qualified version of this module."""
8
+
9
+ return f"Meilisearch DocsScraper (v{ __version__ } )"
Original file line number Diff line number Diff line change 1
1
# coding: utf-8
2
+ import re
3
+ from scraper .src .config .version import __version__ , qualified_version
2
4
from scraper .src .config .config_loader import ConfigLoader
3
5
from .abstract import config
4
6
import pytest
@@ -48,3 +50,17 @@ def test_excpetion_when_shadowing_(self):
48
50
49
51
with pytest .raises (Exception ):
50
52
ConfigLoader (c )
53
+
54
+ def test_get_version (self ):
55
+ assert re .match (r"^(\d+\.)?(\d+\.)?(\*|\d+)$" , __version__ )
56
+
57
+ def test_get_qualified_version (self ):
58
+ """ Old variable scrap_url must be spread to scrape_url. If one is defined, the previous one must be used"""
59
+ # Given
60
+ c = config ({
61
+ 'user_agent' : qualified_version ()
62
+ })
63
+
64
+ config_loaded = ConfigLoader (c )
65
+
66
+ assert config_loaded .user_agent == f"Meilisearch DocsScraper (v{ __version__ } )"
You can’t perform that action at this time.
0 commit comments