Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/add ruff #149

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5b909ea
refactor: pyproject.toml
Jerakin Feb 21, 2024
ff0b7e7
refactor: moved all files
Jerakin Feb 21, 2024
38b7193
fix: tests using src directory
Jerakin Feb 21, 2024
bf19c6f
fix: template folder
Jerakin Feb 21, 2024
1002b5b
fix: update static urls to use dynamic values
Jerakin Feb 21, 2024
fe86ffd
cicd: docker and cicd fixes
Jerakin Feb 21, 2024
5cc398e
chore: remove libs that are not explicitly used by the project
Jerakin Feb 21, 2024
eb99ccb
fix: ignore plugin generated files
Jerakin Feb 21, 2024
f310a94
fix: clean up tests
Jerakin Feb 21, 2024
4088ac6
chore: add ruff tool chain config
Jerakin Feb 21, 2024
c7db997
feat: keep wiki template as a separate folder and copy it over if i…
Jerakin Feb 21, 2024
43abeb4
fix: error in refactor move
Jerakin Feb 21, 2024
b1fdce9
fix: template path fix
Jerakin Feb 23, 2024
02a0fed
doc: update docker build instruction
Jerakin Feb 25, 2024
e7b4058
fix: default update locations
Jerakin Feb 25, 2024
3789595
fix: image fetching
Jerakin Feb 25, 2024
9dc65bc
fix: moved wiki template folder
Jerakin Feb 25, 2024
a5f9def
fix: force project root as base of template and static folder
Jerakin Feb 25, 2024
022c2bb
fix: add the extra data when building the app
Jerakin Feb 25, 2024
9a84342
docs: updated documentation
Jerakin Feb 25, 2024
ed616c8
test: wiki template path within the test
Jerakin Feb 25, 2024
fa459b3
cicd: updated dockerfile to build and setup image correctly
Jerakin Feb 25, 2024
be7842d
fix: add default draw to built page
Jerakin Feb 25, 2024
a0c7f5f
fix: allow space within file name
Jerakin Feb 25, 2024
4d5c12c
fix: allowed and disallowed file names
Jerakin Feb 27, 2024
a44546d
Merge pull request #2 from Jerakin/fix/error-in-file-names
Jerakin Feb 29, 2024
7a68758
feat: build multiple platforms
Jerakin Feb 21, 2024
6d2de2e
Merge pull request #3 from Jerakin/feature/multi-platform-docker-image
Jerakin Feb 29, 2024
8c16efa
fix: use uri for search
Jerakin Feb 23, 2024
2ff6bcd
Merge pull request #4 from Jerakin/fix/use-uri-for-search
Jerakin Feb 29, 2024
bcfcc71
style: format update
Jerakin Feb 22, 2024
2380e45
Merge pull request #5 from Jerakin/style/update-formatting
Jerakin Feb 29, 2024
c57c2c7
refactor: split the routes into different function
Jerakin Feb 22, 2024
ee4a54b
Merge pull request #6 from Jerakin/refactor/split-routes
Jerakin Feb 29, 2024
3dffa9a
simplified plugin usage
Jerakin Feb 22, 2024
168b8d3
Merge pull request #7 from Jerakin/refactor/simplified-plugin-usage
Jerakin Feb 29, 2024
f98a6f5
refactor the draw plugin
Jerakin Feb 27, 2024
58de0d4
Merge pull request #8 from Jerakin/plugins/refactor-draw-plugin
Jerakin Feb 29, 2024
3fedb6b
refactor: store page title and content in a class
Jerakin Feb 23, 2024
36c9b51
Merge pull request #9 from Jerakin/refactor/form-content
Jerakin Feb 29, 2024
4d45c21
feat: left side navbar
Jerakin Feb 19, 2024
c2135a7
fix: simplify list view
Jerakin Feb 26, 2024
52f37c0
Merge pull request #10 from Jerakin/feat/sidebar
Jerakin Feb 29, 2024
b13e5a5
Use suffix on file name
Jerakin Feb 23, 2024
ba2f4a6
Merge pull request #11 from Jerakin/feature/use-suffix
Jerakin Feb 29, 2024
f70bb2b
fix: made the navbar more inline with how other websites are doing it
Jerakin Feb 25, 2024
3dc557e
Merge pull request #12 from Jerakin/fix/css-style-tweaks
Jerakin Feb 29, 2024
550ed0d
docker: dockerhub name
Jerakin Feb 29, 2024
99f7111
srtyle: add ruff to the project
Jerakin Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ jobs:
matrix:
architecture:
- linux/amd64
# - linux/arm64
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: linbreux/wikmd
images: Jerakin/wikmd
tags: |
type=ref,event=pr
type=ref,event=tag
Expand All @@ -39,9 +38,9 @@ jobs:
run: echo "Creating Docker image ${{ steps.meta.outputs.tags }}"

- name: Build & export
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
file: Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
outputs: type=docker,dest=/tmp/wikmd.tar
Expand All @@ -62,7 +61,7 @@ jobs:
name: "test-${{ matrix.tag }}"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Download artifact
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -96,16 +95,20 @@ jobs:
- name: Assert wikmd status
run: curl -I localhost:5000 2>&1 | awk '/HTTP\// {print $2}' | grep -w "200\|301"

# Check that wikmd is rendering
- name: Check wikmd rendering status
run: curl -s localhost:5000 | grep -w "What is it?"

publish:
# Publish if official repo and push to 'main' or new tag
if: |
github.repository == 'Linbreux/wikmd' &&
github.repository == 'Jerakin/wikmd' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
Expand All @@ -114,8 +117,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ needs.build.outputs.wikmd_tags }}
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[test]
- name: Test with pytest
run: |
python -m pytest -v
python -m pytest

- name: Start wikmd
run: python wiki.py &

run: |
cd src
python -m wikmd.wiki &

- name: screenshots-ci-action
uses: flameddd/screenshots-ci-action@master
with:
Expand Down
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,12 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Generated plugin files
src/wikmd/plugins/draw/drawings/*
!src/wikmd/plugins/draw/drawings/.gitkeep


# Personal wiki pages
wiki/*
wiki/src/*

!wiki/Features.md
!wiki/How to use the wiki.md
!wiki/Markdown cheatsheet.md
!wiki/Using the version control system.md
!wiki/homepage.md
!wiki/src

temp/*
6 changes: 1 addition & 5 deletions docker/README.md → DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

[wikmd](https://github.com/Linbreux/wikmd) is a file based wiki that uses markdown.

This repo provides Docker files that are loosely based on those of the [linuxserver](https://www.linuxserver.io/) community.

Docker files are available for arm, arm64 and amd64.

## Usage

Here are some example snippets to help you get started creating a container.

Build the image,

```bash
docker build -t linbreux/wikmd:latest -f docker/Dockerfile .
docker build -t linbreux/wikmd:latest -f Dockerfile .
```

### docker-compose (recommended, [click here for more info](https://docs.linuxserver.io/general/docker-compose))
Expand Down
66 changes: 66 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
FROM python:3.9-alpine3.17 as python-base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# We will be installing venv
ENV VIRTUAL_ENV="/venv"

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser


# Add project path to python path, this to ensure we can reach it from anywhere
WORKDIR /code
ENV PYTHONPATH="/code:$PYTHONPATH"

# prepare the virtual env
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN python -m venv $VIRTUAL_ENV

# BUILDER
FROM python-base as python-builder

# Install our dependencies
RUN apk update
RUN apk add git
RUN apk add pandoc
RUN apk add build-base linux-headers

# Python dependencies
WORKDIR /code

COPY pyproject.toml /code

# Copy the py project and use a package to convert our pyproject.toml file into a requirements file
# We can not install the pyproject with pip as that would install the project and we only
# wants to install the project dependencies.
RUN python -m pip install toml-to-requirements==0.2.0
RUN toml-to-req --toml-file pyproject.toml

RUN python -m pip install --no-cache-dir --upgrade -r ./requirements.txt

# Copy our source content over
COPY ./src/wikmd /code/wikmd

# Change the directory to the root.
WORKDIR /

# Expose the port that the application listens on.
EXPOSE 5000

# Run the application.
CMD ["python", "-m", "wikmd.wiki"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It’s a file-based wiki that aims to simplicity. Instead of storing the data in

To view the documents in the browser, the document is converted to html.

![preview](static/images/readme-img.png)
![preview](src/wikmd/static/images/readme-img.png)

## Features

Expand All @@ -31,6 +31,10 @@ To view the documents in the browser, the document is converted to html.

Detailed installation instruction can be found [here](https://linbreux.github.io/wikmd/installation.html).

## Development

Instructions on the easiest way to develop on the project can be found [here](https://linbreux.github.io/wikmd/development.html).

## Plugins & Knowledge graph (beta)

More info can be found in the [docs](https://linbreux.github.io/wikmd/knowledge%20graph.html).
Expand Down
39 changes: 0 additions & 39 deletions docker/Dockerfile

This file was deleted.

38 changes: 0 additions & 38 deletions docker/Dockerfile.aarch64

This file was deleted.

38 changes: 0 additions & 38 deletions docker/Dockerfile.armhf

This file was deleted.

34 changes: 0 additions & 34 deletions docker/root/etc/cont-init.d/30-config

This file was deleted.

5 changes: 0 additions & 5 deletions docker/root/etc/services.d/wikmd/run

This file was deleted.

Loading
Loading