This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
chore(deps): update all dependencies #1337
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: set up python 3.10 | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: venv cache | |
id: venv-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./venv | |
key: ${{ runner.os }}-python${{ steps.setup-python.outputs.python-version }}-venv-lint-${{ hashFiles('setup.cfg') }} | |
- name: pre-commit cache | |
id: pre-commit-cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-python${{ steps.setup-python.outputs.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: install dependencies | |
if: steps.venv-cache.outputs.cache-hit != 'true' | |
run: | | |
python -m venv ./venv | |
[[ "$RUNNER_OS" != "Windows" ]] && source ./venv/bin/activate || source ./venv/Scripts/activate | |
python -m pip install --upgrade pip | |
python -m pip install '.[lint]' | |
- name: run linters | |
run: | | |
[[ "$RUNNER_OS" != "Windows" ]] && source ./venv/bin/activate || source ./venv/Scripts/activate | |
SKIP=no-commit-to-branch,pylint pre-commit run -a --show-diff-on-failure | |
pylint ldb tests scripts stubs | |
test: | |
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10'] | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: set up python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: venv cache | |
id: venv-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./venv | |
key: ${{ runner.os }}-python${{ steps.setup-python.outputs.python-version }}-venv-test-${{ hashFiles('setup.cfg') }} | |
- name: install dependencies | |
if: steps.venv-cache.outputs.cache-hit != 'true' | |
run: | | |
python -m venv ./venv | |
[[ "$RUNNER_OS" != "Windows" ]] && source ./venv/bin/activate || source ./venv/Scripts/activate | |
python -m pip install --upgrade pip | |
python -m pip install '.[test-setup,test]' | |
- name: test data cache | |
id: test-data-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./data | |
key: test-data-${{ hashFiles('data.dvc') }} | |
- name: download test data | |
if: steps.test-data-cache.outputs.cache-hit != 'true' | |
run: | | |
[[ "$RUNNER_OS" != "Windows" ]] && source ./venv/bin/activate || source ./venv/Scripts/activate | |
dvc pull | |
- name: ml model cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/clip/RN50.pt | |
~/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth | |
key: ldb-ml-models--clip-rn50--torch-rn18 | |
- name: run tests | |
run: | | |
[[ "$RUNNER_OS" != "Windows" ]] && source ./venv/bin/activate || source ./venv/Scripts/activate | |
pytest | |
build: | |
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }} | |
environment: pypi | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: set up python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build twine | |
- name: build package | |
run: | | |
rm -rf dist/ | |
python -m build --outdir=dist/ | |
twine check dist/* | |
- name: upload to GitHub | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
files: | | |
dist/* | |
- name: upload to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
verify_metadata: false | |
packages_dir: dist/ |