nickderobertis / fitbit-downloader Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
[#48]: refactor auto-merge workflow once Github Actions improves
The only difference in these jobs is that they checkout master instead of requiring master
reuse jobs
reuse steps
trigger workflow from within action/workflow
commit triggered by action triggers push event
name: automerge
on:
pull_request:
types:
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv sync
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pipenv run python -m pytest --cov=./ --cov-report=xml
- name: Static Typing Checks with mypy
run: |
pipenv run mypy $(python directory.py)
automerge:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Check if maintainer
env:
GITHUB_PR_USER: ${{ github.actor }}
run: |
python is_maintainer.py;
exit $?;
- name: Auto-merge PR
id: automerge
if: success()
uses: "nickderobertis/automerge-action@merged-to-use-temporarily"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "!no auto merge"
UPDATE_LABELS: "!no auto merge"
- name: Stop if Not Merged
run: |
if $PR_WAS_MERGED; then
echo "PR was merged, now need to deploy"
exit 0;
fi;
echo "PR was not merged, will not auto-deploy"
exit 1;
env:
PR_WAS_MERGED: ${{ steps.automerge.outputs.merged }}
# TODO [#48]: refactor auto-merge workflow once Github Actions improves
#
# Entire jobs are getting copied between workflow files due to limitations in Github Actions.
# The only difference in these jobs is that they checkout master instead of requiring master
#
# Possible changes to Github Actions that would allow the automerge workflow to be refactored:
# - reuse jobs
# - reuse steps
# - trigger workflow from within action/workflow
# - commit triggered by action triggers push event
collectTODO:
needs: automerge
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@master"
- name: "TODO to Issue"
uses: "nickderobertis/todo-to-issue-action@pr-support"
id: "todo"
deploy:
needs: automerge
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v1
with:
ref: refs/heads/master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Get package name
id: package_name
run: echo ::set-output name=package_name::$(python name.py)
- uses: nickderobertis/pypi-latest-version-action@master
id: output_pypi_version
with:
package: ${{ steps.package_name.outputs.package_name }}
- name: Output build version
id: output_build_version
run: |
bash output-version.sh
- name: Install Pipenv
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
run: |
pipenv sync
sudo apt-get install pandoc -y
- name: Build Documentation
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
run: |
cd docsrc
pipenv run make github
cd ..
echo "" > docs/.nojekyll
- name: Deploy Documentation
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
uses: peaceiris/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs
- name: Build PyPI Package
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
run: |
pipenv run python upload.py --build-only
- name: Upload PyPI Package
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Publish Github Release
if: steps.output_pypi_version.outputs.version != steps.output_build_version.outputs.version
uses: release-drafter/release-drafter@v5
with:
name: "v${{steps.output_build_version.outputs.version}}"
tag: "v${{steps.output_build_version.outputs.version}}"
version: "v${{steps.output_build_version.outputs.version}}"
publish: true
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
df943599e0a32bfca9e2d4b92fd201abccacf5a1
Set this to optional dynamically
elevation: int
fairlyActiveMinutes: int
floors: int
# TODO: Set this to optional dynamically
heartRateZones: Optional[List[HeartRateZone]]
lightlyActiveMinutes: int
marginalCalories: int
# TODO: Set this to optional dynamically
restingHeartRate: Optional[int]
sedentaryMinutes: int
steps: int
veryActiveMinutes: int
28ea18b74c948596c7e369495ee038a4a418c2fb
Add real tests
# TODO: Add real tests
def test_placeholder():
assert True
eec699a999ba07392f77830986a13a1891d5c9f1
Set this to optional dynamically
elevation: int
fairlyActiveMinutes: int
floors: int
# TODO: Set this to optional dynamically
heartRateZones: Optional[List[HeartRateZone]]
lightlyActiveMinutes: int
marginalCalories: int
# TODO: Set this to optional dynamically
restingHeartRate: Optional[int]
sedentaryMinutes: int
steps: int
veryActiveMinutes: int
28ea18b74c948596c7e369495ee038a4a418c2fb
Set this to optional dynamically
class Value(BaseModel):
customHeartRateZones: List
heartRateZones: List[HeartRateZone]
# TODO: Set this to optional dynamically
restingHeartRate: Optional[int]
class ActivitiesHeartItem(BaseModel):
f69866ab571f276218f095e8b38dffa83238879d
[#2]: refactor docs workflow once Github Actions improves
reuse jobs
reuse steps
trigger workflow from within action/workflow
name: Build and Push Docs
on:
push:
paths:
- 'docsrc/**'
branches:
- master
jobs:
# TODO [#2]: refactor docs workflow once Github Actions improves
#
# Entire jobs are getting copied between workflow files due to limitations in Github Actions
#
# Possible changes to Github Actions that would allow the docs workflow to be refactored:
# - reuse jobs
# - reuse steps
# - trigger workflow from within action/workflow
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv sync
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pipenv run python -m pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: github.ref == 'refs/heads/master'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-pytest
yml: ./codecov.yml
- name: Static Typing Checks with mypy
run: |
pipenv run mypy $(python directory.py)
deploy:
needs: test
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv sync
sudo apt-get install pandoc -y
- name: Build Documentation
run: |
cd docsrc
pipenv run make github
cd ..
echo "" > docs/.nojekyll
- name: Deploy Documentation
uses: peaceiris/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs
16e8ac587daec1c59f9eb08dc8d1bd6751e92dde
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.