Skip to content

Commit

Permalink
Setup repository (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 authored Jun 10, 2024
1 parent db82968 commit 7f10a50
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 3 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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*
82 changes: 82 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down

0 comments on commit 7f10a50

Please sign in to comment.