ci: Added next branch for the build step #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: [main, beta, next] | |
pull_request: | |
branches: [main, beta, next] | |
jobs: | |
build: | |
name: Run unit tests | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.7", "3.8", "3.9"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1.1.6 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
#---------------------------------------------- | |
# Install Technical Analysis library | |
#---------------------------------------------- | |
- name: Install TA-lib | |
run: | | |
sudo apt-get -y install gcc build-essential | |
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz \ | |
&& sudo tar -xzf ta-lib-0.4.0-src.tar.gz \ | |
&& sudo rm ta-lib-0.4.0-src.tar.gz \ | |
&& cd ta-lib/ \ | |
&& sudo ./configure --prefix=/usr \ | |
&& sudo make \ | |
&& sudo make install \ | |
&& cd ~ \ | |
&& sudo rm -rf ta-lib/ \ | |
&& pip install ta-lib | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# install your root project, if required | |
#---------------------------------------------- | |
- name: Install library | |
run: poetry install --no-interaction | |
#---------------------------------------------- | |
# Run unit tests and compute coverage | |
#---------------------------------------------- | |
- name: Run tests and compute coverage | |
run: | | |
source .venv/bin/activate | |
coverage run --source=futon -m unittest discover && coverage report -m && coverage xml | |
#---------------------------------------------- | |
# Store coverage | |
#---------------------------------------------- | |
- name: Upload coverage to Codacy | |
uses: codacy/codacy-coverage-reporter-action@1.0.0 | |
with: | |
# API project token to retrieve your remote Codacy configuration for the project being analyzed | |
project-token: ${{ secrets.CODACY_API_TOKEN }} | |
# Optional comma separated list of coverage reports to send to Codacy | |
coverage-reports: coverage.xml | |
publish: | |
if: ${{github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')}} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
#---------------------------------------------- | |
# Publish package | |
#---------------------------------------------- | |
- name: Semantic Release | |
run: | | |
pip install python-semantic-release | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release publish |