-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (122 loc) · 3.76 KB
/
ci_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
142
143
144
145
name: CI - Tests
on:
pull_request:
push:
branches:
- 'main'
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected)
jobs:
basic-tests:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected]
with:
# General setup
install_extras: "[dev]"
# pre-commit
run_pre-commit: false
# pylint & safety
python_version_pylint_safety: "3.9"
run_pylint: false
run_safety: true
# ID: 70612
# Package: Jinja2
# Has been disputed by the maintainer and multiple third parties.
# For more information see: https://github.com/advisories/GHSA-f6pv-j8mr-w6rr
safety_options: |
--ignore=70612
# Build dist
python_version_package: "3.9"
build_libs: flit
build_cmd: flit build
# Build documentation
python_version_docs: "3.9"
package_dirs: oteapi_optimade
full_docs_dirs: "models"
pytest:
name: pytest (${{ matrix.os[1] }}-py${{ matrix.python-version }})
runs-on: ${{ matrix.os[0] }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os:
- ["ubuntu-latest", "linux"]
- ["windows-latest", "windows"]
steps:
- name: Checkout oteapi-optimade
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .[test]
- name: Test with pytest
run: pytest -vvv --cov-report=xml
- name: Upload coverage to Codecov
if: github.repository == 'SINTEF/oteapi-optimade'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
flags: local
env:
OS: ${{ matrix.os[0] }}
PYTHON: ${{ matrix.python-version }}
pytest-real-backend:
runs-on: ubuntu-latest
name: pytest-real backend
env:
OTEAPI_PORT: 8080
OPTIMADE_PORT: 5000
OTEAPI_PREFIX: "/api/v1"
services:
redis:
image: redis:latest
volumes:
- redis-persist:/data
ports:
- "6379:6379"
optimade:
image: ghcr.io/materials-consortia/optimade:develop
ports:
- "5000:5000" # the first value should equal `OPTIMADE_PORT`
env:
OPTIMADE_BASE_URL: "http://localhost:5000" # port value should equal `OPTIMADE_PORT`
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .[dev]
- name: Run OTEAPI Service
run: |
docker pull ghcr.io/emmc-asbl/oteapi:${DOCKER_OTEAPI_VERSION}
docker run \
--env "OTEAPI_REDIS_TYPE=redis" \
--env "OTEAPI_REDIS_HOST=localhost" \
--env "OTEAPI_REDIS_PORT=6379" \
--env "OTEAPI_PREFIX=${OTEAPI_PREFIX}" \
--network "host" \
--volume "${PWD}:/oteapi-optimade" \
--entrypoint "" \
ghcr.io/emmc-asbl/oteapi:${DOCKER_OTEAPI_VERSION} \
/bin/bash -c "pip install -v -e /oteapi-optimade && ./entrypoint.sh" &
.github/utils/wait_for_it.sh localhost:${OTEAPI_PORT} -t 240
sleep 5
env:
DOCKER_OTEAPI_VERSION: 'latest'
- name: Run end-2-end tests
run: python .github/utils/end2end_test.py