-
Notifications
You must be signed in to change notification settings - Fork 12
141 lines (126 loc) · 4.97 KB
/
run-tests.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
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Run tests
on:
push:
paths-ignore:
- "**.md"
- ".gitignore"
# make our tests run when we have external PRs
pull_request:
paths-ignore:
- "**.md"
- ".gitignore"
defaults:
run:
working-directory: ./
jobs:
run_tests:
runs-on: ubuntu-latest
permissions:
pull-requests: write # this allows to show table and charts in PRs
services:
mariadb:
image: mariadb:10.11
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: just-for-github-actions
MYSQL_DATABASE: greencheck
# rabbitmq
rabbitmq:
image: rabbitmq:3.8
env:
RABBITMQ_USERNAME: "guest"
RABBITMQ_PASSWORD: "guest"
ports:
- 5672:5672
options: '--hostname "rmq" --health-cmd "rabbitmqctl status" --health-interval 10s --health-timeout 10s --health-retries 3 --health-start-period 60s'
strategy:
matrix:
python-version: [3.11]
steps:
- name: Eco CI Energy Estimation - Initialize
uses: green-coding-solutions/[email protected]
with:
task: start-measurement
company-uuid: "7f1d34f0-7666-4378-8d8f-d37cced7ccb0"
project-uuid: "a9946d61-149b-4757-99e5-aaac24acf289"
machine-uuid: "90a9ec92-0884-43bc-8b98-9a7885864307"
continue-on-error: true
- uses: actions/checkout@v4
- name: Eco CI Energy Estimation - Get Measurement
uses: green-coding-solutions/[email protected]
with:
task: get-measurement
label: "checkout"
continue-on-error: true
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Eco CI Energy Estimation - Get Measurement
uses: green-coding-solutions/[email protected]
with:
task: get-measurement
label: "setup-python"
continue-on-error: true
- name: Install tooling for managing dependencies
run: |
python -m pip install --upgrade uv wheel
- name: Eco CI Energy Estimation - Get Measurement
uses: green-coding-solutions/[email protected]
with:
task: get-measurement
label: "pip install uv wheel"
continue-on-error: true
# - name: Set up a cache-key for installations of dependencies, in .venv
# id: cache-venv
# uses: actions/cache@v4
# with:
# path: ./.venv
# key: ${{ runner.os }}-venv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install dependencies
# skipping this check to see if we have a collision between cache keys
# when deploying versus running tests
# if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
uv venv
uv pip install -r requirements/requirements.linux.generated.txt
- name: Eco CI Energy Estimation - Get Measurement
uses: green-coding-solutions/[email protected]
with:
task: get-measurement
label: "pip install requirements"
continue-on-error: true
- name: Run tests
run: |
source .venv/bin/activate
.venv/bin/dotenv -f .env.test run -- pytest
env:
DOMAIN_SNAPSHOT_BUCKET: ${{ secrets.TESTING_DOMAIN_SNAPSHOT_BUCKET }}
DATABASE_URL_READ_ONLY: ${{ secrets.TESTING_DATABASE_URL_READ_ONLY }}
OBJECT_STORAGE_ACCESS_KEY_ID: ${{ secrets.TESTING_OBJECT_STORAGE_ACCESS_KEY_ID }}
OBJECT_STORAGE_SECRET_ACCESS_KEY: ${{ secrets.TESTING_OBJECT_STORAGE_SECRET_ACCESS_KEY }}
OBJECT_STORAGE_ENDPOINT: ${{ secrets.TESTING_OBJECT_STORAGE_ENDPOINT }}
OBJECT_STORAGE_REGION: ${{ secrets.TESTING_OBJECT_STORAGE_REGION }}
OBJECT_STORAGE_BUCKET_NAME: ${{ secrets.TESTING_OBJECT_STORAGE_BUCKET_NAME }}
AMAZON_PROVIDER_ID: ${{ secrets.AMAZON_PROVIDER_ID }}
AMAZON_REMOTE_API_ENDPOINT: ${{ secrets.AMAZON_REMOTE_API_ENDPOINT }}
MICROSOFT_PROVIDER_ID: ${{ secrets.MICROSOFT_PROVIDER_ID }}
MICROSOFT_LOCAL_FILE_DIRECTORY: ${{ secrets.MICROSOFT_LOCAL_FILE_DIRECTORY }}
EQUINIX_PROVIDER_ID: ${{ secrets.EQUINIX_PROVIDER_ID }}
EQUINIX_REMOTE_API_ENDPOINT: ${{ secrets.EQUINIX_REMOTE_API_ENDPOINT }}
AWS_SHARED_CREDENTIALS_FILE: ${{ secrets.AWS_SHARED_CREDENTIALS_FILE }}
AWS_CONFIG_FILE: ${{ secrets.AWS_CONFIG_FILE }}
- name: Eco CI Energy Estimation - Get Measurement
uses: green-coding-solutions/[email protected]
with:
task: get-measurement
label: "pytest"
continue-on-error: true
- name: Eco CI Energy Estimation - End Measurement
uses: green-coding-solutions/[email protected]
with:
task: display-results
pr-comment: true
send-data: true
continue-on-error: true