Bump the actions group across 1 directory with 2 updates #138
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
name: Python | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
pull_request: | |
branches: [master] | |
paths: | |
- "src/*.h" | |
- "src/*.cpp" | |
- "src/**/*.pyi" | |
- "src/CMakeLists.txt" | |
- "src/cmake/**" | |
- "src/utility/CMakeLists.txt" | |
- "src/utility/linux_kernel/*" | |
- ".github/workflows/build_python.yml" | |
push: | |
branches: [master] | |
paths: | |
- "src/*.h" | |
- "src/*.cpp" | |
- "src/**/*.pyi" | |
- "src/CMakeLists.txt" | |
- "src/cmake/**" | |
- "src/utility/CMakeLists.txt" | |
- "src/utility/linux_kernel/*" | |
- ".github/workflows/build_python.yml" | |
jobs: | |
check_source: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
id: python-setup | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Checkout Current Repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Install pre-commit, twine, and lib stubs | |
run: pip install pre-commit twine build . | |
- name: Create source distribution | |
run: python -m build -s | |
- name: Cache pre-commit venv | |
uses: actions/cache@v4 | |
with: | |
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
path: '~/.cache/pre-commit' | |
- name: run pre-commit on all files | |
run: pre-commit run --all-files | |
- name: Checks distributable with twine | |
shell: bash | |
run: twine check dist/* | |
- name: Save distributable source as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "cirque_pinnacle-sdist" | |
path: ${{ github.workspace }}/dist | |
build_linux: | |
runs-on: ubuntu-latest | |
needs: [check_source] | |
env: | |
BUILD_ARCH: native | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
sudo apt-get install python3-dev | |
python3 -m pip install --upgrade pip | |
python3 -m pip install twine | |
- name: Fetch distributable source artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: "cirque_pinnacle-sdist" | |
path: ${{ github.workspace }}/sdist | |
- name: Try install from source distributable | |
run: pip install sdist/*.tar.gz -v | |
- name: Checkout Current Repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Build aarch64 and armv7l? | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
run: echo "BUILD_ARCH=aarch64 armv7l ${{ env.BUILD_ARCH }}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
if: contains(env.BUILD_ARCH, 'aarch64') | |
- name: Build binary wheels with cibuildwheels | |
uses: pypa/cibuildwheel@v2.22.0 | |
env: | |
CIBW_ARCHS_LINUX: ${{ env.BUILD_ARCH }} | |
CIBW_SKIP: cp36* pp* *ppc64le *s390x | |
- name: Move cross-compiled wheels to dist folder | |
run: | | |
mkdir -p dist | |
mv ./wheelhouse/*.whl ${{ github.workspace }}/dist/ | |
- name: checks distributable with twine | |
run: python3 -m twine check dist/* | |
- name: Save distributable wheels as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "cirque_pinnacle-bdist" | |
path: ${{ github.workspace }}/dist | |
release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
needs: [check_source, build_linux] | |
permissions: | |
id-token: write | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Fetch distributable wheel artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: "cirque_pinnacle-bdist" | |
path: ${{ github.workspace }}/dist | |
- name: Fetch distributable source artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: "cirque_pinnacle-sdist" | |
path: ${{ github.workspace }}/dist | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install twine | |
- name: Publish package (to TestPyPI) | |
if: github.event_name == 'workflow_dispatch' | |
uses: pypa/gh-action-pypi-publish@v1.12.3 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPi | |
# only upload distributions to PyPi when triggered by a published release | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@v1.12.3 |