Skip to content

Commit b9531f8

Browse files
committed
Add workflow for github actions
1 parent 19817dc commit b9531f8

80 files changed

Lines changed: 5505 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish Quarto to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
cache: "pip"
27+
cache-dependency-path: "pyproject.toml"
28+
29+
- name: Install Python package
30+
working-directory: .
31+
run: |
32+
python -m pip install -e .
33+
34+
- name: Setup Quarto
35+
uses: quarto-dev/quarto-actions/setup@v2
36+
with:
37+
version: "1.6.40"
38+
39+
- name: Render Quarto
40+
working-directory: quarto
41+
run: quarto render
42+
43+
- name: Upload Pages artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: quarto/_site
47+
48+
deploy:
49+
needs: build
50+
runs-on: ubuntu-latest
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deploy.outputs.page_url }}
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deploy
57+
uses: actions/deploy-pages@v4

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.12"
15+
cache: "pip"
16+
cache-dependency-path: "pyproject.toml"
17+
- name: Install
18+
run: |
19+
python -m pip install -e ".[dev]"
20+
- name: Ruff
21+
run: python -m ruff check src tests streamlit_app.py scripts pages
22+
- name: Pytest
23+
env:
24+
SINGAPORE_EDA_HEALTH_SKIP_HTTP: "1"
25+
run: python -m pytest tests -q

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Data
2+
data/raw/*
3+
!data/raw/.gitkeep
4+
data/processed/*
5+
!data/processed/.gitkeep
6+
data/processed/.http_cache/
7+
**/.http_cache/
8+
data/reference/planning_areas.geojson
9+
10+
# Python
11+
.venv/
12+
venv/
13+
__pycache__/
14+
*.py[cod]
15+
*$py.class
16+
.pytest_cache/
17+
.mypy_cache/
18+
.ruff_cache/
19+
.pip-audit-cache/
20+
dist/
21+
build/
22+
*.egg-info/
23+
24+
# Jupyter
25+
.ipynb_checkpoints/
26+
*.ipynb_checkpoints
27+
28+
# IDE
29+
.idea/
30+
.vscode/
31+
*.swp
32+
*.swo
33+
34+
# OS
35+
.DS_Store
36+
Thumbs.db
37+
38+
# Quarto
39+
_site/
40+
quarto/_site/
41+
**/_quarto/
42+
.quarto/
43+
*.qmd~
44+
45+
# Env
46+
.env
47+
.env.local

.streamlit/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[browser]
2+
gatherUsageStats = false

.streamlit/secrets.toml.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copy to Streamlit Cloud "Secrets" (do not commit real keys)
2+
# DATA_GOV_SG_API_KEY = "your-key"
3+
# Optional: unlock Ops & Admin page in the Streamlit multipage app
4+
# SINGAPORE_EDA_ADMIN_TOKEN = "long-random-token"

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Eugene Sim
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
---
24+
25+
Third-party materials in the `course_materials/` directory may be subject to
26+
their own licenses. The Jupyter tutorial folder includes a separate MIT
27+
license file where applicable. Original course notebook attributions and
28+
licenses (e.g. rmotr, freecodecamp materials) are preserved in that folder.

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
PYTHON ?= python3
2+
PIP ?= $(PYTHON) -m pip
3+
4+
.PHONY: install test ruff app report web clean-data rent-data health-serve
5+
6+
install:
7+
$(PIP) install -e ".[dev]"
8+
9+
test:
10+
$(PYTHON) -m pytest tests -q
11+
12+
ruff:
13+
$(PYTHON) -m ruff check src tests streamlit_app.py scripts
14+
15+
# Download full HDB dataset (slow: paginated API with throttling; optional max rows for dev)
16+
clean-data:
17+
$(PYTHON) -m singapore_eda.download_data --output data/raw/hdb_resale_2017_onwards.csv
18+
19+
# HDB median rent by town/flat (data.gov.sg); needed for yield tab
20+
rent-data:
21+
$(PYTHON) -m singapore_eda.rent_ingest -o data/raw/median_rent_hdb.csv
22+
23+
app:
24+
$(PYTHON) -m streamlit run streamlit_app.py
25+
26+
# Requires Quarto CLI: https://quarto.org/docs/get-started/
27+
report:
28+
cd quarto && quarto render
29+
30+
analysis:
31+
$(PYTHON) scripts/run_analysis.py
32+
33+
fetch-geo:
34+
$(PYTHON) scripts/fetch_reference_geo.py
35+
36+
# Optional: pip install -e ".[api]" — liveness/readiness + /metrics for operations
37+
health-serve:
38+
$(PYTHON) -m singapore_eda.health_server

0 commit comments

Comments
 (0)