Skip to content

Commit

Permalink
add devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Feb 4, 2024
1 parent 25d108e commit d5c83a6
Show file tree
Hide file tree
Showing 17 changed files with 1,737 additions and 6,059 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:23.10
RUN apt-get update && apt-get install -y python3-setuptools pipenv npm

# chromium dependencies
RUN apt-get install -y fonts-noto-color-emoji libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libxkbcommon0 libxdamage1 libpango-1.0-0 libcairo2 libasound2

USER ubuntu
12 changes: 12 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "Lencerf.beancount"]
}
},
"postCreateCommand": "make deps",
"forwardPorts": [5000]
}
24 changes: 4 additions & 20 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo pip3 install black
- name: Build frontend
run: make build

- name: Install fava-dashboards
run: pip3 install .

- name: Start Fava
run: cd example; fava example.beancount &

- name: Run HTML tests
run: cd frontend; npm run test -- -t HTML

- name: Run formatter
run: |
make format
git diff --exit-code
- name: Build and run dev container task
uses: devcontainers/ci@v0.3
with:
runCmd: make ci
40 changes: 26 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
frontend/node_modules: frontend/package-lock.json
cd frontend; npm install
touch -m frontend/node_modules
deps-js:
cd frontend; npm install && npx puppeteer browsers install chrome

.PHONY: build
build: frontend/node_modules
deps-py:
cd example; pipenv install -d

deps: deps-js deps-py

build-js:
cd frontend; npm run build

.PHONY: watch
watch: frontend/node_modules
watch-js:
cd frontend; npm run watch

.PHONY: test
test: frontend/node_modules
cd frontend; npm run test
test-js:
cd frontend; LANG=en npm run test

test-js-update:
cd frontend; LANG=en npm run test -- -u

run:
cd example; pipenv run fava example.beancount

.PHONY: format
format:
cd frontend; npx --no-install -- prettier -w . ../src/fava_dashboards/templates/*.css
black src/fava_dashboards/__init__.py scripts/format_js_in_dashboard.py
cd frontend; npx prettier -w . ../src/fava_dashboards/templates/*.css
cd example; pipenv run black ../src/fava_dashboards/__init__.py ../scripts/format_js_in_dashboard.py
cd example; find . -name '*.beancount' -exec pipenv run bean-format -c 59 -o "{}" "{}" \;
./scripts/format_js_in_dashboard.py example/dashboards.yaml
find example -name '*.beancount' -exec bean-format -c 59 -o "{}" "{}" \;

ci:
make run &
make test-js
make format
git diff --exit-code
1 change: 1 addition & 0 deletions example/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "pypi"
fava-dashboards = {editable = true, path = "./.."}

[dev-packages]
black = "*"

[requires]
python_version = "3.11"
1,004 changes: 572 additions & 432 deletions example/Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/jest-puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = {
height: 1000,
},
headless: "new",
args: ["--no-sandbox"],
},
};
Loading

0 comments on commit d5c83a6

Please sign in to comment.