Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: kiwix # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # https://kiwix.org/support-us/
15 changes: 15 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
daysUntilClose: false
staleLabel: stale

issues:
daysUntilStale: 60
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be now be reviewed manually. Thank you
for your contributions.
pulls:
daysUntilStale: 7
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be now be reviewed manually. Thank you
for your contributions.
24 changes: 24 additions & 0 deletions .github/workflows/DailyTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: DailyTests

on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:

jobs:
run-daily-tests:
runs-on: ubuntu-24.04

steps:
- name: checkout
uses: actions/checkout@v6

- name: Build the Docker image
run: |
docker build -t local-maps .

# - name: Run scraper
# run: docker run -v $PWD/output:/output local-maps maps2zim --library-url https://geo.libretexts.org --name libretexts.org_en_geo --creator LibreTexts --title "LibreTexts Geosciences" --description "Geosciences courses from libretexts.org" --root-page-id 28207 --file-name "tests_en_libretexts-geo"

# - name: Run integration test suite
# run: docker run -v $PWD/scraper/tests-integration:/src/scraper/tests-integration -v $PWD/output:/output -e ZIM_FILE_PATH=/output/tests_en_libretexts-geo.zim local-maps bash -c "pip install pytest; pytest -v /src/scraper/tests-integration"
45 changes: 45 additions & 0 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and upload to PyPI and ghcr.io

on:
release:
types: [published]

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

steps:
- uses: actions/checkout@v6

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

- name: Build packages
working-directory: scraper
run: |
pip install -U pip build
python -m build --sdist --wheel

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.13
with:
packages-dir: scraper/dist/

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

on:
push:
branches:
- main
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v6

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/maps
manual-tag: dev
latest-on-tag: false
restrict-to: openzim/maps
registries: ghcr.io
credentials: |
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
65 changes: 65 additions & 0 deletions .github/workflows/QA.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: QA

on:
pull_request:
push:
branches:
- main

jobs:
check-scraper-qa:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v6

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

- name: Install dependencies
working-directory: scraper
run: |
pip install -U pip
pip install -e .[lint,check,scripts,test]

- name: Check black formatting
working-directory: scraper
run: inv lint-black

- name: Check ruff
working-directory: scraper
run: inv lint-ruff

- name: Check pyright
working-directory: scraper
run: inv check-pyright

check-zimui-qa:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: zimui/package.json
cache: yarn
cache-dependency-path: zimui/yarn.lock

- name: Install JS dependencies
working-directory: zimui
run: yarn install --frozen-lockfile

- name: Check prettier
working-directory: zimui
run: |
yarn format

- name: Check eslint
working-directory: zimui
run: |
yarn lint
100 changes: 100 additions & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
test-scraper:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v6

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

- name: Install dependencies (and project)
working-directory: scraper
run: |
pip install -U pip
pip install -e .[test,scripts]

- name: Run the tests
working-directory: scraper
run: inv coverage --args "-vvv"

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

build-scraper:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6

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

- name: Ensure we can build Python targets
working-directory: scraper
run: |
pip install -U pip build
python3 -m build --sdist --wheel

build-and-test-zimui:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: zimui/package.json
cache: yarn
cache-dependency-path: zimui/yarn.lock

- name: Install dependencies
working-directory: zimui
run: |
yarn install

- name: Build
working-directory: zimui
run: |
yarn build

- name: Start web server
working-directory: zimui
run: |
yarn preview &

- name: Wait for web server to be ready
run: |
npx wait-on http://localhost:4173

# this job replaces the standard "build_docker" job since it builds the docker image
run-integration-tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6

- name: Build the Docker image
run: |
docker build -t local-maps .

# - name: Run scraper
# run: docker run -v $PWD/output:/output local-maps maps2zim --library-url https://geo.libretexts.org --name libretexts.org_en_geo --creator LibreTexts --title "LibreTexts Geosciences" --description "Geosciences courses from libretexts.org" --root-page-id 28207 --file-name "tests_en_libretexts-geo"

# - name: Run integration test suite
# run: docker run -v $PWD/scraper/tests-integration:/src/scraper/tests-integration -v $PWD/output:/output -e ZIM_FILE_PATH=/output/tests_en_libretexts-geo.zim local-maps bash -c "pip install pytest; pytest -v /src/scraper/tests-integration"
Loading