Skip to content

Bump actions/upload-artifact from 6 to 7 #37

Bump actions/upload-artifact from 6 to 7

Bump actions/upload-artifact from 6 to 7 #37

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Check linting
run: ruff check fdb_record_layer tests
- name: Check formatting
run: ruff format --check fdb_record_layer tests
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy types-protobuf
pip install -e .
- name: Run mypy
run: mypy fdb_record_layer
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,sql]"
- name: Run tests
run: pytest tests -v --tb=short
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,sql]"
pip install pytest-cov
- name: Run tests with coverage
run: pytest tests --cov=fdb_record_layer --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install FDB client library
run: |
# Download and install FDB client library (7.4.x for API version 740 support)
wget https://github.com/apple/foundationdb/releases/download/7.4.5/foundationdb-clients_7.4.5-1_amd64.deb
sudo dpkg -i foundationdb-clients_7.4.5-1_amd64.deb
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,sql]"
pip install grpcio-tools
- name: Compile test protobufs
run: |
python -m grpc_tools.protoc \
--python_out=tests/integration \
--proto_path=tests/integration \
tests/integration/test_records.proto
- name: Create cluster file
run: echo "docker:docker@127.0.0.1:4500" > fdb.cluster
- name: Start FDB container
run: |
docker run -d --name fdb-test \
-p 4500:4500 \
-e FDB_NETWORKING_MODE=container \
-e FDB_COORDINATOR_PORT=4500 \
-e FDB_PORT=4500 \
-v $(pwd)/fdb.cluster:/var/fdb/fdb.cluster \
foundationdb/foundationdb:7.4.5
- name: Wait for FDB and configure
run: |
echo "Waiting for FDB to start..."
sleep 10
MAX_RETRIES=30
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if docker exec fdb-test fdbcli --exec "status" 2>/dev/null; then
echo "FDB is responding!"
break
fi
RETRY_COUNT=$((RETRY_COUNT + 1))
echo "Waiting for FDB... ($RETRY_COUNT/$MAX_RETRIES)"
sleep 2
done
echo "Configuring database..."
docker exec fdb-test fdbcli --exec "configure new single memory" || true
echo "Waiting for database to be ready..."
sleep 5
docker exec fdb-test fdbcli --exec "status"
- name: Run integration tests
run: pytest tests/integration/ -v --tb=short
env:
FDB_CLUSTER_FILE: ./fdb.cluster
- name: Stop FDB container
if: always()
run: docker stop fdb-test && docker rm fdb-test || true
build:
name: Build Package
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/