Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build wheels for Linux, MacOS, Windows. PyPi release from GitHub acti…
…ons.
- Loading branch information
Showing
15 changed files
with
251 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Patch cmark-gfm | ||
description: Apply local modifications to cmark-gfm | ||
runs: | ||
using: "composite" | ||
using: composite | ||
steps: | ||
- run: git -C third_party/cmark apply $PWD/tasklist-id.patch | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Package and upload to PyPi | ||
on: | ||
release: | ||
types: [published, edited] | ||
jobs: | ||
build: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, windows-2022, macos-12] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Patch cmark-gfm | ||
uses: ./.github/actions/cmark-gfm-patch | ||
|
||
- uses: actions/setup-python@v3 | ||
name: Install Python | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install build deps | ||
run: | | ||
python -m pip --disable-pip-version-check install cibuildwheel==2.15.0 twine==4.0.2 | ||
- uses: docker/setup-qemu-action@v1 | ||
if: runner.os == 'Linux' | ||
name: Set up QEMU | ||
|
||
- name: Build wheels | ||
run: | | ||
python -m cibuildwheel --output-dir dist | ||
twine check ./dist/*.whl | ||
- name: Build sdist | ||
if: runner.os == 'Linux' | ||
run: | | ||
python setup.py sdist | ||
twine check ./dist/*.tar.gz | ||
- uses: actions/upload-artifact@v3 | ||
name: Upload wheels and sdist | ||
with: | ||
name: dist-${{ matrix.os }} | ||
path: |- | ||
./dist/*.whl | ||
./dist/*.tar.gz | ||
upload-pypi: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
id-token: write | ||
needs: [build] | ||
|
||
steps: | ||
- name: Retrieve dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
# No name to download from all matrix runs. | ||
path: all_dists | ||
|
||
- name: Combine dists into one folder | ||
run: |- | ||
mkdir -p dist | ||
find all_dists/ -type f -exec cp -v '{}' dist/ ';' | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Check tests & typing | ||
on: | ||
pull_request: | ||
push: | ||
release: | ||
jobs: | ||
test: | ||
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Patch cmark-gfm | ||
uses: ./.github/actions/cmark-gfm-patch | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip pytest | ||
python -m pip install -e . | ||
- name: Test with pytest | ||
run: pytest tests | ||
|
||
- name: Test installing from sdist | ||
run: | | ||
python setup.py sdist | ||
python -m venv /tmp/sdist-test | ||
/tmp/sdist-test/bin/pip install ./dist/*.tar.gz | ||
/tmp/sdist-test/bin/python -c 'import pycmarkgfm; print(pycmarkgfm.gfm_to_html("it *works*"))' | grep '<p>it <em>works</em></p>' | ||
check-typing: | ||
name: Check typing with mypy | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: python -m pip install mypy | ||
|
||
- name: Check types | ||
run: mypy pycmarkgfm/ tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Generate cmark header files | ||
on: | ||
push: | ||
branches: [doesnotexit] | ||
workflow_dispatch: | ||
jobs: | ||
generate: | ||
name: Generate cmake header files for ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Patch cmark-gfm | ||
uses: ./.github/actions/cmark-gfm-patch | ||
|
||
- name: Build | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake ../third_party/cmark | ||
- name: Copy (Windows) | ||
if: runner.os == 'Windows' | ||
working-directory: ./build | ||
run: | | ||
Get-ChildItem -Recurse | ||
New-Item -ItemType Directory -Force -Path ${{ github.workspace }}/generated/windows | ||
Copy-Item -Force -Path extensions/cmark-gfm-extensions_export.h -Destination ${{ github.workspace }}/generated/windows | ||
Copy-Item -Force -Path src/cmark-gfm_export.h -Destination ${{ github.workspace}}/generated/windows | ||
Copy-Item -Force -Path src/cmark-gfm_version.h -Destination ${{ github.workspace}}/generated/windows | ||
Copy-Item -Force -Path src/config.h -Destination ${{ github.workspace }}/generated/windows | ||
- name: Copy (Unix) | ||
if: runner.os == 'Linux' | ||
working-directory: ./build | ||
run: | | ||
ls -lRa | ||
mkdir -p ${{ github.workspace }}/generated/unix | ||
cp extensions/cmark-gfm-extensions_export.h src/cmark-gfm_export.h src/cmark-gfm_version.h src/config.h ${{ github.workspace }}/generated/unix | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
add-paths: generated/ | ||
title: Update generated headers for ${{ runner.os }} | ||
commit-message: Update generated headers for ${{ runner.os }}. | ||
body: '' | ||
reviewers: zopieux | ||
branch: gen-headers | ||
branch-suffix: short-commit-hash | ||
delete-branch: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.