Skip to content

Commit 5f278fe

Browse files
committed
📉
0 parents  commit 5f278fe

34 files changed

+7195
-0
lines changed

‎.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SENTRY_PUBLIC_KEY=

‎.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: mcieno

‎.github/PULL_REQUEST_TEMPLATE

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**[Describe the changes]**
2+
3+
---
4+
5+
By submitting this pull request, I confirm that you can use, modify, copy, and
6+
redistribute this contribution, under the terms of your choice.

‎.github/dependabot.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
groups:
8+
all:
9+
applies-to: version-updates
10+
update-types:
11+
- "major"
12+
- "minor"
13+
- "patch"
14+
- package-ecosystem: "npm"
15+
directory: "/site"
16+
schedule:
17+
interval: monthly
18+
groups:
19+
minor-and-patch:
20+
applies-to: version-updates
21+
update-types:
22+
- "minor"
23+
- "patch"
24+
- package-ecosystem: "pip"
25+
directory: "/site"
26+
schedule:
27+
interval: monthly
28+
groups:
29+
minor-and-patch:
30+
applies-to: version-updates
31+
update-types:
32+
- "minor"
33+
- "patch"

‎.github/workflows/code-review.yml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
on:
2+
push:
3+
branches: [main]
4+
pull_request:
5+
paths:
6+
- site/**
7+
8+
name: Code Review
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
OBSERVABLE_TELEMETRY_DISABLE: true
15+
SENTRY_RELEASE: ${{ github.sha }}
16+
SENTRY_ENVIRONMENT: test
17+
SENTRY_PUBLIC_KEY: test
18+
19+
jobs:
20+
build:
21+
name: Build
22+
runs-on: ubuntu-24.04
23+
timeout-minutes: 10
24+
25+
defaults:
26+
run:
27+
working-directory: site
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- run: pipx install poetry~=1.8
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.13"
36+
cache: poetry
37+
cache-dependency-path: site/poetry.lock
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: "20"
41+
cache-dependency-path: site/package-lock.json
42+
43+
- run: poetry install
44+
- run: poetry run npm ci --omit=dev
45+
- run: poetry run npm run build
46+
47+
audit:
48+
name: Audit
49+
runs-on: ubuntu-24.04
50+
timeout-minutes: 10
51+
52+
defaults:
53+
run:
54+
working-directory: site
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- uses: actions/setup-node@v4
60+
with:
61+
node-version: "20"
62+
cache-dependency-path: site/package-lock.json
63+
64+
- run: npm audit
65+
66+
lint:
67+
name: Lint
68+
runs-on: ubuntu-24.04
69+
timeout-minutes: 10
70+
71+
defaults:
72+
run:
73+
working-directory: site
74+
75+
steps:
76+
- uses: actions/checkout@v4
77+
78+
- run: pipx install poetry~=1.8
79+
- uses: actions/setup-python@v5
80+
with:
81+
python-version: "3.13"
82+
cache: poetry
83+
cache-dependency-path: site/poetry.lock
84+
- uses: actions/setup-node@v4
85+
with:
86+
node-version: "20"
87+
cache-dependency-path: site/package-lock.json
88+
89+
- run: poetry install
90+
- run: poetry run npm ci
91+
- run: poetry run npm run lint
92+
93+
test:
94+
name: Test
95+
runs-on: ubuntu-24.04
96+
timeout-minutes: 30
97+
98+
defaults:
99+
run:
100+
working-directory: site
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- run: pipx install poetry~=1.8
106+
- uses: actions/setup-python@v5
107+
with:
108+
python-version: "3.13"
109+
cache: poetry
110+
cache-dependency-path: site/poetry.lock
111+
- uses: actions/setup-node@v4
112+
with:
113+
node-version: "20"
114+
cache-dependency-path: site/package-lock.json
115+
116+
- run: poetry install
117+
- run: poetry run npm ci
118+
- run: poetry run npx playwright install --with-deps chromium
119+
- run: poetry run npm run test
120+
121+
- uses: actions/upload-artifact@v4
122+
if: always()
123+
with:
124+
name: playwright-report
125+
path: site/playwright-report/
126+
retention-days: 7

‎.github/workflows/deploy.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
push:
3+
branches: [main]
4+
pull_request:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 0 * * 0"
8+
workflow_dispatch:
9+
10+
name: Deploy
11+
12+
jobs:
13+
deploy:
14+
name: Deploy
15+
runs-on: ubuntu-24.04
16+
timeout-minutes: 30
17+
18+
env:
19+
OBSERVABLE_TELEMETRY_DISABLE: true
20+
SENTRY_RELEASE: ${{ github.sha }}
21+
SENTRY_ENVIRONMENT: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
22+
SENTRY_PUBLIC_KEY: ${{ vars.SENTRY_PUBLIC_KEY }}
23+
24+
defaults:
25+
run:
26+
working-directory: site
27+
28+
permissions:
29+
contents: read
30+
deployments: write
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- run: pipx install poetry~=1.8
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.13"
39+
cache: poetry
40+
cache-dependency-path: site/poetry.lock
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: "20"
44+
cache-dependency-path: site/package-lock.json
45+
46+
- run: poetry install
47+
- run: poetry run npm ci --omit=dev
48+
- run: poetry run npm run build
49+
50+
- name: Deploy to Cloudflare Pages
51+
uses: cloudflare/pages-action@v1
52+
with:
53+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
54+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
55+
projectName: marketlab
56+
workingDirectory: site
57+
directory: dist
58+
gitHubToken: ${{ github.token }}

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
.env.*
3+
!.env.example

‎DEVELOPMENT.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Development
2+
3+
This document describes the process for running the application locally.
4+
5+
## Prerequisites
6+
7+
[Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/).
8+
9+
You can optionally use [Træfik](https://containo.us/traefik/) for ease of
10+
exposing the site.
11+
Check out [Træfik & Docker](https://doc.traefik.io/traefik/providers/docker/).
12+
13+
## Develop with Docker Compose
14+
15+
The very first time you set up the project you'll have to install dependencies,
16+
hence run:
17+
18+
```shell
19+
docker compose build
20+
docker compose run --rm -it site poetry install
21+
docker compose run --rm -it site npm install
22+
docker compose run --rm -it site npx playwright install chromium
23+
```
24+
25+
After that, just run:
26+
27+
```shell
28+
docker compose up -d
29+
```
30+
31+
Easy peasy.
32+
33+
If you're using Træfik, the site should be available at [`marketlab.mcieno.internal`](https://marketlab.mcieno.internal).
34+
Otherwise, simply run `docker compose ps` and find out which host port was
35+
assigned to the containers.
36+
37+
## Cheat sheet and examples
38+
39+
This section contains a list of examples showcasing typical development
40+
interactions and operations.
41+
42+
### Run tests
43+
44+
```shell
45+
docker compose exec -it site npm run test
46+
```
47+
48+
### Lint and format
49+
50+
```shell
51+
docker compose exec -it site npm run lint
52+
docker compose exec -it site npm run fmt
53+
```

‎README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<h1 align="center">
2+
<img
3+
alt="The MarketLab logo; i.e., a muscular bull doing science experiments"
4+
height="250"
5+
src="./site/src/marketlab.svg"
6+
>
7+
8+
MarketLab
9+
</h1>
10+
<p align="center"><em>Boring tools for the data-savvy retail investor</em></p>
11+
12+
## Disclaimer
13+
14+
All content on this application is information of a general nature and
15+
does not address the circumstances of any particular individual or entity.
16+
Any reliance you place on such information is strictly at your own risk.
17+
You should, before you make any decision regarding any information,
18+
strategies or products mentioned on this application, consult your own
19+
financial advisor to consider whether that is appropriate having regard to
20+
your own objectives, financial situation and needs.
21+
22+
## Contributing
23+
24+
Contributions are welcome! Have a look at the available [tools](./site/src/tools)
25+
and feel free to improve them or write your own.
26+
27+
## Development
28+
29+
See [`DEVELOPMENT.md`](DEVELOPMENT.md) for details on how to set up a local
30+
development environment.

‎compose.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: "3.9"
2+
3+
services:
4+
site:
5+
build:
6+
dockerfile: site/dev.Dockerfile
7+
stop_grace_period: 1s
8+
restart: unless-stopped
9+
ports:
10+
- "3000"
11+
labels:
12+
traefik.enable: true
13+
traefik.http.routers.mcieno/marketlab/site.rule: Host(`marketlab.mcieno.internal`)
14+
traefik.http.routers.mcieno/marketlab/site.tls: true
15+
working_dir: /site
16+
command: npm run dev
17+
volumes:
18+
- ./site:/site
19+
environment:
20+
OBSERVABLE_TELEMETRY_DISABLE: true
21+
PLAYWRIGHT_BROWSERS_PATH: 0
22+
SENTRY_RELEASE: SNAPSHOT
23+
SENTRY_ENVIRONMENT: local
24+
SENTRY_PUBLIC_KEY: ${SENTRY_PUBLIC_KEY:-example}
25+
26+
functions:
27+
build:
28+
dockerfile: site/dev.Dockerfile
29+
stop_grace_period: 1s
30+
restart: unless-stopped
31+
ports:
32+
- "8787"
33+
labels:
34+
traefik.enable: true
35+
traefik.http.routers.mcieno/marketlab/functions.rule: Host(`marketlab.mcieno.internal`) && PathPrefix(`/api/`)
36+
traefik.http.routers.mcieno/marketlab/functions.tls: true
37+
working_dir: /site
38+
command: npx wrangler pages dev --ip 0.0.0.0 --port 8787 .
39+
volumes:
40+
- ./site:/site
41+
environment:
42+
SENTRY_RELEASE: SNAPSHOT
43+
SENTRY_ENVIRONMENT: local

‎site/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
3+
/playwright-report/
4+
/test-results/
5+
__screenshots__/
6+
.wrangler/
7+
8+
/dist/

‎site/.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.observablehq/
2+
.venv/

‎site/.prettierrc.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import("prettier").Config} */
2+
export default {
3+
arrowParens: "avoid",
4+
tabWidth: 2,
5+
trailingComma: "all",
6+
};

‎site/dev.Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:20
2+
3+
RUN set -eu \
4+
&& npm i -g npm@10 \
5+
&& npm i -g @playwright/test@1 \
6+
&& playwright install-deps chromium
7+
8+
USER node
9+
10+
RUN set -eu \
11+
&& curl -sSL https://install.python-poetry.org | python3 -
12+
13+
ENV PATH $PATH:/home/node/.local/bin
14+
15+
ENTRYPOINT ["poetry", "run"]

0 commit comments

Comments
 (0)