Skip to content

chore: Pin GitHub Actions to full-length commit SHAs #996

chore: Pin GitHub Actions to full-length commit SHAs

chore: Pin GitHub Actions to full-length commit SHAs #996

Workflow file for this run

name: fab:build
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'tox.toml'
- 'requirements*.txt'
- '.github/workflows/fab-build.yml'
permissions:
contents: read
jobs:
# Linting Job
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- name: Set up Python 3.12
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: "3.12" # Use any stable Python version for linting
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
path: .tox
key: ${{ runner.os }}-tox-lint-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-lint-
- name: Run Linting
run: tox -e lint
# Type Checking Job
type-check:
name: Type Check Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- name: Set up Python 3.12
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: "3.12" # Use any stable Python version for type checking
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
path: .tox
key: ${{ runner.os }}-tox-type-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-type-
- name: Run Type Checks
run: tox -e type
# Testing Jobs with Matrix Strategy
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: "3.10"
tox-env: "py310"
- python-version: "3.11"
tox-env: "py311"
- python-version: "3.12"
tox-env: "py312"
- python-version: "3.13"
tox-env: "py313"
steps:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache Tox environments
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
with:
path: .tox
key: ${{ runner.os }}-tox-${{ matrix.tox-env }}-${{ hashFiles('**/tox.toml') }}
restore-keys: |
${{ runner.os }}-tox-${{ matrix.tox-env }}-
${{ runner.os }}-tox-
- name: Run Tests
run: tox -e ${{ matrix.tox-env }}
# Upload the coverage report as an artifact
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-html-report-${{ matrix.python-version }}
path: coverage_html
# Build Job
build:
name: Build Package
runs-on: ubuntu-latest
needs:
- test # Ensure all test jobs complete successfully
steps:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- name: Set up Python 3.12
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build