Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hotosm/fmtm-splitter
Browse files Browse the repository at this point in the history
Sync with upstream
  • Loading branch information
rsavoye committed Aug 30, 2023
2 parents 21abf91 + 3db8440 commit 0520b64
Show file tree
Hide file tree
Showing 27 changed files with 1,895 additions and 275 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore everything
**

# Allow files and directories
!fmtm_splitter
!pyproject.toml
!pdm.lock
!README.md
!LICENSE.md
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Deploy

on:
# Push includes PR merge
push:
branches:
- main
paths:
# Workflow is triggered only if src changes
- "src/**"
# Allow manual trigger
workflow_dispatch:

env:
REGISTRY: ghcr.io
GIT_BRANCH: ${{ github.ref_name }}

jobs:
build-and-push-images:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version
id: extract_api_version
run: |
cd src/backend
echo "PKG_VERSION=$(python -c 'from app.__version__ import __version__; print(__version__)')" >> $GITHUB_ENV
- name: Build image
uses: docker/build-push-action@v4
with:
context: .
target: prod
push: true
tags: |
"ghcr.io/hotosm/fmtm/fmtm-splitter:${{ env.PKG_VERSION }}"
"ghcr.io/hotosm/fmtm/fmtm-splitter:latest"
build-args: |
PKG_VERSION=${{ env.PKG_VERSION }}
44 changes: 44 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish Docs

on:
push:
paths:
- docs/**
- fmtm_splitter/**
branches: [main]
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:

permissions:
contents: write

jobs:
publish_docs:
name: Publish Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- name: Read cache
uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install PDM
run: |
python3 -m pip install pdm
- name: Publish
run: |
pdm install -G docs --no-default
pdm run mkdocs gh-deploy --force
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: pytest

on:
# Run tests on all pushed branches
push:
branches:
- "*"
# Run tests on PR, prior to merge to main & development.
pull_request:
branches:
- main
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}

container:
image: ghcr.io/hotosm/fmtm-splitter:ci
volumes:
# Mount / test files in commit
- ./fmtm_splitter:/home/appuser/.local/lib/python3.10/site-packages/fmtm_splitter
- ./tests:/home/appuser/tests
options: --user root

steps:
- uses: actions/checkout@v3
- name: Run pytest as appuser
run: gosu appuser pytest
39 changes: 0 additions & 39 deletions .github/workflows/python-app.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/wiki.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/wiki.yml~

This file was deleted.

64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# gdb_history
TAGS
*~
.deps
.libs
py-compile
NEWS
*__pycache__/

# output files
*.osm
*.txt
*.xml
*.geojson
*.pbf
*.xml
*.pdf
*.html
*.mbtiles
*.sqlitedb

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# PDM
.pdm.toml
.pdm-python

# Python builds
build
dist

# Docs
site
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
# Versioning: Commit messages & changelog
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.6.0
hooks:
- id: commitizen
stages: [commit-msg]

# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black

# Lint / autoformat: Python code
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: "v0.0.285"
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

# Autoformat: YAML, JSON, Markdown, etc.
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.2
hooks:
- id: prettier
args: [--ignore-unknown, --no-error-on-unmatched-pattern, "!chart/**"]

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint
args: [--fix]
Loading

0 comments on commit 0520b64

Please sign in to comment.