Skip to content

Commit

Permalink
Updated to openzim boostrap
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed May 10, 2024
1 parent eba9d99 commit cf6bc34
Show file tree
Hide file tree
Showing 18 changed files with 727 additions and 313 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and upload to PyPI

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-22.04
permissions:
id-token: write # mandatory for PyPI trusted publishing

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- uses: actions/setup-node@v3
with:
node-version: 20

- name: install handlebars
run: |
npm install -g handlebars
- name: Build packages
run: |
pip install -U pip build
python -m build --sdist --wheel
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8
# dont specify anything for Trusted Publishing
# https://docs.pypi.org/trusted-publishers
# with:
# # Using token
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
#
# # Using token on test index
# password: ${{ secrets.PYPI_TEST_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/nautilus
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
restrict-to: openzim/nautilus
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: Docker
name: Publish Docker dev image

on:
push:
branches:
- main
tags:
- v*

jobs:
build-and-push:
name: Deploy Docker Image
publish:
runs-on: ubuntu-22.04

steps:
- uses: actions/[email protected]
- name: Build and push
- uses: actions/checkout@v3

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/nautilus
on-master: dev
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
manual-tag: dev
latest-on-tag: false
restrict-to: openzim/nautilus
registries: ghcr.io
credentials:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/QA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: QA

on:
pull_request:
push:
branches:
- main

jobs:
check-qa:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[lint,scripts,test,check]
- name: Check black formatting
run: inv lint-black

- name: Check ruff
run: inv lint-ruff

- name: Check pyright
run: inv check-pyright
75 changes: 75 additions & 0 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
run-tests:
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: x64

- name: Install dependencies (and project)
run: |
pip install -U pip
pip install -e .[test,scripts]
- name: Run the tests
run: inv coverage --args "-vvv"

- name: Upload coverage report to codecov
if: matrix.python == '3.12'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

build_python:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml
architecture: x64

- name: Ensure we can build Python targets
run: |
pip install -U pip build
python3 -m build --sdist --wheel
build_docker:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Ensure we can build the Docker image
run: |
docker build -t testimage .
- name: Ensure we can start the Docker image
run: |
docker run --rm testimage
# OR if image is a daemon process
# - name: Ensure we can start the Docker image
# run: |
# docker run --rm testimage
# sleep 5
# docker ps | grep test_container
# docker stop test_container
36 changes: 0 additions & 36 deletions .github/workflows/qa.yml

This file was deleted.

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

This file was deleted.

67 changes: 62 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
src/nautiluszim/templates/vendors/*
precompiled.js
output/
input/
contrib/
*.orig
node_modules
package-lock.json

# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -20,7 +33,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -50,6 +62,11 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
Expand All @@ -68,6 +85,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -78,7 +96,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -87,7 +107,22 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
Expand Down Expand Up @@ -124,5 +159,27 @@ dmypy.json
# Pyre type checker
.pyre/

nautiluszim/templates/vendors/*
precompiled.js
# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
Loading

0 comments on commit cf6bc34

Please sign in to comment.