fix: add dependencies between build and cd workflows (#44) #4
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
jobs: | |
ci: | |
name: Run Tests, Lint, Type Check, and Build Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up UV Environment | |
uses: astral-sh/[email protected] | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Restore UV Cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.uv-cache | |
key: "uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}" | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
- name: Install Dependencies and Sync Project | |
run: uv sync | |
- name: Run Formatting, Linting, Type Checks, and Tests | |
run: | | |
uv run ruff format ./ | |
uv run ruff check --fix ./ | |
uv run mypy ./ | |
uv run pytest | |
env: | |
CB_USERNAME: '${{ secrets.CB_USERNAME }}' | |
CB_TOKEN: '${{ secrets.CB_TOKEN }}' | |
- name: Upload Test Coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: '${{ secrets.CODECOV_TOKEN }}' | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
- name: Scan with SonarCloud | |
uses: SonarSource/[email protected] | |
env: | |
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | |
- name: Build Documentation | |
run: uv run make clean html --directory docs/ | |
- name: Minimize UV Cache | |
run: uv cache prune --ci |