Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-zehentleitner committed Nov 23, 2023
1 parent fa98cdf commit a866194
Show file tree
Hide file tree
Showing 34 changed files with 999 additions and 13 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and Publish Anaconda

on:
workflow_dispatch:
branches:
- master

jobs:
build_conda_packages:
name: Build conda on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: windows-2019
python-version: "3.12"
steps:
- uses: actions/checkout@v4
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true

- name: Install Conda Tools
run: |
conda update --all
conda install -c conda-forge conda-build
conda install conda-verify
conda install -c anaconda anaconda-client
- name: Configure PATH
run: echo "$CONDA/bin" >> $GITHUB_PATH

- name: Install Python Tools
run: |
pip install setuptools wheel --upgrade
- name: Install macOS SDK (only on macOS)
if: runner.os == 'macOS'
run: |
sudo mkdir -p /opt/MacOSX10.10.sdk
sudo curl -L -o MacOSX10.10.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.10.sdk.tar.xz
sudo tar -xJf MacOSX10.10.sdk.tar.xz -C /opt/
- name: Set CONDA_BUILD_SYSROOT (only on macOS)
if: runner.os == 'macOS'
run: |
echo "CONDA_BUILD_SYSROOT: /opt/MacOSX10.10.sdk # [osx]" > conda_build_config.yaml
- name: Build and upload the conda packages
uses: uibcdf/[email protected]
with:
meta_yaml_dir: .
overwrite: False
python-version: ${{ matrix.python-version }}
user: lucit
label: main
token: ${{ secrets.ANACONDA_API_TOKEN }}
97 changes: 97 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build and Publish GH+PyPi

on:
workflow_dispatch:
branches:
- master

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_PYPY_VERSION: "7.3.10*"
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
steps:
- name: GitHub Checkout
uses: actions/checkout@v4

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Set up Environment
run: echo "CIBW_SKIP=pp36-* pp37-*" >> $GITHUB_ENV

- name: Check ENV
if: matrix.os == 'ubuntu-20.04'
run: echo $PATH

- name: Build wheels Linux
if: matrix.os == 'ubuntu-20.04'
uses: pypa/[email protected]
env:
CIBW_BEFORE_ALL: "bash dev/tools/github/install_rust.sh"

- name: Build wheels Mac
if: matrix.os == 'macos-11'
uses: pypa/[email protected]

- name: Build wheels Windows
if: matrix.os == 'windows-2019'
uses: pypa/[email protected]

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: GitHub Checkout
uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

Release:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: write
discussions: write
id-token: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body: |
Please read the [CHANGELOG](https://unicorn-binance-suite.docs.lucit.tech/changelog.html) for further information.
discussion_category_name: releases
draft: false
files: |
dist/*.tar.gz
dist/*.whl
generate_release_notes: true
name: unicorn-binance-suite
prerelease: false
tag_name: 1.1.0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create PyPi Release
uses: pypa/gh-action-pypi-publish@release/v1
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '20 21 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
37 changes: 37 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: GitHub Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
- name: Unit test
env:
LUCIT_API_SECRET: ${{ secrets.LUCIT_API_SECRET }}
LUCIT_LICENSE_TOKEN: ${{ secrets.LUCIT_LICENSE_TOKEN }}
run: coverage run --source unicorn_binance_suite unittest_binance_suite.py

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
name: codecov-umbrella
verbose: true
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

[Discussions about unicorn-fy releases!](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/discussions/categories/releases)

[How to upgrade to the latest version!](https://unicorn-binance-suite.docs.lucit.tech/readme.html#installation-and-upgrade)

## 1.1.0.dev (development stage/unreleased/unstable)

## 1.1.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The `--upgrade` flag will not update the `unicorn-binance-suite` dependencies un

`conda update -c conda-forge unicorn-binance-suite`

### From source of the latest release with PIP from [Github](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite)
### From source of the latest release with PIP from [GitHub](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite)
#### Linux, macOS, ...
Run in bash:

Expand All @@ -64,7 +64,7 @@ Use the below command with the version (such as 1.1.0) you determined

`pip install https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/archive/1.1.0.tar.gz --upgrade`

### From the latest source (dev-stage) with PIP from [Github](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite)
### From the latest source (dev-stage) with PIP from [GitHub](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite)
This is not a release version and can not be considered to be stable!

`pip install https://github.com/LUCIT-Systems-and-Development/unicorn-binance-suite/tarball/master --upgrade`
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions dev/link_lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/bash

cd dev
ln -s ../unicorn_binance_websocket_api
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions dev/reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/bash

rm *.log
rm dev/*.log

rm build -r
rm dist -r
rm *.egg-info -r

rm unicorn_binance_websocket_api/*.c
rm unicorn_binance_websocket_api/*.html
rm unicorn_binance_websocket_api/*.dll
rm unicorn_binance_websocket_api/*.so

rm .print_summary.txt
39 changes: 39 additions & 0 deletions dev/set_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys


def replace_string_in_files(replace_string,
config_file_path="./dev/set_version_config.txt",
log_file_path="./dev/set_version.log"):
with open(config_file_path, 'r', encoding='utf-8') as config_file:
lines = config_file.readlines()
search_string = lines[0].strip()
file_list = lines[1].strip().split(',')

for file_path in file_list:
try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()

content = content.replace(search_string, replace_string)

with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)
print(f"Replaced in {file_path}")
except FileNotFoundError:
print(f"FileNotFoundError: {file_path}")
except Exception as e:
print(f"Error during editing {file_path}: {e}")

with open(log_file_path, 'a', encoding='utf-8') as log_file:
log_file.write(f"Replaced: {search_string} with {replace_string}\n")

with open(config_file_path, 'w', encoding='utf-8') as config_file:
config_file.write(replace_string + '\n' + ','.join(file_list) + '\n')


if __name__ == "__main__":
input_replace_string = sys.argv[1]
replace_string_in_files(input_replace_string)
2 changes: 2 additions & 0 deletions dev/set_version_config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2.1.2
meta.yaml,pyproject.toml,setup.py,README.md,.github/workflows/build_wheels.yml,dev/sphinx/source/conf.py,unicorn_binance_websocket_api/manager.py
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions dev/sphinx/source/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../CHANGELOG.md
1 change: 1 addition & 0 deletions dev/sphinx/source/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../README.md
Empty file.
2 changes: 1 addition & 1 deletion sphinx/source/conf.py → dev/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath('../../..'))


# -- Project information -----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions dev/sphinx/source/copyright.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../LICENSE
File renamed without changes.
3 changes: 3 additions & 0 deletions dev/unlink_lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

rm dev/unicorn_binance_websocket_api
Loading

0 comments on commit a866194

Please sign in to comment.