-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (105 loc) · 3.85 KB
/
Copy pathci.yml
File metadata and controls
134 lines (105 loc) · 3.85 KB
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
129
130
131
132
133
134
name: CI
on:
push:
schedule:
# Every day at ~7:17am Chicago time.
#
# Using a non-zero minute offset since GitHub Actions suggests
# running jobs at a random minute to avoid overloading their
# servers.
#
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '17 12 * * *'
# Cancel in progress runs of this workflow when we push changes to the branch
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
POETRY_VERSION: '1.7.1'
jobs:
pre-commit-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Check pyproject.toml & poetry.lock are in sync
run: poetry lock --check
- name: Install poetry-relax plugin
run: poetry self add poetry-relax
- name: Install dev dependencies
run: poetry install
- name: Run pre-commit checks
uses: pre-commit/action@v3.0.1
- name: Validate renovate config
run: npx --package renovate renovate-config-validator --strict
tests:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Check pyproject.toml & poetry.lock are in sync
run: poetry check --lock
- name: Install dependencies
run: poetry install
- name: Run tests
run: poetry run pytest tests/autoblocks
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Run e2e tests
run: poetry run pytest tests/e2e/test_e2e.py
env:
# Org-scoped API key
AUTOBLOCKS_API_KEY: ${{ secrets.CI_AUTOBLOCKS_API_KEY }}
# User-scoped API key
AUTOBLOCKS_API_KEY_USER: ${{ secrets.CI_AUTOBLOCKS_API_KEY_USER_NICOLE }}
AUTOBLOCKS_INGESTION_KEY: ${{ secrets.CI_AUTOBLOCKS_INGESTION_KEY }}
- name: Run e2e prompts v2 tests
run: poetry run pytest tests/e2e/test_prompts_v2.py
env:
AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }}
- name: Run e2e datasets tests
run: poetry run pytest tests/e2e/test_datasets.py
env:
AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }}
- name: Run e2e app client tests
run: poetry run pytest tests/e2e/test_app_client.py
env:
AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }}
notify:
needs:
- tests
if: always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: slackapi/slack-github-action@v2.1.1
with:
payload: |
{
"text": ":warning: Workflow `${{ github.workflow }}` in repository `${{ github.repository }}` failed. <${{ env.run-url }}|Logs>"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}