Skip to content
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

GH_action/public_repo_tests_migration_b2 #27

Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1227652
test gh action workflows
lim-deriv Sep 17, 2023
6a2f2aa
remove sudo chown
lim-deriv Sep 17, 2023
3df79ea
test caching
lim-deriv Sep 17, 2023
44d7a81
specify ubuntu version
lim-deriv Sep 17, 2023
24f9f9c
try official setup-python caching
lim-deriv Sep 17, 2023
6e8d59a
remove env
lim-deriv Sep 17, 2023
36b795f
re-trigger to test caching [ci]
lim-deriv Sep 17, 2023
12fdb6e
run without caching
lim-deriv Sep 17, 2023
bf84400
test cache-hit
lim-deriv Sep 17, 2023
3d70185
test cache
lim-deriv Sep 17, 2023
4889bef
try again actions/cache
lim-deriv Sep 17, 2023
758f7d8
trigger tests
lim-deriv Sep 17, 2023
74cbe1a
trigger test
lim-deriv Sep 17, 2023
a037159
re-trigger to test caching [ci]
lim-deriv Sep 17, 2023
04e8ecf
use back caching by actions/setup-python@v4
lim-deriv Sep 17, 2023
5a98b04
remove unwanted config
lim-deriv Sep 17, 2023
ef09942
test whole workflow
lim-deriv Sep 17, 2023
4fb180e
specify ubuntu version
lim-deriv Sep 17, 2023
1de1790
test GH workflows
lim-deriv Sep 17, 2023
bb4a84c
fix indentation
lim-deriv Sep 17, 2023
fae98bd
test without git push
lim-deriv Sep 17, 2023
14a52ae
test without git commit and push
lim-deriv Sep 17, 2023
8d56c71
check branch
lim-deriv Sep 17, 2023
e5a6638
test schema flow
lim-deriv Sep 17, 2023
1c9a1f4
test schema flow
lim-deriv Sep 17, 2023
c234973
trigger tests
lim-deriv Sep 17, 2023
33b42a6
Update checkout version
lim-deriv Sep 17, 2023
81d4368
add workflow dispatch
lim-deriv Sep 17, 2023
25d345f
set secrets as env
lim-deriv Sep 18, 2023
7f4e082
trigger tests [ci] 2023-09-20 08:42:35
lim-deriv Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/actions/ssh-agent/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: SSH agent setup
description: "Sets up ssh agent, add read ssh key and write ssh key"
inputs:
read_github_ssh_key:
description: "ssh key to read other repos"
required: false
write_github_ssh_key:
description: "ssh key to write other repos"
required: false
runs:
using: composite
steps:
- name: set env
shell: bash -e {0}
working-directory: /tmp
run: |
eval $(ssh-agent)
echo SSH_AUTH_SOCK=$SSH_AUTH_SOCK | sudo tee -a $GITHUB_ENV
echo SSH_AGENT_PID=$SSH_AGENT_PID | sudo tee -a $GITHUB_ENV
- name: create .ssh directory
shell: bash -e {0}
working-directory: /tmp
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
- name: setup read ssh key file
shell: bash -e {0}
working-directory: /tmp
if: inputs.read_github_ssh_key != ''
run: |
echo "${{ inputs.read_github_ssh_key }}" >> ~/.ssh/github.com.rsa
chmod 600 ~/.ssh/github.com.rsa
ssh-add ~/.ssh/github.com.rsa

cat << EOF >> ~/.ssh/config
Host github.com
HostName github.com
IdentitiesOnly yes
IdentityFile HOME/.ssh/github.com.rsa
EOF
sed -i "s@HOME@$HOME/@" ~/.ssh/config
chmod 600 ~/.ssh/config
- name: setup write ssh key file
shell: bash -e {0}
working-directory: /tmp
if: inputs.write_github_ssh_key != ''
run: |
echo "${{ inputs.write_github_ssh_key }}" >> ~/.ssh/write.github.com.rsa
chmod 600 ~/.ssh/write.github.com.rsa
ssh-add ~/.ssh/write.github.com.rsa

cat << EOF >> ~/.ssh/config
Host push.github.com
HostName github.com
IdentitiesOnly yes
IdentityFile HOME/.ssh/write.github.com.rsa
EOF
sed -i "s@HOME@$HOME/@" ~/.ssh/config
chmod 600 ~/.ssh/config
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build
run-name: Build
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
- 3.9.6
- 3.9.8
- 3.9.9
- 3.9.10
- 3.9.11
- 3.9.12
- 3.9.13
- 3.9.16
- 3.10.0
- 3.10.1
- 3.10.2
- 3.10.3
- 3.10.4
- 3.10.10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Comment on lines +33 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we missing the setting up the ssh agent step ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job did not have any command like git push or git clone so ssh agent is not needed.

with:
python-version: ${{ matrix.python-version }}
cache: 'pipenv'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the setup python actions provide caching for the dependencies ? Is that why we pass cache argument ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I pass cache argument there is to cache the pipenv dependencies. https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md

- run: make setup
- run: make test
- run: make coverage
release:
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-20.04
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9.6"
- name: setup pypi
run: |
echo "[pypi]" >> ~/.pypirc
echo "username=__token__" >> ~/.pypirc
echo "password=$PYPI_TOKEN" >> ~/.pypirc
- name: release
run: |
python3 -m pip install --upgrade twine
make build
python3 -m twine upload --repository pypi dist/*
echo "deployed to pypi"
docs-build-deploy:
if: github.ref == 'refs/heads/master'
needs: release
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ssh-agent
with:
write_github_ssh_key: ${{ secrets.WRITE_GITHUB_SSH_KEY }}
- uses: actions/setup-python@v4
with:
python-version: "3.9.6"
cache: 'pipenv'
- run: make setup
- run: |
git config --local user.email "[email protected]"
git config --local user.name "gh-pages deploy bot"
make gh-pages
18 changes: 0 additions & 18 deletions .github/workflows/build_workflow.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/update_schema_flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Update schema flow
run-name: Update schema flow
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
update_schema:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ssh-agent
with:
write_github_ssh_key: ${{ secrets.WRITE_GITHUB_SSH_KEY }}
- uses: actions/setup-python@v4
with:
python-version: "3.9.6"
- name: config git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Nobody"
- name: update schema
run: |
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