Change docs and site to mkdocs #383
Workflow file for this run
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: Main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
concurrency: | |
# Cancel CI runs on a branch (other than main) on updates.defaults: | |
# This limits redundant runs, but also ensures we get signal on every | |
# merge to main. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ !contains(github.ref, 'main')}} | |
jobs: | |
quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
# TODO: Caching | |
- name: Set up the environment | |
uses: ./.github/actions/setup-python-env | |
id: setup | |
- name: Install Python dependencies | |
run: uv sync --frozen --all-packages --all-extras | |
shell: bash | |
- name: Run `fmt-check` | |
run: uv run poe fmt-check | |
# Runs this as long as setup succeeds. | |
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }} | |
- name: Run `lint-check` | |
run: uv run poe lint-check | |
# Runs this as long as setup succeeds. | |
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }} | |
- name: Run `lock-check` | |
run: uv run poe lock-check | |
# Runs this as long as setup succeeds. | |
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }} | |
- name: Run `dep-check` | |
run: uv run poe dep-check | |
# Runs this as long as setup succeeds. | |
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }} | |
tests-and-type-check: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up the environment | |
uses: ./.github/actions/setup-python-env | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: uv sync --frozen --all-packages | |
shell: bash | |
- name: Test graph-retriever | |
run: | |
uv run coverage run -m pytest -vs packages/graph-retriever | |
--junitxml=junit/test-results-gr-${{ matrix.python-version }}.xml | |
- name: (non-3.12) Test langchain-graph-retriever (In-Memory Stores) | |
if: ${{ success() && matrix.python-version != '3.12' }} | |
run: uv run pytest -vs packages/langchain-graph-retriever | |
--junitxml=junit/test-results-lgr-${{ matrix.python-version }}.xml | |
- name: (3.12 only) Test langchain-graph-retriever (All Stores) | |
if: ${{ success() && matrix.python-version == '3.12' }} | |
id: test | |
run: uv run coverage run -a -m pytest -vs packages/langchain-graph-retriever --stores=all | |
--junitxml=junit/test-results-lgr-${{ matrix.python-version }}.xml | |
env: | |
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} | |
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} | |
ASTRA_DB_KEYSPACE: ci_${{ github.run_id }}_${{ strategy.job-index }}_${{ github.run_attempt }} | |
- name: Drop Astra Keyspace | |
# Even though it seems redundant, the `always() &&` is necessary to signal to | |
# GitHub actions that we want this to run even if the job is cancelled. | |
if: ${{ always() && steps.test.conclusion != 'skipped' }} | |
run: | |
uv run scripts/drop-astra-keyspace.py | |
env: | |
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} | |
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} | |
ASTRA_DB_KEYSPACE: ci_${{ github.run_id }}_${{ strategy.job-index }}_${{ github.run_attempt }} | |
- name: Report Coverage | |
if: ${{ success() && matrix.python-version == '3.12' }} | |
run: | | |
uvx coveralls | |
uvx coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run `type-check` | |
run: uv run poe type-check | |
- name: Upload test results | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-*.xml | |
# See https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches to | |
# enable uploading from forks. | |
publish-test-results: | |
name: "Publish test results" | |
needs: tests-and-type-check | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
# only needed unless run with comment_mode: off | |
pull-requests: write | |
# only needed for private repository | |
contents: read | |
# only needed for private repository | |
issues: read | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: pytest-results-* | |
path: artifacts | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "artifacts/**/*.xml" | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up the environment | |
uses: ./.github/actions/setup-python-env | |
- name: Sync Docs Dependencies | |
run: uv sync --all-packages --group=docs --all-extras | |
- name: Check if documentation can be built | |
run: uv run mkdocs build | |
id: build | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} | |
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} | |
docs-deploy: | |
# Deploy docs on push to main. | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # to write to the `gh-pages` branch | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up the environment | |
uses: ./.github/actions/setup-python-env | |
- name: Sync Docs Dependencies | |
run: uv sync --all-packages --group=docs --all-extras | |
# - name: Configure Git User | |
# run: | | |
# # workaround, see https://github.com/actions/checkout/issues/766 | |
# git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
# if ! git config --get user.name; then | |
# git config --global user.name "${GITHUB_ACTOR}" | |
# fi | |
# if ! git config --get user.email; then | |
# git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}" | |
# fi | |
- name: Deploy Docs to gh-pages | |
run: uv run mkdocs gh-deploy --force | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} | |
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} |