Skip to content

Commit

Permalink
Make CD part
Browse files Browse the repository at this point in the history
* add dependabot, yamllint
  • Loading branch information
penguinolog committed Nov 22, 2023
1 parent 5e32006 commit 46be066
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 80 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
140 changes: 64 additions & 76 deletions .github/workflows/pythonpackage.yml
Expand Up @@ -181,8 +181,8 @@ jobs:
max-parallel: 8
matrix:
WINDOWS:
- { ARCH: 'x86', WINDOWS: 'win32' }
- { ARCH: 'x64', WINDOWS: 'win64' }
- {ARCH: 'x86', WINDOWS: 'win32'}
- {ARCH: 'x64', WINDOWS: 'win64'}
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
name: "Cython based python ${{ matrix.python-version }} on ${{ matrix.WINDOWS.WINDOWS }}"

Expand Down Expand Up @@ -256,78 +256,66 @@ jobs:
run: |
twine check dist/*
# DeployWindows:
# needs: [TestLinux, TestWindows]
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
# runs-on: windows-latest
# strategy:
# max-parallel: 6
# matrix:
# WINDOWS:
# - { ARCH: 'x86', WINDOWS: 'win32' }
# - { ARCH: 'x64', WINDOWS: 'win64' }
# python-version: [3.7, 3.8, 3.9]
# name: "Release for python ${{ matrix.python-version }} on ${{ matrix.WINDOWS.WINDOWS }}"
#
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# architecture: ${{ matrix.WINDOWS.ARCH }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip wheel
# pip install --upgrade -r build_requirements.txt
# pip install --upgrade twine
# - name: Build package
# run: |
# python setup.py sdist bdist_wheel clean
# - name: Deploy
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: |
# twine upload --skip-existing dist/*
build_wheels:
name: Build wheels on ${{ matrix.os }}
needs: [ TestScript, TestLinux, TestWindows ]
# build only on push: heavy job
if: github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # need for setuptools_scm

# Used to host cibuildwheel
- uses: actions/setup-python@v4.7.0
with:
python-version: "3.11"

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 universal2 arm64

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: wheels
retention-days: 3

upload_pypi:
needs: [ Build, build_wheels, Metadata ]
# upload to PyPI on every tag
if: github.event_name == 'push' && github.ref_type == 'tag'
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/threaded
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: wheels` is omitted, the action will create extra parent dir
name: wheels
path: dist

# DeployManyLinux:
# needs: [ TestLinux, TestWindows ]
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
# runs-on: ubuntu-latest
# container:
# image: ${{ matrix.MANYLINUX.CONTAINER }}
# env:
# PYTHONDONTWRITEBYTECODE: 1
# strategy:
# matrix:
# PYTHON: [ "cp37-cp37m", "cp38-cp38", "cp39-cp39" ]
# MANYLINUX:
# - NAME: manylinux2010_x86_64
# CONTAINER: "quay.io/pypa/manylinux2010_x86_64"
# - NAME: manylinux2014_x86_64
# CONTAINER: "quay.io/pypa/manylinux2014_x86_64"
# name: "${{ matrix.PYTHON }} for ${{ matrix.MANYLINUX.NAME }}"
# steps:
# - uses: actions/checkout@v2
# - name: Install main dependencies
# run: |
# /opt/python/${{ matrix.PYTHON }}/bin/python -m pip install -U pip wheel setuptools
# /opt/python/${{ matrix.PYTHON }}/bin/pip install --upgrade -r build_requirements.txt
# /opt/python/${{ matrix.PYTHON }}/bin/pip install --upgrade twine
# - name: Build package
# run: /opt/python/${{ matrix.PYTHON }}/bin/python setup.py bdist_wheel clean
# - name: Bundle external shared libraries into the wheels
# run: |
# for whl in dist/*.whl; do
# echo "Repairing $whl..."
# auditwheel repair "$whl" -w dist/
# done
# - name: Cleanup OS specific wheels
# run: rm -fv dist/*-linux_*.whl
# - name: Deploy
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: |
# twine upload --skip-existing dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
23 changes: 23 additions & 0 deletions .github/workflows/yamllint.yml
@@ -0,0 +1,23 @@
name: Lint YAML

on:
pull_request:
paths:
- "**.yml"
- "**.yaml"

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip yamllint
- name: Lint YAML files
run: yamllint . -f github
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -98,6 +98,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
wheelhouse/
develop-eggs/
dist/
downloads/
Expand Down
4 changes: 0 additions & 4 deletions .pyup.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .yamllint.yml
@@ -0,0 +1,40 @@
---

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
line-length:
max: 120
allow-non-breakable-inline-mappings: true
level: warning
indentation:
indent-sequences: consistent
brackets:
max-spaces-inside: 1
level: warning
document-end: disable
document-start: disable
truthy: disable
braces: enable
colons:
level: warning
commas:
level: warning
comments:
level: warning
comments-indentation:
level: warning
empty-lines: enable
empty-values: disable
float-values: disable
hyphens: enable
key-duplicates: enable
key-ordering: disable
new-line-at-end-of-file: disable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
7 changes: 7 additions & 0 deletions pyproject.toml
Expand Up @@ -48,6 +48,13 @@ universal = 0
[tool.setuptools_scm]
write_to = "threaded/_version.py"

[tool.cibuildwheel]
# Disable building PyPy wheels on all platforms
# Disable musllinux as not popular platform
skip = ["pp*", "*-musllinux_*"]
before-build = "pip install -U pip cython -r CI_REQUIREMENTS.txt"
build-frontend = { name = "build", args = ["--no-isolation"] }

[tool.black]
line-length = 120
safe = true
Expand Down

0 comments on commit 46be066

Please sign in to comment.