-
Notifications
You must be signed in to change notification settings - Fork 3
executable file
·128 lines (126 loc) · 4.25 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
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 }}
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 }}
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