[CACHE]feat: cache siren and siret queries #2136
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: Test Search API | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
python-version: [3.10.8] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache build | |
id: restore-build | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: build-${{ env.pythonLocation }}-${{ matrix.os }}-${{ hashFiles('app/requirements.pip') }} | |
restore-keys: build-${{ env.pythonLocation }}-${{ matrix.os }}-${{ hashFiles('app/requirements.pip') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r app/requirements.pip | |
unit-tests: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
needs: [build] | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: [3.10.8] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache build | |
id: restore-build | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: build-${{ env.pythonLocation }}-${{ matrix.os }}-${{ hashFiles('app/requirements.pip') }} | |
- name: unit tests | |
run: | | |
cd app | |
pytest tests/unit_tests -v | |
env: | |
ELASTIC__URL: ${{secrets.ELASTIC_URL_DEV}} | |
ELASTIC__USER: ${{ secrets.ELASTIC_USER_DEV }} | |
ELASTIC__PASSWORD: ${{ secrets.ELASTIC_PASSWORD_DEV }} | |
ENV: ${{ secrets.ENV_DEV }} | |
SENTRY__DSN: ${{ secrets.DSN_SENTRY }} | |
METADATA__URL_CC_JSON: ${{ secrets.METADATA_URL_CC_JSON }} | |
METADATA__URL_UPDATES_JSON: ${{ secrets.METADATA_URL_UPDATES_JSON }} | |
APM__URL: ${{ secrets.APM__URL }} | |
MATOMO__ID_SITE: ${{ secrets.MATOMO__ID_SITE }} | |
MATOMO__TRACKING_URL: ${{ secrets.MATOMO__TRACKING_URL }} | |
REDIS__HOST: ${{ secrets.REDIS__HOST }} | |
REDIS__PORT: ${{ secrets.REDIS__PORT }} | |
REDIS__DATABASE: ${{ secrets.REDIS__DATABASE }} | |
e2e-tests: | |
name: E2E Tests | |
runs-on: ubuntu-latest | |
needs: [unit-tests] | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: [3.10.8] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache build | |
id: restore-build | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: build-${{ env.pythonLocation }}-${{ matrix.os }}-${{ hashFiles('app/requirements.pip') }} | |
- name: Run app | |
run: | | |
cd app | |
fastapi run & | |
echo "********** Application is up **********" | |
sleep 10 | |
pytest tests/e2e_tests -v | |
env: | |
ELASTIC__URL: ${{secrets.ELASTIC_URL_DEV}} | |
ELASTIC__USER: ${{ secrets.ELASTIC_USER_DEV }} | |
ELASTIC__PASSWORD: ${{ secrets.ELASTIC_PASSWORD_DEV }} | |
ENV: ${{ secrets.ENV_DEV }} | |
SENTRY__DSN: ${{ secrets.DSN_SENTRY }} | |
METADATA__URL_CC_JSON: ${{ secrets.METADATA_URL_CC_JSON }} | |
METADATA__URL_UPDATES_JSON: ${{ secrets.METADATA_URL_UPDATES_JSON }} | |
APM__URL: ${{ secrets.APM__URL }} | |
MATOMO__ID_SITE: ${{ secrets.MATOMO__ID_SITE }} | |
MATOMO__TRACKING_URL: ${{ secrets.MATOMO__TRACKING_URL }} | |
REDIS__HOST: ${{ secrets.REDIS__HOST }} | |
REDIS__PORT: ${{ secrets.REDIS__PORT }} | |
REDIS__DATABASE: ${{ secrets.REDIS__DATABASE }} | |
lint-files: | |
name: Lint Code Base | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10.8" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade ruff | |
python -m pip install --upgrade black | |
# Include `--format=github` to enable automatic inline annotations. | |
- name: Run Ruff | |
run: ruff check --diff -- --format=github . | |
- name: Run Black | |
uses: psf/black@stable |