Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 8 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
branches: [ master ]

jobs:
build:
matrix_build:

runs-on: ${{ matrix.os }}
permissions:
contents: read
defaults:
run:
shell: bash
Expand All @@ -21,20 +23,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest]
python-version: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-24.04, macos-latest, windows-latest]
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']
steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
submodules: True
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -43,32 +45,8 @@ jobs:
python -m pip install --upgrade pip
pip install tox tox-gh-actions

- name: Install deps with apt helper action
uses: ryankurte/action-apt@v0.2.0
if: runner.os == 'Linux'
with:
# architectures to pass to dpkg --add-architecture
#architectures: # optional
packages: libusb-dev libusb-1.0.0-dev

- name: Run tests
run: |
tox
env:
PLATFORM: ${{ matrix.os }}

- name: Check pkg builds
run: |
tox -e deploy

- name: Check wheel
run: |
tox -e check

- name: Build C tool
if: runner.os == 'Linux'
run: |
tox -e badge
env:
CC: 'gcc'
CXX: 'g++'
51 changes: 30 additions & 21 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:
jobs:
pylint:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
permissions:
contents: read
defaults:
run:
shell: bash
Expand All @@ -19,7 +21,9 @@ jobs:
path: ${{ steps.analyze.outputs.path }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Extract base branch name
id: extract_branch
Expand All @@ -34,17 +38,21 @@ jobs:
else
EXPORT_VALUE="${TMP_GITHUB_REF}"
fi
echo "##[set-output name=branch;]${EXPORT_VALUE}"
echo "branch=${EXPORT_VALUE}" >> $GITHUB_OUTPUT

- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: '3.10'

- name: Install tox
run: |
python -m pip install --upgrade pip wheel
pip install tox tox-gh-actions
python -m pip install --upgrade pip
pip install tox

#- name: Run tox bare-ass
#run: |
#tox -e lint

- name: Run pylint
id: analyze
Expand All @@ -53,36 +61,37 @@ jobs:
run: |
rating=$(bash -c 'tox -e lint' | grep 'Your code has been rated at' | cut -f7 -d " ")
echo "Pylint score: ${rating}"
echo "##[set-output name=rating;]${rating}"
echo "##[set-output name=path;]${BADGE_PATH}"
echo "rating=${rating}" >> $GITHUB_OUTPUT
echo "path=${BADGE_PATH}" >> $GITHUB_OUTPUT

badge:
# Only generate and publish if these conditions are met:
# - The previous job/analyze step ended successfully
# - At least one of these is true:
# - This is a push event and the push event is on branch 'master' or 'develop'
# - This is a push event and the push event is on branch 'main' or 'develop'
# Note: if this repo is personal (ie, not an org repo) then you can
# use the following to change the scope of the next 2 jobs
# instead of running on branch push as shown below:
# - This is a pull request event and the pull actor is the same as the repo owner
# if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/master' }}
# if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/main' }}
name: Generate badge image with pylint score
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
permissions:
pull-requests: read
contents: write
actions: read
needs: [pylint]
if: ${{ github.event_name == 'push' }}
#outputs:
#url: ${{ steps.url.outputs.url }}
#markdown: ${{ steps.url.outputs.markdown }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
ref: badges
path: badges

# Use the output from the `analyze` step
- name: Create pylint badge
uses: emibcn/badge-action@v1.2.4
uses: emibcn/badge-action@808173dd03e2f30c980d03ee49e181626088eee8 # v2.0.3
id: badge
with:
label: 'Pylint score'
Expand All @@ -96,16 +105,16 @@ jobs:
FILE: 'pylint-score.svg'
working-directory: ./badges
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
mkdir -p "${BRANCH}"
mv "${FILE}" "${BRANCH}"
git add "${BRANCH}/${FILE}"
# Will give error if badge has not changed
git commit -m "Add/Update badge" || true

- name: Push badge commit
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: badges
Expand Down
75 changes: 23 additions & 52 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,26 @@
name: Release

on:
workflow_dispatch:
push:
# release on tag push
tags:
- '*'

jobs:
wheels:

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
PYTHONIOENCODING: utf-8
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-2019]
python-version: [3.7, 3.8, 3.9, '3.10']

steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
permissions:
contents: write

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install tox tox-gh-actions

- name: Build dist pkgs
run: |
tox -e deploy

- name: Upload artifacts
if: matrix.python-version == 3.8 && runner.os != 'Windows'
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
jobs:
build_wheels:
name: Build wheels
permissions:
contents: read
uses: ./.github/workflows/wheels.yml

create_release:
name: Create Release
needs: [wheels]
runs-on: ubuntu-20.04
needs: [build_wheels, build_docs]
runs-on: ubuntu-22.04

steps:
- name: Get version
Expand All @@ -64,21 +29,26 @@ jobs:
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}

- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0

# download all artifacts to project dir
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v5

- name: check artifacts
run: |
ls -l packages/

- name: Generate changes file
uses: sarnold/gitchangelog-action@master
uses: sarnold/gitchangelog-action@915234f151ceffb7a8c4f76de77e4ae321087b8f # v1.1.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN}}

- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -88,4 +58,5 @@ jobs:
draft: false
prerelease: false
files: |
wheels/cp210x*.whl
packages/*.whl
packages/*.tar.gz
Loading
Loading