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

Zimfarm readyness #14

Merged
merged 29 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e9e404b
Rework CLI arguments + upgrade to Zimscraperlib 3.1.1
mdp Jul 31, 2023
c081320
Revert name change
benoit74 Aug 21, 2023
63e1bee
Use toptal .gitignore
benoit74 Aug 21, 2023
a042cb7
Adapt components names
benoit74 Aug 21, 2023
75acfee
Rework to simplify CLI arguments + align with common openzim scrapers…
benoit74 Aug 22, 2023
15ebea1
Adopt Python bootstrap conventions + other small fixes
benoit74 Aug 22, 2023
fa31089
Add utility function to compute/check ZIM descriptions based on defau…
benoit74 Aug 22, 2023
249ca7a
Switch to official NodeJS image instead of devcontainer one
benoit74 Aug 22, 2023
5662d2b
Remove devcontainer since it did not worked
benoit74 Aug 22, 2023
929e4c3
Return error code when scrapper has to stop
benoit74 Aug 22, 2023
e6a25b4
Install Python dependencies early to benefit for Docker build cache
benoit74 Aug 22, 2023
49af8e6
Update deps
benoit74 Aug 22, 2023
4a447aa
Switch pyright mode to basic for now
benoit74 Aug 22, 2023
fac9ab0
Fix workflow for Docker test
benoit74 Aug 22, 2023
8720c37
Ignore B108 issue about /tmp
benoit74 Aug 22, 2023
b66a27a
Delete unmaintained files
benoit74 Aug 22, 2023
4f8a45b
Enhance README.md following review comments
benoit74 Aug 23, 2023
aea2a4f
Move scraper logic to specific class + prepare everything asap + othe…
benoit74 Aug 23, 2023
12c5e16
Add tests for scraper checks at initialization
benoit74 Aug 23, 2023
791bb58
Replace pypi-readme.rst by README.md
benoit74 Aug 23, 2023
ba102f2
Remove TODO since it can't be done for now
benoit74 Aug 23, 2023
90f434a
Revert Dockerfile to regular way of building
benoit74 Aug 24, 2023
4a50085
Use date instead of datetime + add missing ruff ignore
benoit74 Aug 24, 2023
a930123
Do not ignore .map files which are not generated by Vite anymore
benoit74 Aug 24, 2023
5195ecb
docstring
benoit74 Aug 24, 2023
1251432
Remove useless parenthesis
benoit74 Aug 28, 2023
d64c514
Use more meaningfull args value
benoit74 Aug 28, 2023
7b5bef0
Move debug-only options to environment variables
benoit74 Aug 28, 2023
2fd2853
Simplify stuff following review
benoit74 Aug 29, 2023
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
25 changes: 0 additions & 25 deletions .devcontainer/devcontainer.json

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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: 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.8
with:
packages-dir: scraper/dist/

- name: Build and push Docker image
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/freecodecamp
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
restrict-to: openzim/freecodecamp
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,29 +1,27 @@
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/freecodecamp
on-master: dev
tag-pattern: /^v([0-9.]+)$/
latest-on-tag: true
manual-tag: dev
latest-on-tag: false
restrict-to: openzim/freecodecamp
registries: ghcr.io
credentials:
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
repo_description: auto
repo_overview: auto
repo_overview: auto
66 changes: 66 additions & 0 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tests

on:
pull_request:
push:
branches:
- main

jobs:
run-tests:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
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"
benoit74 marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
directory: backend
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: 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_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 --version
39 changes: 0 additions & 39 deletions .github/workflows/integration.yaml

This file was deleted.

47 changes: 23 additions & 24 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
name: QA

on:
push:
branches: main
pull_request:

env:
MAX_LINE_LENGTH: 88
push:
branches:
- main

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

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- uses: actions/checkout@v3

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

- name: Install lint requirements
- name: Install dependencies (and project)
working-directory: scraper
run: |
pip install -r openzim/lint_requirements.txt
pip install -U pip
pip install -e .[lint,scripts,test,check]

- name: Check black formatting
run: |
black --version
black --check .
working-directory: scraper
run: inv lint-black

- name: Check flake8 linting
run: |
flake8 --version
flake8 . --count --max-line-length=$MAX_LINE_LENGTH --statistics
- name: Check ruff
working-directory: scraper
run: inv lint-ruff

- name: Check import order with isort
run: |
isort --version
isort --profile black --check .
- name: Check pyright
working-directory: scraper
run: inv check-pyright
Loading