From 7f10a50e8869459afea3974218b1c234cb1945e0 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Mon, 10 Jun 2024 22:37:10 +0900 Subject: [PATCH] Setup repository (#1) --- .github/workflows/main.yml | 86 ++++++++++++++++++++++++++++++++++++++ .gitignore | 30 +++++++++++++ .pre-commit-config.yaml | 82 ++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 9 ++++ pyproject.toml | 5 +-- 5 files changed, 209 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..52d2e07c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,86 @@ +name: main + +on: + push: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Build + run: | + python -m pip install build + python -m build . + + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Test + run: | + python -m pip install --upgrade pip + pip install ".[test]" + + pytest -v \ + --junitxml=test-results/junit.xml \ + --cov=pyodide-build \ + pyodide_build + + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: false + + publish: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + needs: + - build + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + environment: + name: pypi + url: https://pypi.org/p/pyodide-build + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..cacd4609 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +*.a +*.o +*.pyc +*.gen.* +*.out.* + +*.egg-info/ + +__pycache__ + +.docker_home +.hypothesis +.idea +.mozilla +.mypy_cache/ +.pytest_cache/ +.vscode +.venv* + +build +ccache +dist*/ +docs/_build/ +emsdk/emsdk +geckodriver.log +node_modules +dist/ +pyodide-build/**/build.log +xbuildenv/ +.pyodide-xbuildenv* \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..18ede844 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,82 @@ +default_language_version: + python: "3.12" +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.6.0" + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + exclude: .clang-format + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.3.5" + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.10.0" + hooks: + - id: python-use-type-annotations + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: "v0.10.0.1" + hooks: + - id: shellcheck + + - repo: https://github.com/codespell-project/codespell + rev: "v2.2.6" + hooks: + - id: codespell + args: + [ + "--ignore-words-list", + "ags,aray,asend,ba,classs,crate,falsy,feld,inflight,lits,nd,slowy,te,oint,conveniant", + ] + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.10.0" + hooks: + - id: mypy + files: ^(pyodide-build/pyodide_build) + exclude: (.*test.*) + args: [] + additional_dependencies: &mypy-deps + - packaging + - types-docutils + - types-pyyaml + - types-setuptools + - types-requests + - numpy + - build + - pytest + - pydantic>=2.0 + - unearth + - resolvelib + - rich + - auditwheel_emscripten + - pyodide-lock==0.1.0a5 + - id: mypy + name: mypy-tests + args: [--ignore-missing-imports] + files: ^(conftest.py|src/tests|pyodide-build/pyodide_build/tests) + additional_dependencies: *mypy-deps + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v4.0.0-alpha.8" + hooks: + - id: prettier + +ci: + autoupdate_schedule: "quarterly" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..3fa3076a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +- pyodide-build is now developed under https://github.com/pyodide/pyodide-build. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f1dd9dbd..70687b42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,10 +60,9 @@ xbuildenv = "pyodide_build.cli.xbuildenv:app" [project.optional-dependencies] test = [ - # (FIXME: 2024/01/28) The latest pytest-asyncio 0.23.3 is not compatible with pytest 8.0.0 - "pytest<8.0.0", - "pytest-pyodide==0.57.0", + "pytest", "pytest-httpserver", + "pytest-cov", "packaging", ]