-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3df0ec0
commit ee55567
Showing
4 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: mplfinance Checks | ||
on: [ push, pull_request ] | ||
jobs: | ||
Regression_Tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
steps: | ||
- name: Preliminary Information | ||
run: | | ||
echo "The job was automatically triggered by a ${{ github.event_name }} event." | ||
echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!" | ||
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | ||
echo " " | ||
echo "github.ref = ${{ github.ref }}" | ||
echo "github.sha = ${{ github.sha }}" | ||
echo "github.event.pull_request.head.ref = ${{ github.event.pull_request.head.ref }}" | ||
echo "github.event.pull_request.head.sha = ${{ github.event.pull_request.head.sha }}" | ||
echo "github.event.pull_request.base.ref = ${{ github.event.pull_request.base.ref }}" | ||
echo "github.event.pull_request.base.sha = ${{ github.event.pull_request.base.sha }}" | ||
echo " " | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- run: echo "The ${{ github.repository }} repository has been cloned to the runner." | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Install My Package | ||
run: pip install . | ||
|
||
- name: Run Pytest | ||
run: python -m pytest | ||
|
||
- run: echo "This job's status is ${{ job.status }}." | ||
|
||
Pull_Request_Updates_Version: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install packaging | ||
- name: Fetch base and head on PR | ||
if: ${{ github.event.pull_request.base.sha }} | ||
run: | | ||
git fetch origin master ${{ github.event.pull_request.base.sha }} | ||
git fetch origin master ${{ github.event.pull_request.head.sha }} | ||
- name: Check that Pull Request includes updating the Version | ||
run: | | ||
git show ${{ github.event.pull_request.base.sha }}:src/mplfinance/_version.py > scripts/tv0.py | ||
git show ${{ github.sha }}:src/mplfinance/_version.py > scripts/tv1.py | ||
python scripts/version_update_check.py tv0 tv1 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
python_files = tests/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import sys | ||
import importlib | ||
from packaging import version | ||
|
||
if len(sys.argv) < 3: | ||
raise RuntimeError('Got less than 2 Version Arguments!') | ||
|
||
debug = True if (len(sys.argv) > 3 and sys.argv[3] == 'debug') else False | ||
|
||
v0 = importlib.import_module(sys.argv[1]) | ||
pv0 = version.parse(v0.__version__) | ||
|
||
v1 = importlib.import_module(sys.argv[2]) | ||
pv1 = version.parse(v1.__version__) | ||
|
||
if debug: | ||
print('sys.argv=',sys.argv) | ||
print('v0=',v0) | ||
print('v1=',v1) | ||
print('pv0=',pv0) | ||
print('pv1=',pv1) | ||
# cmd='cat '+sys.argv[1]+'.py' | ||
# print('os.system("'+cmd+'")') | ||
# os.system(cmd) | ||
# cmd='cat '+sys.argv[2]+'.py' | ||
# print('os.system("'+cmd+'")') | ||
# os.system(cmd) | ||
print('v0.__version__=',v0.__version__) | ||
print('v1.__version__=',v1.__version__) | ||
|
||
if not pv1 > pv0: | ||
print('ERROR: Pull Request requires mplfinance version to be updated: (Version '+str(pv1)+' is NOT greater than '+str(pv0)+')') | ||
exit(1) | ||
else: | ||
print('Version was updated OK (from '+str(pv0)+' to '+str(pv1)+')') | ||
exit(0) |
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