Skip to content

Transition CI/CD to GitHub Workflows #1

Transition CI/CD to GitHub Workflows

Transition CI/CD to GitHub Workflows #1

Workflow file for this run

name: CI/CD
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
release:
types: [created]
branches:
- 'master'
workflow_dispatch:
env:
FORCE_COLOR: "1" # Make tools pretty.
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
PYTHON_LATEST: "3.11"
# For re-actors/checkout-python-sdist
sdist-artifact: python-package-distributions
jobs:
build-sdist:
name: 📦 Build the source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- run: python -m pip install build
name: Install core libraries for build and install
- name: Build artifacts
run: python -m build
- name: Upload built artifacts for testing
uses: actions/upload-artifact@v3
with:
name: ${{ env.sdist-artifact }}
# NOTE: Exact expected file names are specified here
# NOTE: as a safety measure — if anything weird ends
# NOTE: up being in this dir or not all dists will be
# NOTE: produced, this will fail the workflow.
path: dist/${{ env.sdist-name }}
retention-days: 15
# setup-kafka:
# name: Get latest Kafka releases
# runs-on: ubuntu-latest
# steps:
# - name: Pull Kafka releases
# run: build_integration.sh
# # TODO: Cache releases to expedite testing
test-pytest:
name: Tests on ${{ matrix.python-version }}
needs:
- build-sdist
- setup-kafka

Check failure on line 65 in .github/workflows/python-package.yml

View workflow run for this annotation

GitHub Actions / CI/CD

Invalid workflow file

The workflow is not valid. .github/workflows/python-package.yml (Line: 65, Col: 9): Job 'test-pytest' depends on unknown job 'setup-kafka'. .github/workflows/python-package.yml (Line: 124, Col: 9): Job 'check' depends on job 'test-pytest' which creates a cycle in the dependency graph.
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "pypy3.9"
# kafka-version:
# - "0.8"
# - "0.9"
# - "0.10"
# - "0.11"
# - "1.0"
# - "1.1"
# - "2.0"
# - "2.1"
# - "2.2"
# - "2.3"
# - "2.4"
# - "2.5"
# - "2.6"
experimental: [ false ]
# include:
# - python-version: "~3.12.0-0"
# experimental: true
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
pip install .
pip install -r requirements-dev.txt
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
check: # This job does nothing and is only used for the branch protection
name: ✅ Ensure the required checks passing
if: always()
needs:
- build-sdist
- test-pytest
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
publish: # Run only on creating release for new tag
name: 📦 Publish to PyPI
runs-on: ubuntu-latest
needs: check
permissions:
id-token: write
environment: pypi
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Download the sdist artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.sdist-artifact }}
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}