Skip to content

Commit

Permalink
Merge branch 'main' into mb/add_monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff authored Oct 15, 2023
2 parents 748d415 + 19255eb commit f6a584a
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 276 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
"charliermarsh.ruff",
"ms-python.black-formatter",
"ms-azuretools.vscode-docker",
"ms-vscode.makefile-tools"
"ms-vscode.makefile-tools",
"github.vscode-github-actions"
]
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/pre-commit.yml

This file was deleted.

97 changes: 0 additions & 97 deletions .github/workflows/static_type_checks.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/tests.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# GitHub action to check if pre-commit has been run. Runs from .pre-commit-config.yaml, where the pre-commit actions are.

name: validate

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
build:
concurrency:
group: "${{ github.workflow }} @ ${{ github.ref }}"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/martinbernstorff/personal-mnemonic-medium
cacheFrom: ghcr.io/martinbernstorff/personal-mnemonic-medium
push: always
runCmd:
make validate
23 changes: 2 additions & 21 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
# Use an official Python runtime as a parent image
FROM python:3.9-bullseye
FROM python:3.10-bullseye

# Set the working directory to /app
WORKDIR /app

# Install deps
COPY pyproject.toml /app/
COPY pyproject.toml ./
RUN pip install .[dev]
RUN pip install .[tests]

# Setup dev env
COPY tasks.py pyproject.toml ./
RUN inv static-type-checks

COPY .pre-commit-config.yaml ./
RUN git init && pre-commit run

RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') \
&& curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" \
&& tar xf lazygit.tar.gz lazygit \
&& install lazygit /usr/local/bin
RUN mkdir -p ~/.config/lazygit/ && touch ~/.config/lazygit/config.yml && echo "disableStartupPopups: true" >> ~/.config/lazygit/config.yml

RUN type -p curl >/dev/null || (apt update && apt install curl -y) && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y

# Install the entire app
COPY . /app
RUN pip install -e .
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ test:
type-check:
pyright .

pr:
validate:
make lint & make test & make type-check

pr:
make validate
git push
gh pr create
gh pr merge --auto --merge
21 changes: 3 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
requires-python = ">=3.8"
requires-python = ">=3.10"
dependencies = [
"misaka>=2.1.1",
"genanki>=0.13.0",
Expand All @@ -29,7 +29,7 @@ dependencies = [
[project.optional-dependencies]
dev = [
"cruft>=2.0.0",
"pyright==1.1.330.post0",
"pyright==1.1.331",
"pyright-polite>=0.0.1",
"pre-commit>=2.20.0",
"ruff>=0.0.254",
Expand All @@ -44,21 +44,6 @@ tests = [
"pytest-sugar>=0.9.4",
"tox>=4.5.0",
]
docs = [
"sphinx>=5.3.0,<7.3.0",
"furo>=2022.12.7,<2023.9.11", # theme
"sphinx-copybutton>=0.5.1,<0.5.2",
"sphinxext-opengraph>=0.7.3,<0.8.2",
"sphinx_design>=0.3.0,<0.5.1",
"myst-nb>=0.6.0,<1.17.0",
"sphinx_togglebutton>=0.2.3,<0.4.0",
]
tutorials = [
"jupyter>=1.0.0,<1.1.0",
"sphinx_togglebutton>=0.2.3,<0.4.0",
"myst-nb>=0.6.0,<1.17.0", # for rendering notebooks
"jupyter>=1.0.0,<1.1.0", # for tutorials
]

[project.urls]
homepage = "https://github.com/MartinBernstorff/personal-mnemonic-medium"
Expand Down

0 comments on commit f6a584a

Please sign in to comment.