Skip to content

Enable CI/CD and standardize build system setup #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
139 changes: 139 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Development

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
quality-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run quality checks
run: tox -e quality

type-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run quality checks
run: tox -e types

precommit-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install pre-commit
- name: Run pre-commit checks
run: pre-commit run --all-files

unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e test-unit -- -m "smoke or sanity"

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run integration tests
run: tox -e test-integration -- -m smoke

build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
python: ["3.9"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Build the package
run: |
export SPECULATORS_BUILD_TYPE=dev
export SPECULATORS_BUILD_ITERATION=${{ github.event.pull_request.number }}
tox -e build
- name: Upload build artifacts
id: artifact-upload
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist/*
compression-level: 6
if-no-files-found: error
retention-days: 30
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GH_NM_REDHAT_AUTOMATION_APP_ID }}
private-key: ${{ secrets.GH_NM_REDHAT_AUTOMATION_APP_PRIVATE_KEY }}
- name: Comment Install instructions
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `📦 **Build Artifacts Available**
The build artifacts (\`.whl\` and \`.tar.gz\`) have been successfully generated and are available for download: ${{ steps.artifact-upload.outputs.artifact-url }}.
They will be retained for **up to 30 days**.
`
})
87 changes: 87 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Main

on:
push:
branches:
- main

jobs:
quality-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run quality checks
run: tox -e quality

type-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run quality checks
run: tox -e types

precommit-checks:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install pre-commit
- name: Run pre-commit checks
run: pre-commit run --all-files

unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e test-unit -- -m "smoke or sanity"

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run integration tests
run: tox -e test-integration -- -m smoke
108 changes: 108 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Nightly

on:
schedule:
- cron: '0 0 * * *' # Runs at midnight every night

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run unit tests
run: tox -e test-unit -- --cov=speculators --cov-report=term-missing --cov-fail-under=75

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run integration tests
run: tox -e test-integration -- -m "smoke or sanity"

e2e-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Run integration tests
run: tox -e test-e2e -- -m smoke

build-and-publish:
needs: [unit-tests, integration-tests, e2e-tests]
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox
- name: Build the package
run: |
export SPECULATORS_BUILD_TYPE=nightly
tox -e build
- name: Find wheel artifact
id: find-asset-whl
run: |
echo "::set-output name=asset::$(find dist -name '*.whl')"
- name: Find tar.gz artifact
id: find-asset-targz
run: |
echo "::set-output name=asset::$(find dist -name '*.tar.gz')"
- name: Push wheel to PyPI
uses: neuralmagic/nm-actions/actions/[email protected]
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-whl.outputs.asset }}
- name: Push tar.gz to PyPI
uses: neuralmagic/nm-actions/actions/[email protected]
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-targz.outputs.asset }}
- name: Upload build artifacts
id: artifact-upload
uses: actions/upload-artifact@v4
with:
name: nightly-build-artifacts
path: dist/*
compression-level: 6
if-no-files-found: error
retention-days: 30
- name: Log artifact location
run: |
echo "Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}"
Loading