Skip to content

Commit 183cb38

Browse files
chylli-derivNobody
andauthored
Update/automatically (deriv-com#22)
* add script * refactor * update schema * fix test * update changelog * rename default ws server * update ChangeLog * increase version * try update * try update * fix command * checkout * install modules * install cpanm * test status * add name * try push * no check git * config git * push to origin * update schema automatically * filter * filter * try add NEXTVER * revert update schema to test NEXTVER Revert "update schema automatically" This reverts commit 3c75233. * update schema automatically * run status before commit * revert again for test Revert "update schema automatically" This reverts commit 71ab237. * test * update schema automatically * Revert "update schema automatically" This reverts commit 1476914. * fix typo * update schema automatically * add more lines * Revert "update schema automatically" This reverts commit 979c896. * update schema automatically * to check cron run * try upload * fix error * try release * try fix * from bottom * add requirement * require test * schedule * try run every minutes * run it every day * cascade * fix error * try set git * push back * release $NEXT_VER * try no nextver * Revert "release $NEXT_VER" This reverts commit 9577591. * Revert "update schema automatically" This reverts commit ffb1d34. * update schema automatically * enable cron [ci skip] * revert update automatically [ci skip] * update schema automatically * Revert "update schema automatically" This reverts commit 1384395. * try run every 5 minutes [ci skip] * update schema automatically * try again [ci skip] * [ci skip] Revert "update schema automatically" This reverts commit 5b58522. * update schema automatically * refactor * change to pypi * Update .circleci/config.yml * try ssh key * no cron , for test * Revert "update schema automatically" This reverts commit 8b867be. * show remote -v * push * add back filter --------- Co-authored-by: Nobody <nobody@deriv.com>
1 parent 1380cfc commit 183cb38

File tree

11 files changed

+982
-1438
lines changed

11 files changed

+982
-1438
lines changed

.circleci/config.yml

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- checkout # check out source code to working directory
2020
- run: sudo chown -R circleci:circleci /usr/local/bin
2121
- restore_cache:
22-
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
22+
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
2323
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
2424
- run:
2525
command: |
@@ -45,8 +45,8 @@ jobs:
4545
- restore_cache:
4646
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
4747
- run:
48-
command: |
49-
make setup
48+
command: |
49+
make setup
5050
- save_cache:
5151
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
5252
paths:
@@ -56,6 +56,55 @@ jobs:
5656
git config --local user.email "sysadmin@binary.com"
5757
git config --local user.name "gh-pages deploy bot"
5858
make gh-pages
59+
update_schema:
60+
<<: *default
61+
steps:
62+
- add_ssh_keys:
63+
fingerprints:
64+
- "c8:f7:fc:a0:0d:2c:43:93:e3:c7:b6:cf:16:93:98:e1"
65+
- checkout
66+
- run:
67+
name: config git
68+
command: |
69+
git config --global user.email "nobody@deriv.com"
70+
git config --global user.name "Nobody"
71+
- run:
72+
name: update schema
73+
command: |
74+
git clone https://github.com/binary-com/deriv-developers-portal.git /tmp/deriv-developers-portal
75+
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
76+
sudo cpanm -n Dir::Self File::Basename JSON::MaybeXS Log::Any Path::Tiny Template Syntax::Keyword::Try
77+
BINARYCOM_API_SCHEMA_PATH=/tmp/deriv-developers-portal/config/v3 perl scripts/regen-py.pl
78+
if [[ $(git diff --shortstat) == ' 2 files changed, 2 insertions(+), 2 deletions(-)' ]]
79+
then
80+
echo 'Schema no change'
81+
exit 0
82+
fi
83+
echo "Schama updated"
84+
pip3 install bump
85+
NEXT_VER=$(bump)
86+
sed -i '/# Changelog/{s/$/\n\n## NEXTVER\n\nSync API/}' CHANGELOG.md
87+
sed -i "s/NEXTVER/$NEXT_VER/g" CHANGELOG.md
88+
git add .
89+
git commit -m 'update schema automatically'
90+
git push origin HEAD:master
91+
release:
92+
<<: *default
93+
steps:
94+
- checkout
95+
- run:
96+
name: setup pypi
97+
command: |
98+
echo "[pypi]" >> ~/.pypirc
99+
echo "username=__token__" >> ~/.pypirc
100+
echo "password=$PYPI_TOKEN" >> ~/.pypirc
101+
- run:
102+
name: release
103+
command: |
104+
python3 -m pip install --upgrade twine
105+
make build
106+
python3 -m twine upload --repository pypi dist/*
107+
echo "deployed to pypi"
59108
workflows:
60109
build:
61110
jobs:
@@ -78,7 +127,26 @@ workflows:
78127
- "3.10.4"
79128
- "3.10.10"
80129
- docs-build-deploy:
130+
requires:
131+
- release
132+
filters:
133+
branches:
134+
only:
135+
- master
136+
- release:
137+
requires:
138+
- test
139+
filters:
140+
branches:
141+
only:
142+
- master
143+
update_schema_flow:
144+
jobs:
145+
- update_schema
146+
triggers:
147+
- schedule:
148+
cron: "0 0 * * *"
81149
filters:
82150
branches:
83151
only:
84-
- master
152+
- master

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ venv/
88
dist
99
.coverage
1010
build
11+
tags

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
# Changelog
22

3+
## 0.1.5
4+
5+
Change default ws server
6+
7+
## 0.1.4
8+
9+
Sync API
10+
311
## 0.1.3
412

513
Fix a typo, which cause ws connection no response
14+
615
## 0.1.2
716

817
Added middleware support
918

1019
## 0.1.1
1120

1221
### Fixed:
13-
Fixed a PyPI constraint where the package can only be installed on python ==3.9.6
1422

23+
Fixed a PyPI constraint where the package can only be installed on python ==3.9.6
1524

1625
## 0.1.0
1726

1827
Initial version.
19-

deriv_api/deriv_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DerivAPI(DerivAPICalls):
8585
storage: None
8686

8787
def __init__(self, **options: str) -> None:
88-
endpoint = options.get('endpoint', 'frontend.binaryws.com')
88+
endpoint = options.get('endpoint', 'ws.derivws.com')
8989
lang = options.get('lang', 'EN')
9090
brand = options.get('brand', '')
9191
cache = options.get('cache', InMemory())

0 commit comments

Comments
 (0)