Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yong Sheng Tan committed Feb 10, 2024
1 parent 8e16fcd commit 4432028
Show file tree
Hide file tree
Showing 47 changed files with 1,324,664 additions and 1,324,666 deletions.
Empty file removed .gitattributes
Empty file.
56 changes: 35 additions & 21 deletions .github/workflows/Sync_to_Hugging_Face_hub.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
name: Sync to Hugging Face hub
on:
push:
branches: [main]

# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true

- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/tan-yong-sheng/gh-actions-scraping-MY-houses main
name: Sync to Hugging Face hub
on:
push:
branches: [main]

# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true

- name: Add index.md
run: |
echo
"""---
title: Scraping Malaysia Housing data
emoji: 🏃
colorFrom: pink
colorTo: gray
sdk: docker
pinned: false
license: mit
---
""" > index.md
- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/tan-yong-sheng/gh-actions-scraping-MY-houses main
36 changes: 18 additions & 18 deletions .github/workflows/check_file_size.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Limit every single file with size under 10MB so that it could be sync to HuggingFace
# Reference: https://huggingface.co/docs/hub/spaces-github-actions

name: Check file size
on: # or directly `on: [push]` to run the action on every push on any branch
pull_request:
branches: [main]

# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Check large files
uses: ActionsDesk/lfs-warning@v2.0
with:
# Limit every single file with size under 10MB so that it could be sync to HuggingFace
# Reference: https://huggingface.co/docs/hub/spaces-github-actions

name: Check file size
on: # or directly `on: [push]` to run the action on every push on any branch
pull_request:
branches: [main]

# to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Check large files
uses: ActionsDesk/lfs-warning@v2.0
with:
filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
94 changes: 47 additions & 47 deletions .github/workflows/create_report.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Create PDF report from Jupyter Notebook

on:
schedule:
- cron: "0 4 * * *"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

# Assigning permissions to jobs # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
# Modify the default permissions granted to GITHUB_TOKEN.
permissions: write-all

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ipython ipykernel nbconvert nbclient playwright pyppeteer
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: executing jupyter notebook & export PDF report
run: |
git fetch && git merge # sycn between this repo and docker instance created by this script
current_datetime=$(date +'%Y-%m-%dt%H:%M:%S')
converted_date=$(TZ=Asia/Kuala_Lumpur date -d "$current_datetime" +'%Y-%m-%d')
jupyter execute notebook/housing_data.ipynb
jupyter nbconvert --output-dir='./report' --output report_$converted_date --to webpdf --allow-chromium-download notebook/housing_data.ipynb
- name: Commit the changes to this github repo
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub sets this for you
BRANCH_NAME: 'main'
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Create PDF report from Jupyter Notebook

on:
schedule:
- cron: "0 4 * * *"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

# Assigning permissions to jobs # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
# Modify the default permissions granted to GITHUB_TOKEN.
permissions: write-all

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ipython ipykernel nbconvert nbclient playwright pyppeteer
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: executing jupyter notebook & export PDF report
run: |
git fetch && git merge # sycn between this repo and docker instance created by this script
current_datetime=$(date +'%Y-%m-%dt%H:%M:%S')
converted_date=$(TZ=Asia/Kuala_Lumpur date -d "$current_datetime" +'%Y-%m-%d')
jupyter execute notebook/housing_data.ipynb
jupyter nbconvert --output-dir='./report' --output report_$converted_date --to webpdf --allow-chromium-download notebook/housing_data.ipynb
- name: Commit the changes to this github repo
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub sets this for you
BRANCH_NAME: 'main'
114 changes: 57 additions & 57 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
name: documentation

on:
push:
branches:
- main
pull_request:
branches:
- main

workflow_dispatch:

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pandoc
pip install sphinx furo myst_parser nbsphinx sphinx-autoapi
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# 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: |
pytest
- name: Sphinx build
run: |
sphinx-build docs docs/_build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/
force_orphan: true
name: documentation

on:
push:
branches:
- main
pull_request:
branches:
- main

workflow_dispatch:

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pandoc
pip install sphinx furo myst_parser nbsphinx sphinx-autoapi
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# 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: |
pytest
- name: Sphinx build
run: |
sphinx-build docs docs/_build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/
force_orphan: true
Loading

0 comments on commit 4432028

Please sign in to comment.