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

freeCodeCamp builder #5

Merged
merged 81 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
daba374
WIP scaffolding
mdp Jan 31, 2023
2749a29
Rework branch
mdp Apr 18, 2023
c2cdb84
ESlint and prettier
mdp Apr 19, 2023
92d94ae
Update licenses
mdp Apr 19, 2023
3083ab2
Runner working, stake commit
mdp Apr 19, 2023
16bdde5
Minor eslint fix
mdp Apr 19, 2023
eef19f4
Prettier
mdp Apr 19, 2023
aa85c42
Full functionality, but no styling
mdp Apr 19, 2023
0c17d9f
Tests working
mdp Apr 19, 2023
120d35d
Github actions
mdp Apr 19, 2023
1d750b5
Fix workflow
mdp Apr 19, 2023
f05996f
Figure out working directory issue
mdp Apr 19, 2023
4c8ee5c
Update Readme and add quick start script
mdp Apr 19, 2023
5e7308d
Working demo
mdp Apr 20, 2023
cb70dd3
Fix build
mdp Apr 21, 2023
c979aaf
Minor fix
mdp Apr 21, 2023
2a2279f
Fix tests
mdp May 2, 2023
d6ef8e8
Fix code issues
mdp May 2, 2023
f09c9d9
Minore image fix
mdp May 16, 2023
1c0807e
Better reactive and naming
mdp May 16, 2023
885cd78
Now with 8 courses
mdp May 16, 2023
24d1be6
List all courses
mdp May 16, 2023
eaeae18
Fix code issues
mdp May 16, 2023
26e643e
Fix test error on CI
mdp May 16, 2023
c8f44da
Run tests twice to catch issues with real curriculum
mdp May 16, 2023
4302626
Docker plus a Makefile
mdp May 17, 2023
e8a7823
Fix build process, remove unneeded Dockerfile
mdp May 17, 2023
ab14dcd
Typo
mdp May 17, 2023
f4dd2d0
Readme formatting
mdp May 17, 2023
6046034
Phony for all
mdp May 17, 2023
87aca03
Working directory removed
mdp May 18, 2023
b48576b
Not every challenge has instructions
mdp May 18, 2023
af9a07a
Build improvments
mdp May 18, 2023
4f46324
More general cleanup
mdp May 18, 2023
3f16930
Dockerize and i18n fixes
mdp May 19, 2023
e9c2162
Fix lint and tests
mdp May 19, 2023
ceb749e
Better shell compatibility
rgaudin May 30, 2023
7e3779c
Fetch from public vs assets
mdp Jun 1, 2023
14bf8ef
Remove frontmatter and just use pyyaml
mdp Jun 2, 2023
928fd4b
Black formatting
mdp Jun 2, 2023
6d6c9ea
Single command, plus client docker
mdp Jun 2, 2023
e008605
Fix formatting
mdp Jun 2, 2023
801b32f
Move to multistage docker
mdp Jun 5, 2023
08e1634
Fix version, add linting
mdp Jun 5, 2023
f92c462
Linting and integration workflow
mdp Jun 5, 2023
3c4e60a
Fix integration workflow, fix Dockerfile code smell
mdp Jun 5, 2023
8e53c3f
Minor fix to makedirs
mdp Jun 6, 2023
945eee8
Improved Readme, make tests run well in production and dev for integr…
mdp Jun 6, 2023
5baf2c4
integration tests should only run on main and PRs
mdp Jun 6, 2023
be4dac3
Remove 'act' and docker from devcontainer
mdp Jun 6, 2023
97e4e86
Ensure build of client in integration test
mdp Jun 6, 2023
9d871b4
Add README to setup.py
mdp Jun 6, 2023
3bcad7d
Map chinese to 3 letter iso, put lang map in root definition
mdp Jun 9, 2023
9123762
Apply suggestions from code review
mdp Jun 12, 2023
bb44d49
Update to fix lint issues
mdp Jun 14, 2023
309eec1
Improvement per review feedback
mdp Jun 14, 2023
0423bb0
PEP8 naming conventions
mdp Jun 15, 2023
ab25bda
Better use of pathlib
mdp Jun 15, 2023
49f270f
Prevent double run of QA
mdp Jun 15, 2023
4d6e315
All JSON reads to one liner
mdp Jun 15, 2023
2910064
Finalized Prebuild PR review changes
mdp Jun 15, 2023
9c5bf92
Add required fields to metadata
mdp Jun 15, 2023
2f53afd
Build.py cleanup per code review
mdp Jun 15, 2023
850ca63
Fix arguments
mdp Jun 15, 2023
26d269c
Fix redirect, improve course list
mdp Jun 15, 2023
262a353
Standardize to same path as FCC for web urls
mdp Jun 15, 2023
0e9c0be
Linting
mdp Jun 15, 2023
36ba74e
Updated docs
mdp Jun 15, 2023
7efb210
Fix zim builder for new schema
mdp Jun 15, 2023
39b7a0f
Default to english, hack to fix bottom margin in iframe
mdp Jun 16, 2023
4d36d2e
Apply suggestions from code review
mdp Jul 13, 2023
6317096
Fix: PR Feedback and schema change from FCC
mdp Jul 13, 2023
4a0802b
fixed docstring
rgaudin Jul 18, 2023
38e6a0a
better pathlib usage
rgaudin Jul 18, 2023
aaeb0ae
removed kiwix-js specific css hack
rgaudin Jul 18, 2023
4dc184f
in this source JSON, it's a list of tuples
rgaudin Jul 18, 2023
b664158
target folder also needs to be created
rgaudin Jul 18, 2023
40b3351
making sure course meta file folder exists
rgaudin Jul 18, 2023
ae0f731
Fix for both tuple and IDs
rgaudin Jul 18, 2023
1143f4f
Fix: prebuild issue with mkdir on challenge destination
mdp Jul 18, 2023
3bf8ac6
Fix: lint
mdp Jul 18, 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: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-20",
"features": {
"ghcr.io/devcontainers/features/python:1": {}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
29 changes: 29 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker

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

jobs:
build-and-push:
name: Deploy Docker Image
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Build and push
uses: openzim/docker-publish-action@v10
with:
image-name: openzim/freecodecamp
on-master: dev
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
39 changes: 39 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and test the freeCodeCamp zim file

on:
pull_request:
push:
branches:
- 'main'
jobs:
integration-test:
runs-on: ubuntu-latest
name: Build latest zim file
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- run: yarn install --frozen-lockfile
working-directory: client
- run: yarn lint
working-directory: client
- run: yarn build
working-directory: client

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

- run: make setup
- run: make fetch
- run: make prebuild

# Full integration test using the fetch/prebuild markdown as a fixture
- run: yarn test --run
working-directory: client

- run: make zim
39 changes: 39 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: QA

on:
push:
branches: main
pull_request:

env:
MAX_LINE_LENGTH: 88

jobs:
check-qa:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies


- name: Install lint requirements
run: |
pip install -r openzim/lint_requirements.txt

- name: Check black formatting
run: |
black --version
black --check .

- name: Check flake8 linting
run: |
flake8 --version
flake8 . --count --max-line-length=$MAX_LINE_LENGTH --statistics

- name: Check import order with isort
run: |
isort --version
isort --profile black --check .
143 changes: 16 additions & 127 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1,18 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
# Logs
logs
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

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

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

tmp
build
*.zim
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/devcontainers/typescript-node:20 as client

WORKDIR /src
COPY client /src
RUN yarn install --frozen-lockfile
RUN yarn build


FROM python:3.11-buster

WORKDIR /src
COPY openzim/requirements.txt /src
RUN pip install -r requirements.txt --no-cache-dir

COPY openzim /src
COPY --from=client /src /src/client


ENTRYPOINT ["python3", "fcc2zim"]
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
13 changes: 13 additions & 0 deletions LICENSE.fcc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BSD 3-Clause License

Copyright (c) 2023, freeCodeCamp. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading