Skip to content

Commit

Permalink
Update/automatically (#22)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
chylli-deriv and Nobody authored Aug 29, 2023
1 parent 1380cfc commit 183cb38
Show file tree
Hide file tree
Showing 11 changed files with 982 additions and 1,438 deletions.
76 changes: 72 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- checkout # check out source code to working directory
- run: sudo chown -R circleci:circleci /usr/local/bin
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
Expand All @@ -45,8 +45,8 @@ jobs:
- restore_cache:
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
make setup
command: |
make setup
- save_cache:
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
Expand All @@ -56,6 +56,55 @@ jobs:
git config --local user.email "[email protected]"
git config --local user.name "gh-pages deploy bot"
make gh-pages
update_schema:
<<: *default
steps:
- add_ssh_keys:
fingerprints:
- "c8:f7:fc:a0:0d:2c:43:93:e3:c7:b6:cf:16:93:98:e1"
- checkout
- run:
name: config git
command: |
git config --global user.email "[email protected]"
git config --global user.name "Nobody"
- run:
name: update schema
command: |
git clone https://github.com/binary-com/deriv-developers-portal.git /tmp/deriv-developers-portal
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
sudo cpanm -n Dir::Self File::Basename JSON::MaybeXS Log::Any Path::Tiny Template Syntax::Keyword::Try
BINARYCOM_API_SCHEMA_PATH=/tmp/deriv-developers-portal/config/v3 perl scripts/regen-py.pl
if [[ $(git diff --shortstat) == ' 2 files changed, 2 insertions(+), 2 deletions(-)' ]]
then
echo 'Schema no change'
exit 0
fi
echo "Schama updated"
pip3 install bump
NEXT_VER=$(bump)
sed -i '/# Changelog/{s/$/\n\n## NEXTVER\n\nSync API/}' CHANGELOG.md
sed -i "s/NEXTVER/$NEXT_VER/g" CHANGELOG.md
git add .
git commit -m 'update schema automatically'
git push origin HEAD:master
release:
<<: *default
steps:
- checkout
- run:
name: setup pypi
command: |
echo "[pypi]" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=$PYPI_TOKEN" >> ~/.pypirc
- run:
name: release
command: |
python3 -m pip install --upgrade twine
make build
python3 -m twine upload --repository pypi dist/*
echo "deployed to pypi"
workflows:
build:
jobs:
Expand All @@ -78,7 +127,26 @@ workflows:
- "3.10.4"
- "3.10.10"
- docs-build-deploy:
requires:
- release
filters:
branches:
only:
- master
- release:
requires:
- test
filters:
branches:
only:
- master
update_schema_flow:
jobs:
- update_schema
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
- master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ venv/
dist
.coverage
build
tags
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
# Changelog

## 0.1.5

Change default ws server

## 0.1.4

Sync API

## 0.1.3

Fix a typo, which cause ws connection no response

## 0.1.2

Added middleware support

## 0.1.1

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

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

## 0.1.0

Initial version.

2 changes: 1 addition & 1 deletion deriv_api/deriv_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class DerivAPI(DerivAPICalls):
storage: None

def __init__(self, **options: str) -> None:
endpoint = options.get('endpoint', 'frontend.binaryws.com')
endpoint = options.get('endpoint', 'ws.derivws.com')
lang = options.get('lang', 'EN')
brand = options.get('brand', '')
cache = options.get('cache', InMemory())
Expand Down
Loading

0 comments on commit 183cb38

Please sign in to comment.